veryl-analyzer 0.22.0

A modern hardware description language
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
//! Intentional false positives of combinational-loop analysis.
//!
//! Keep every accepted false-positive class explicit here so that a reported
//! loop is not mistaken for an accidental regression. The accepted classes
//! are:
//! - algebraic identities and cancellation;
//! - two-state operator semantics whose bit influence is narrower than an
//!   identity or whole-value dependency;
//! - constant arithmetic, masks, and predicates that make result bits
//!   independent of structurally present operands;
//! - equivalent results behind data-dependent control flow;
//! - runtime shifts and selectors whose reachable source sets are not one
//!   fixed positional offset;
//! - correlations between separately written or instantiated predicates;
//! - runtime indices below one longest static prefix, including affine offsets,
//!   range-disjoint indices, and static suffix dimensions below a dynamic one;
//! - runtime ranges whose emptiness or exact iteration count requires bound
//!   correlation, inequality reasoning, or the bound type's finite width;
//! - forward/reverse iterator order, overwrite order, `break`, and iterator
//!   predicates excluded by runtime bounds or stride.
//!
//! Each class has a loop-free program below which is intentionally diagnosed.

use super::*;

fn assert_intentional_false_positive(case: &str, code: &str) {
    let complete = comb_loop_analysis_is_complete(code);
    let errors = analyze(code);
    assert!(
        complete
            && !errors.is_empty()
            && errors
                .iter()
                .all(|error| matches!(error, AnalyzerError::CombinationalLoop { .. })),
        "{case}: expected complete analysis and only combinational-loop diagnostics: {errors:?}"
    );
}

// Value and control expressions remain structural dependencies.

#[test]
fn duplicate_xor_operands_remain_structural_inputs() {
    assert_intentional_false_positive(
        "the detector does not prove x ^ x = 0",
        r#"
        module Top (
            o: output bit,
        ) {
            var value: bit;
            assign o = value ^ value;
            assign value = o;
        }
        "#,
    );
}

#[test]
fn identical_ternary_arms_retain_structural_control_dependence() {
    assert_intentional_false_positive(
        "the detector does not eliminate an identical-arm conditional",
        r#"
        module Top (
            o: output bit,
        ) {
            var condition: bit;
            assign o = if condition ? 1'b0 : 1'b0;
            assign condition = o;
        }
        "#,
    );
}

#[test]
fn identical_function_branches_retain_structural_control_dependence() {
    assert_intentional_false_positive(
        "the detector does not prove a function result independent of its condition",
        r#"
        module Top (
            o: output bit,
        ) {
            function choose (condition: input bit) -> bit {
                if condition {
                    return 0;
                } else {
                    return 0;
                }
            }
            var condition: bit;
            assign o = choose(condition);
            assign condition = o;
        }
        "#,
    );
}

#[test]
fn a_constant_and_mask_inside_a_function_does_not_remove_the_masked_input_bit() {
    assert_intentional_false_positive(
        "the detector does not remove an input bit annihilated by an AND mask",
        r#"
        module Top (
            o: output bit,
        ) {
            function low (x: input bit<8>) -> bit {
                var tmp: bit<8>;
                tmp = x & 8'b11111110;
                return tmp[0];
            }
            var value: bit<8>;
            assign o = low(value);
            assign value[0] = o;
            assign value[7:1] = 0;
        }
        "#,
    );
}

// These arithmetic cases are definite false positives for two-state `bit`
// operands. The corresponding `logic` cases are left unclassified: that
// depends on whether the detector follows SystemVerilog four-state expression
// semantics or the synthesized two-state circuit.

#[test]
fn addition_does_not_propagate_a_high_input_bit_to_the_low_result_bit() {
    assert_intentional_false_positive(
        "the low sum bit depends only on the low bits of the operands",
        r#"
        module Top (
            rhs: input  bit<8>,
            o  : output bit,
        ) {
            var value: bit<8>;
            var sum  : bit<8>;
            assign sum = value + rhs;
            assign value[7] = sum[0];
            assign value[6:0] = 0;
            assign o = sum[0];
        }
        "#,
    );
}

#[test]
fn subtraction_does_not_propagate_a_high_input_bit_to_the_low_result_bit() {
    assert_intentional_false_positive(
        "the low difference bit depends only on the low bits of the operands",
        r#"
        module Top (
            rhs: input  bit<8>,
            o  : output bit,
        ) {
            var value     : bit<8>;
            var difference: bit<8>;
            assign difference = value - rhs;
            assign value[7] = difference[0];
            assign value[6:0] = 0;
            assign o = difference[0];
        }
        "#,
    );
}

#[test]
fn negation_does_not_propagate_a_high_input_bit_to_the_low_result_bit() {
    assert_intentional_false_positive(
        "the low two's-complement bit depends only on the low input bit",
        r#"
        module Top (
            o: output bit,
        ) {
            var value  : bit<8>;
            var negated: bit<8>;
            assign negated = -value;
            assign value[7] = negated[0];
            assign value[6:0] = 0;
            assign o = negated[0];
        }
        "#,
    );
}

#[test]
fn multiplication_does_not_propagate_a_high_input_bit_to_the_low_result_bit() {
    assert_intentional_false_positive(
        "the low product bit depends only on the low bits of the operands",
        r#"
        module Top (
            rhs: input  bit<8>,
            o  : output bit,
        ) {
            var value  : bit<8>;
            var product: bit<8>;
            assign product = value * rhs;
            assign value[7] = product[0];
            assign value[6:0] = 0;
            assign o = product[0];
        }
        "#,
    );
}

#[test]
fn an_even_constant_multiplier_has_fixed_zero_trailing_bits() {
    assert_intentional_false_positive(
        "multiplication by twelve makes the low two result bits constant zero",
        r#"
        module Top (
            o: output bit,
        ) {
            var value  : bit<8>;
            var product: bit<8>;
            assign product = value * 8'd12;
            assign value[0] = product[1];
            assign value[7:1] = 0;
            assign o = product[1];
        }
        "#,
    );
}

#[test]
fn the_second_bit_of_a_two_state_square_is_always_zero() {
    assert_intentional_false_positive(
        "a square is zero or one modulo four and therefore never sets bit one",
        r#"
        module Top (
            o: output bit,
        ) {
            var value : bit<8>;
            var square: bit<8>;
            assign square = value * value;
            assign value[0] = square[1];
            assign value[7:1] = 0;
            assign o = square[1];
        }
        "#,
    );
}

#[test]
fn unsigned_division_by_a_power_of_two_discards_low_dividend_bits() {
    assert_intentional_false_positive(
        "unsigned division by eight is a right shift and discards the low three bits",
        r#"
        module Top (
            o: output bit,
        ) {
            var value   : bit<8>;
            var quotient: bit<8>;
            assign quotient = value / 8'd8;
            assign value[0] = quotient[0];
            assign value[7:1] = 0;
            assign o = quotient[0];
        }
        "#,
    );
}

#[test]
fn unsigned_remainder_by_a_power_of_two_ignores_high_dividend_bits() {
    assert_intentional_false_positive(
        "remainder by eight retains only the low three dividend bits",
        r#"
        module Top (
            o: output bit,
        ) {
            var value    : bit<8>;
            var remainder: bit<8>;
            assign remainder = value % 8'd8;
            assign value[7] = remainder[0];
            assign value[6:0] = 0;
            assign o = remainder[0];
        }
        "#,
    );
}

// Constants can eliminate individual data or predicate dependencies even when
// an operand remains structurally present in the expression.

#[test]
fn a_constant_or_mask_does_not_retain_the_forced_input_bit() {
    assert_intentional_false_positive(
        "an OR-mask one makes the corresponding result bit independent of the input",
        r#"
        module Top (
            o: output bit,
        ) {
            var value : bit<8>;
            var masked: bit<8>;
            assign masked = value | 8'b00000001;
            assign value[0] = masked[0];
            assign value[7:1] = 0;
            assign o = masked[0];
        }
        "#,
    );
}

#[test]
fn a_false_right_operand_annihilates_a_logical_and_result() {
    assert_intentional_false_positive(
        "a side-effect-free value AND false is independent of the value",
        r#"
        module Top (
            o: output bit,
        ) {
            var value: bit;
            assign o = value && 1'b0;
            assign value = o;
        }
        "#,
    );
}

#[test]
fn a_zero_bit_annihilates_an_and_reduction() {
    assert_intentional_false_positive(
        "an AND reduction containing zero is independent of its other operand bits",
        r#"
        module Top (
            o: output bit,
        ) {
            var value: bit;
            assign o = &{value, 1'b0};
            assign value = o;
        }
        "#,
    );
}

#[test]
fn an_aligned_unsigned_threshold_comparison_ignores_low_operand_bits() {
    assert_intentional_false_positive(
        "an eight-bit value is below 128 exactly when its high bit is zero",
        r#"
        module Top (
            o: output bit,
        ) {
            var value: bit<8>;
            var less : bit;
            assign less = value <: 8'd128;
            assign value[0] = less;
            assign value[7:1] = 0;
            assign o = less;
        }
        "#,
    );
}

#[test]
fn a_signed_comparison_with_zero_ignores_non_sign_bits() {
    assert_intentional_false_positive(
        "a signed value is below zero exactly when its sign bit is one",
        r#"
        module Top (
            o: output bit,
        ) {
            var value   : bit<8>;
            var negative: bit;
            assign negative = $signed(value) <: 0;
            assign value[0] = negative;
            assign value[7:1] = 0;
            assign o = negative;
        }
        "#,
    );
}

#[test]
fn wildcard_comparison_ignores_signal_bits_masked_by_the_pattern() {
    assert_intentional_false_positive(
        "X bits in a constant wildcard pattern do not inspect the corresponding signal bits",
        r#"
        module Top (
            o: output logic,
        ) {
            var value: logic<8>;
            var equal: logic;
            assign equal = value ==? 8'bxxxx0000;
            assign value[7] = equal;
            assign value[6:0] = 0;
            assign o = equal;
        }
        "#,
    );
}

// Runtime mappings are conservatively widened when their reachable bit range
// cannot be represented by one fixed positional offset.

#[test]
fn a_dynamic_left_shift_cannot_move_a_high_input_bit_to_the_low_result_bit() {
    assert_intentional_false_positive(
        "a left shift selects a lower source bit or zero for the low result bit",
        r#"
        module Top (
            amount: input  bit<3>,
            o     : output bit,
        ) {
            var value  : bit<8>;
            var shifted: bit<8>;
            assign shifted = value << amount;
            assign value[7] = shifted[0];
            assign value[6:0] = 0;
            assign o = shifted[0];
        }
        "#,
    );
}

#[test]
fn a_dynamic_right_shift_cannot_move_a_low_input_bit_to_the_high_result_bit() {
    assert_intentional_false_positive(
        "a right shift selects a higher source bit or zero for the high result bit",
        r#"
        module Top (
            amount: input  bit<3>,
            o     : output bit,
        ) {
            var value  : bit<8>;
            var shifted: bit<8>;
            assign shifted = value >> amount;
            assign value[0] = shifted[7];
            assign value[7:1] = 0;
            assign o = shifted[7];
        }
        "#,
    );
}

#[test]
fn a_ternary_condition_does_not_affect_a_result_bit_shared_by_both_arms() {
    assert_intentional_false_positive(
        "the low result bit is zero in both arms even though the complete arm values differ",
        r#"
        module Top (
            o: output bit,
        ) {
            var select: bit;
            var value : bit<2>;
            assign value = if select ? 2'b10 : 2'b00;
            assign select = value[0];
            assign o = value[0];
        }
        "#,
    );
}

#[test]
fn a_one_bit_dynamic_selector_cannot_reach_the_high_vector_bits() {
    assert_intentional_false_positive(
        "a one-bit index reaches only vector bits zero and one",
        r#"
        module Top (
            index: input  bit,
            o    : output bit,
        ) {
            var value: bit<4>;
            assign o = value[index];
            assign value[3] = o;
            assign value[2:0] = 0;
        }
        "#,
    );
}

// Separately written predicates are not correlated.

#[test]
fn separate_complementary_conditionals_are_not_correlated() {
    assert_intentional_false_positive(
        "separately written predicates are not proven mutually exclusive",
        r#"
        module Top (
            sel: input  bit,
            o  : output bit,
        ) {
            var a: bit;
            var b: bit;
            assign a = if sel ? b : 0;
            assign b = if !sel ? a : 0;
            assign o = a | b;
        }
        "#,
    );
}

#[test]
fn complementary_short_circuit_predicates_are_not_correlated() {
    assert_intentional_false_positive(
        "predicates in separate short-circuit operands are not proven mutually exclusive",
        r#"
        module Top (
            sel: input  logic,
            o  : output logic,
        ) {
            var a    : logic;
            var b    : logic;
            var dummy: logic;
            function write_a (value: input logic) -> logic {
                a = value;
                return 1'b0;
            }
            function write_b (value: input logic) -> logic {
                b = value;
                return 1'b0;
            }
            always_comb {
                dummy = (sel && write_a(b)) | (!sel && write_b(a));
                o = a | b | dummy;
            }
        }
        "#,
    );
}

#[test]
fn shared_selector_across_instances_is_not_correlated() {
    assert_intentional_false_positive(
        "separate child instances do not share predicate identity through a common actual",
        r#"
        module SelectRoute (
            sel    : input  logic,
            i      : input  logic,
            o_true : output logic,
            o_false: output logic,
        ) {
            always_comb {
                if sel {
                    o_true = i;
                    o_false = 0;
                } else {
                    o_true = 0;
                    o_false = i;
                }
            }
        }
        module Top (
            sel: input  logic,
            o  : output logic,
        ) {
            var x: logic;
            var y: logic;
            inst forward: SelectRoute (
                sel,
                i      : x,
                o_true : y,
                o_false: _,
            );
            inst reverse: SelectRoute (
                sel,
                i      : y,
                o_true : _,
                o_false: x,
            );
            assign o = x | y;
        }
        "#,
    );
}

// Runtime loops use LSP aliasing and a conservative repeated transfer.

#[test]
fn correlated_dynamic_bounds_create_an_intentional_false_positive() {
    // The actual range n..n+1 contains exactly one iteration. Treating its two
    // bounds conservatively admits a two-iteration path and therefore rejects
    // the potential feedback from value[0] to value[2].
    let code = r#"
        module Top (
            n: input  logic,
            o: output logic,
        ) {
            var value   : logic [3];
            var feedback: logic;
            assign feedback = value[2];
            always_comb {
                value = '{default: 0};
                value[0] = feedback;
                for index in n..(n + 1) {
                    value[index + 1] = value[index];
                }
                o = feedback;
            }
        }
    "#;
    assert_intentional_false_positive(
        "correlated runtime bounds invent a multi-iteration path",
        code,
    );
}

#[test]
fn runtime_loop_prefixes_are_not_ordered_by_iterator_value() {
    // Every concrete execution overwrites value[1] before it can reach
    // value[2]. Collapsing all iterator values into one LSP loses that order.
    assert_intentional_false_positive(
        "runtime accesses through index and index plus one share one LSP alias domain",
        r#"
        module Top (
            n: input  logic<3>,
            o: output logic,
        ) {
            var value   : logic [3];
            var feedback: logic;
            assign feedback = value[2];
            always_comb {
                value = '{default: 0};
                value[1] = feedback;
                for index in 0..n {
                    value[index + 1] = value[index];
                }
                o = feedback;
            }
        }
        "#,
    );
}

#[test]
fn reverse_runtime_loop_prefixes_are_not_ordered_by_iterator_value() {
    // Every non-empty concrete range starts at index 2, which kills the seed
    // before any lower element is written.
    assert_intentional_false_positive(
        "a reverse iteration that kills the seed before propagation is not ordered",
        r#"
        module Top (
            n: input  logic<2>,
            o: output logic,
        ) {
            var value   : logic [4];
            var feedback: logic;
            assign feedback = value[0];
            always_comb {
                value = '{default: 0};
                value[2] = feedback;
                for index in rev n..3 {
                    value[index] = value[index + 1];
                }
                o = feedback;
            }
        }
        "#,
    );
}

#[test]
fn runtime_index_offset_is_not_proven_disjoint_from_a_static_element() {
    // For every reachable iterator, index + 1 is in 1..=3 and can never write
    // the feedback source at element zero.
    assert_intentional_false_positive(
        "index plus one shares the array LSP with element zero",
        r#"
        module Top (
            n: input  logic<2>,
            o: output logic,
        ) {
            var value   : logic [4];
            var feedback: logic;
            assign feedback = value[0];
            always_comb {
                value = '{default: 0};
                for index in 0..n {
                    value[index + 1] = feedback;
                }
                o = feedback;
            }
        }
        "#,
    );
}

#[test]
fn static_suffix_below_a_dynamic_dimension_is_not_kept_disjoint() {
    // The body writes only inner element zero while feedback reads inner
    // element one. The dynamic outer index shortens their shared LSP.
    assert_intentional_false_positive(
        "different inner dimensions below a dynamic outer index share one LSP",
        r#"
        module Top (
            n: input  logic<2>,
            o: output logic,
        ) {
            var value   : logic [4, 2];
            var feedback: logic;
            assign feedback = value[0][1];
            always_comb {
                value = '{default: 0};
                for index in 0..n {
                    value[index][0] = feedback;
                }
                o = feedback;
            }
        }
        "#,
    );
}

#[test]
fn runtime_range_emptiness_is_not_proven_from_unsigned_bound_order() {
    // An unsigned value cannot be below zero, so n..0 has no iterations.
    assert_intentional_false_positive(
        "an unsigned forward range ending at zero is always empty",
        r#"
        module Top (
            n: input  logic<3>,
            o: output logic,
        ) {
            var a: logic;
            var b: logic;
            assign a = b;
            always_comb {
                b = 0;
                for _index in n..0 {
                    b = a;
                }
                o = b;
            }
        }
        "#,
    );
}

#[test]
fn runtime_bound_width_is_not_used_as_an_iteration_limit() {
    // A one-bit n is zero or one. The only possible iteration writes value[1]
    // and cannot propagate the seed as far as value[2].
    assert_intentional_false_positive(
        "a one-bit bound permits at most one iteration but closure is unbounded",
        r#"
        module Top (
            n: input  logic,
            o: output logic,
        ) {
            var value   : logic [3];
            var feedback: logic;
            assign feedback = value[2];
            always_comb {
                value = '{default: 0};
                value[0] = feedback;
                for index in 0..n {
                    value[index + 1] = value[index];
                }
                o = feedback;
            }
        }
        "#,
    );
}

#[test]
fn runtime_break_is_not_used_as_an_iteration_limit() {
    // The unconditional break prevents the second iteration required to reach
    // value[2].
    assert_intentional_false_positive(
        "an unconditional break permits one iteration but closure is unbounded",
        r#"
        module Top (
            n: input  logic<2>,
            o: output logic,
        ) {
            var value   : logic [3];
            var feedback: logic;
            assign feedback = value[2];
            always_comb {
                value = '{default: 0};
                value[0] = feedback;
                for index in 0..n {
                    value[index + 1] = value[index];
                    break;
                }
                o = feedback;
            }
        }
        "#,
    );
}

#[test]
fn runtime_stride_reachability_is_not_used_to_prune_iterator_branches() {
    // Starting from zero with step += 2 never executes the index == 1 arm.
    assert_intentional_false_positive(
        "a step of two never reaches the iterator-one feedback arm",
        r#"
        module Top (
            n: input  logic<3>,
            o: output logic,
        ) {
            var value   : logic [3];
            var feedback: logic;
            assign feedback = value[2];
            always_comb {
                value = '{default: 0};
                value[0] = feedback;
                for index in 0..n step += 2 {
                    if index == 0 {
                        value[1] = value[0];
                    }
                    if index == 1 {
                        value[2] = value[1];
                    }
                }
                o = feedback;
            }
        }
        "#,
    );
}

#[test]
fn runtime_bound_relation_is_not_used_to_prune_iterator_branches() {
    // Every iterator produced by n..4 is greater than or equal to n, so the
    // index < n arm is unreachable.
    assert_intentional_false_positive(
        "the iterator is not correlated with the bound that produced it",
        r#"
        module Top (
            n: input  logic<2>,
            o: output logic,
        ) {
            var value   : logic [3];
            var feedback: logic;
            assign feedback = value[2];
            always_comb {
                value = '{default: 0};
                value[1] = feedback;
                for index in n..4 {
                    if index <: n {
                        value[2] = value[1];
                    }
                }
                o = feedback;
            }
        }
        "#,
    );
}

#[test]
fn boolean_cancellation_inside_a_function_does_not_remove_its_input_dependency() {
    assert_intentional_false_positive(
        "the detector does not prove x & 0 = 0",
        r#"
        module Top (
            o: output logic,
        ) {
            function low (x: input logic<8>) -> logic {
                var tmp: logic<8>;
                tmp = x & 8'b00000000;
                return tmp[0];
            }
            var value: logic<8>;
            assign o = low(value);
            assign value[0] = o;
            assign value[7:1] = 0;
        }
        "#,
    );
}