From 201416a0c77131932c7e5753dd9f80f2f7f80e92 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 23 Nov 2025 17:14:44 -0500 Subject: [PATCH] Tests: Misc cleanups --- test_regress/t/t_event_control.v | 2 +- test_regress/t/t_randcase.v | 2 +- test_regress/t/t_randsequence.out | 106 ++--- test_regress/t/t_randsequence.v | 370 +++++++++--------- test_regress/t/t_randsequence_bad.out | 18 +- test_regress/t/t_randsequence_bad.py | 2 +- test_regress/t/t_randsequence_bad.v | 30 +- test_regress/t/t_randsequence_recurse.out | 6 +- test_regress/t/t_randsequence_recurse.v | 28 +- test_regress/t/t_randsequence_rs_bad.out | 8 + test_regress/t/t_randsequence_rs_bad.py | 16 + test_regress/t/t_randsequence_rs_bad.v | 23 ++ .../t/t_randsequence_rule_code_bad.out | 5 + .../t/t_randsequence_rule_code_bad.py | 16 + test_regress/t/t_randsequence_rule_code_bad.v | 21 + test_regress/t/t_stream_dynamic.v | 2 +- .../t/t_structu_dataType_assignment.v | 2 +- 17 files changed, 373 insertions(+), 284 deletions(-) create mode 100644 test_regress/t/t_randsequence_rs_bad.out create mode 100755 test_regress/t/t_randsequence_rs_bad.py create mode 100644 test_regress/t/t_randsequence_rs_bad.v create mode 100644 test_regress/t/t_randsequence_rule_code_bad.out create mode 100755 test_regress/t/t_randsequence_rule_code_bad.py create mode 100644 test_regress/t/t_randsequence_rule_code_bad.v diff --git a/test_regress/t/t_event_control.v b/test_regress/t/t_event_control.v index ec4d2004b..447c189f2 100644 --- a/test_regress/t/t_event_control.v +++ b/test_regress/t/t_event_control.v @@ -10,7 +10,7 @@ module t(/*AUTOARG*/ ); input clk; - initial begin; + initial begin @(clk); $write("[%0t] Got\n", $time); @(clk); diff --git a/test_regress/t/t_randcase.v b/test_regress/t/t_randcase.v index ee4fb6f68..0840ef591 100644 --- a/test_regress/t/t_randcase.v +++ b/test_regress/t/t_randcase.v @@ -24,7 +24,7 @@ module t; return i; endfunction - initial begin; + initial begin if (randfunc() != 100) $stop; // diff --git a/test_regress/t/t_randsequence.out b/test_regress/t/t_randsequence.out index 51c2f290f..3c75aaf5b 100644 --- a/test_regress/t/t_randsequence.out +++ b/test_regress/t/t_randsequence.out @@ -1,59 +1,59 @@ -%Error-UNSUPPORTED: t/t_randsequence.v:23:7: Unsupported: randsequence - 23 | randsequence(main) - | ^~~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_randsequence.v:23:5: Unsupported: randsequence + 23 | randsequence(main) + | ^~~~~~~~~~~~ ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest -%Error-UNSUPPORTED: t/t_randsequence.v:40:7: Unsupported: randsequence - 40 | randsequence(main) +%Error-UNSUPPORTED: t/t_randsequence.v:40:5: Unsupported: randsequence + 40 | randsequence(main) + | ^~~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_randsequence.v:51:5: Unsupported: randsequence + 51 | randsequence() + | ^~~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_randsequence.v:58:5: Unsupported: randsequence + 58 | randsequence() + | ^~~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_randsequence.v:65:7: Unsupported: randsequence + 65 | randsequence(main) | ^~~~~~~~~~~~ -%Error-UNSUPPORTED: t/t_randsequence.v:51:7: Unsupported: randsequence - 51 | randsequence() +%Error-UNSUPPORTED: t/t_randsequence.v:79:7: Unsupported: randsequence + 79 | randsequence(main) | ^~~~~~~~~~~~ -%Error-UNSUPPORTED: t/t_randsequence.v:58:7: Unsupported: randsequence - 58 | randsequence() +%Error-UNSUPPORTED: t/t_randsequence.v:81:17: Unsupported: randsequence if + 81 | one_if: if (i % 10 == 0) count_1 else most; + | ^~ +%Error-UNSUPPORTED: t/t_randsequence.v:87:15: Unsupported: randsequence case + 87 | most: case (i % 10) + | ^~~~ +%Error-UNSUPPORTED: t/t_randsequence.v:103:7: Unsupported: randsequence + 103 | randsequence(main) | ^~~~~~~~~~~~ -%Error-UNSUPPORTED: t/t_randsequence.v:65:10: Unsupported: randsequence - 65 | randsequence(main) - | ^~~~~~~~~~~~ -%Error-UNSUPPORTED: t/t_randsequence.v:79:10: Unsupported: randsequence - 79 | randsequence(main) - | ^~~~~~~~~~~~ -%Error-UNSUPPORTED: t/t_randsequence.v:81:21: Unsupported: randsequence if - 81 | one_if: if (i % 10 == 0) count_1 else most; - | ^~ -%Error-UNSUPPORTED: t/t_randsequence.v:87:19: Unsupported: randsequence case - 87 | most: case (i % 10) - | ^~~~ -%Error-UNSUPPORTED: t/t_randsequence.v:103:10: Unsupported: randsequence - 103 | randsequence(main) - | ^~~~~~~~~~~~ -%Error-UNSUPPORTED: t/t_randsequence.v:105:21: Unsupported: randsequence if - 105 | one_if: if (i % 10 == 0) count_1 else most; - | ^~ -%Error-UNSUPPORTED: t/t_randsequence.v:111:19: Unsupported: randsequence case - 111 | most: case (i % 10) - | ^~~~ -%Error-UNSUPPORTED: t/t_randsequence.v:126:7: Unsupported: randsequence - 126 | randsequence(main) +%Error-UNSUPPORTED: t/t_randsequence.v:105:17: Unsupported: randsequence if + 105 | one_if: if (i % 10 == 0) count_1 else most; + | ^~ +%Error-UNSUPPORTED: t/t_randsequence.v:111:15: Unsupported: randsequence case + 111 | most: case (i % 10) + | ^~~~ +%Error-UNSUPPORTED: t/t_randsequence.v:126:5: Unsupported: randsequence + 126 | randsequence(main) + | ^~~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_randsequence.v:127:13: Unsupported: randsequence repeat + 127 | main: repeat(10) count_1; + | ^~~~~~ +%Error-UNSUPPORTED: t/t_randsequence.v:135:7: Unsupported: randsequence + 135 | randsequence(main) + | ^~~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_randsequence.v:147:7: Unsupported: randsequence + 147 | randsequence(main) + | ^~~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_randsequence.v:152:7: Unsupported: randsequence + 152 | randsequence(main) + | ^~~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_randsequence.v:167:7: Unsupported: randsequence + 167 | randsequence(main) + | ^~~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_randsequence.v:185:7: Unsupported: randsequence + 185 | randsequence(main) + | ^~~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_randsequence.v:202:7: Unsupported: randsequence + 202 | randsequence(main) | ^~~~~~~~~~~~ -%Error-UNSUPPORTED: t/t_randsequence.v:127:16: Unsupported: randsequence repeat - 127 | main: repeat(10) count_1; - | ^~~~~~ -%Error-UNSUPPORTED: t/t_randsequence.v:135:10: Unsupported: randsequence - 135 | randsequence(main) - | ^~~~~~~~~~~~ -%Error-UNSUPPORTED: t/t_randsequence.v:147:10: Unsupported: randsequence - 147 | randsequence(main) - | ^~~~~~~~~~~~ -%Error-UNSUPPORTED: t/t_randsequence.v:152:10: Unsupported: randsequence - 152 | randsequence(main) - | ^~~~~~~~~~~~ -%Error-UNSUPPORTED: t/t_randsequence.v:167:10: Unsupported: randsequence - 167 | randsequence(main) - | ^~~~~~~~~~~~ -%Error-UNSUPPORTED: t/t_randsequence.v:185:10: Unsupported: randsequence - 185 | randsequence(main) - | ^~~~~~~~~~~~ -%Error-UNSUPPORTED: t/t_randsequence.v:202:10: Unsupported: randsequence - 202 | randsequence(main) - | ^~~~~~~~~~~~ %Error: Exiting due to diff --git a/test_regress/t/t_randsequence.v b/test_regress/t/t_randsequence.v index 9c1b31b62..d112d08e6 100644 --- a/test_regress/t/t_randsequence.v +++ b/test_regress/t/t_randsequence.v @@ -13,206 +13,206 @@ module t; - localparam int COUNT = 1000; + localparam int COUNT = 1000; - int seq; - int counts[8]; + int seq; + int counts[8]; - function automatic int sfunc(); - int o = 2; + function automatic int sfunc(); + int o = 2; + randsequence(main) + main : one; + one : { o = 1; }; + endsequence + return o; + endfunction + + task prep(); + for (int i = 0; i < COUNT; ++i) counts[i] = 0; + endtask + + initial begin + if (sfunc() != 1) $stop; + + // simple + prep(); + seq = 0; + randsequence(main) + main: one two three; + two: { `checkd(seq, 1); seq = 2; }; + one: { `checkd(seq, 0); seq = 1; }; + three: { `checkd(seq, 2); seq = 3; }; + endsequence + `checkd(seq, 3); + + // simple unnamed + prep(); + seq = 0; + randsequence() + unnamed: { seq = 2; }; + endsequence + `checkd(seq, 2); + + // empty block + prep(); + randsequence() + unnamed: { }; + endsequence + + // weight + prep(); + for (int i = 0; i < COUNT; ++i) begin randsequence(main) - main : one; - one : { o = 1; }; + main: one | two | three := 2; + one: { ++counts[0]; }; + two: { ++counts[1]; }; + three: { ++counts[2]; }; endsequence - return o; - endfunction + end + `check_within_30_percent(counts[0], COUNT * 1 / 4); + `check_within_30_percent(counts[1], COUNT * 1 / 4); + `check_within_30_percent(counts[2], COUNT * 2 / 4); - task prep(); - for (int i = 0; i < COUNT; ++i) counts[i] = 0; - endtask - - initial begin; - if (sfunc() != 1) $stop; - - // simple - prep(); - seq = 0; + // case + prep(); + for (int i = 0; i < COUNT; ++i) begin randsequence(main) - main: one two three; - two: { `checkd(seq, 1); seq = 2; }; - one: { `checkd(seq, 0); seq = 1; }; - three: { `checkd(seq, 2); seq = 3; }; + main: one_if; + one_if: if (i % 10 == 0) count_1 else most; + count_1: { ++counts[1]; }; + count_2: { ++counts[2]; }; + count_3: { ++counts[3]; }; + count_4: { ++counts[4]; }; + bad: { $stop; }; + most: case (i % 10) + 0: bad; + 1, 2: count_2; + 3, 4, 5: count_3; + default: count_4; + endcase; endsequence - `checkd(seq, 3); + end + `check_within_30_percent(counts[1], COUNT * 1 / 10); + `check_within_30_percent(counts[2], COUNT * 2 / 10); + `check_within_30_percent(counts[3], COUNT * 3 / 10); + `check_within_30_percent(counts[4], COUNT * 4 / 10); - // simple unnamed - prep(); - seq = 0; - randsequence() - unnamed: { seq = 2; }; - endsequence - `checkd(seq, 2); - - // empty block - prep(); - randsequence() - unnamed: { }; - endsequence - - // weight - prep(); - for (int i = 0; i < COUNT; ++i) begin - randsequence(main) - main: one | two | three := 2; - one: { ++counts[0]; }; - two: { ++counts[1]; }; - three: { ++counts[2]; }; - endsequence - end - `check_within_30_percent(counts[0], COUNT * 1 / 4); - `check_within_30_percent(counts[1], COUNT * 1 / 4); - `check_within_30_percent(counts[2], COUNT * 2 / 4); - - // case - prep(); - for (int i = 0; i < COUNT; ++i) begin - randsequence(main) - main: one_if; - one_if: if (i % 10 == 0) count_1 else most; - count_1: { ++counts[1]; }; - count_2: { ++counts[2]; }; - count_3: { ++counts[3]; }; - count_4: { ++counts[4]; }; - bad: { $stop; }; - most: case (i % 10) - 0: bad; - 1, 2: count_2; - 3, 4, 5: count_3; - default: count_4; - endcase; - endsequence - end - `check_within_30_percent(counts[1], COUNT * 1 / 10); - `check_within_30_percent(counts[2], COUNT * 2 / 10); - `check_within_30_percent(counts[3], COUNT * 3 / 10); - `check_within_30_percent(counts[4], COUNT * 4 / 10); - - // case - different default - prep(); - for (int i = 0; i < COUNT; ++i) begin - randsequence(main) - main: one_if; - one_if: if (i % 10 == 0) count_1 else most; - count_1: { ++counts[1]; }; - count_2: { ++counts[2]; }; - count_3: { ++counts[3]; }; - count_4: { ++counts[4]; }; - bad: { $stop; }; - most: case (i % 10) - 0: bad; - 1, 2: count_2; - 3, 4, 5: count_3; - default count_4; // No : - endcase; - endsequence - end - `check_within_30_percent(counts[1], COUNT * 1 / 10); - `check_within_30_percent(counts[2], COUNT * 2 / 10); - `check_within_30_percent(counts[3], COUNT * 3 / 10); - `check_within_30_percent(counts[4], COUNT * 4 / 10); - - // repeat - prep(); + // case - different default + prep(); + for (int i = 0; i < COUNT; ++i) begin randsequence(main) - main: repeat(10) count_1; - count_1: { ++counts[1]; }; + main: one_if; + one_if: if (i % 10 == 0) count_1 else most; + count_1: { ++counts[1]; }; + count_2: { ++counts[2]; }; + count_3: { ++counts[3]; }; + count_4: { ++counts[4]; }; + bad: { $stop; }; + most: case (i % 10) + 0: bad; + 1, 2: count_2; + 3, 4, 5: count_3; + default count_4; // No : + endcase; endsequence - `checkd(counts[1], 10); + end + `check_within_30_percent(counts[1], COUNT * 1 / 10); + `check_within_30_percent(counts[2], COUNT * 2 / 10); + `check_within_30_percent(counts[3], COUNT * 3 / 10); + `check_within_30_percent(counts[4], COUNT * 4 / 10); - // rand join - prep(); - for (int i = 0; i < COUNT; ++i) begin - randsequence(main) - main: rand join count_1 count_2; - count_1: { ++counts[1]; }; - count_2: { ++counts[2]; }; - endsequence - end - `check_within_30_percent(counts[1], COUNT * 1 / 1); - `check_within_30_percent(counts[2], COUNT * 1 / 1); + // repeat + prep(); + randsequence(main) + main: repeat(10) count_1; + count_1: { ++counts[1]; }; + endsequence + `checkd(counts[1], 10); - // rand join weight (TODO weight not tested yet) - prep(); - for (int i = 0; i < COUNT; ++i) begin - randsequence(main) - main: rand join (1.0) count_1 count_2; - count_1: { ++counts[1]; }; - count_2: { ++counts[2]; }; - endsequence - randsequence(main) - main: rand join (0.0) count_3 count_4; - count_3: { ++counts[3]; }; - count_4: { ++counts[4]; }; - endsequence - end - `check_within_30_percent(counts[1], COUNT * 1 / 1); - `check_within_30_percent(counts[2], COUNT * 1 / 1); - `check_within_30_percent(counts[3], COUNT * 1 / 1); - `check_within_30_percent(counts[4], COUNT * 1 / 1); + // rand join + prep(); + for (int i = 0; i < COUNT; ++i) begin + randsequence(main) + main: rand join count_1 count_2; + count_1: { ++counts[1]; }; + count_2: { ++counts[2]; }; + endsequence + end + `check_within_30_percent(counts[1], COUNT * 1 / 1); + `check_within_30_percent(counts[2], COUNT * 1 / 1); - // break - prep(); - for (int i = 0; i < COUNT; ++i) begin - automatic bit fiftyfifty = i[0]; - randsequence(main) - main: count_1 check count_2; - check: count_3 { if (fiftyfifty) break; } count_4; - count_1: { ++counts[1]; }; - count_2: { ++counts[2]; }; - count_3: { ++counts[3]; }; - count_4: { ++counts[4]; }; - endsequence - end - `checkd(counts[1], COUNT * 1 / 1); - `checkd(counts[2], COUNT * 1 / 2); // break - `checkd(counts[3], COUNT * 1 / 1); - `checkd(counts[4], COUNT * 1 / 2); // break or return + // rand join weight (TODO weight not tested yet) + prep(); + for (int i = 0; i < COUNT; ++i) begin + randsequence(main) + main: rand join (1.0) count_1 count_2; + count_1: { ++counts[1]; }; + count_2: { ++counts[2]; }; + endsequence + randsequence(main) + main: rand join (0.0) count_3 count_4; + count_3: { ++counts[3]; }; + count_4: { ++counts[4]; }; + endsequence + end + `check_within_30_percent(counts[1], COUNT * 1 / 1); + `check_within_30_percent(counts[2], COUNT * 1 / 1); + `check_within_30_percent(counts[3], COUNT * 1 / 1); + `check_within_30_percent(counts[4], COUNT * 1 / 1); - // return - prep(); - for (int i = 0; i < COUNT; ++i) begin - automatic bit fiftyfifty = i[0]; - randsequence(main) - main: count_1 check count_2; - check: count_3 { if (fiftyfifty) return; } count_4; - count_1: { ++counts[1]; }; - count_2: { ++counts[2]; }; - count_3: { ++counts[3]; }; - count_4: { ++counts[4]; }; - endsequence - end - `checkd(counts[1], COUNT * 1 / 1); - `checkd(counts[2], COUNT * 1 / 1); // return - `checkd(counts[3], COUNT * 1 / 1); - `checkd(counts[4], COUNT * 1 / 2); // break or return + // break + prep(); + for (int i = 0; i < COUNT; ++i) begin + automatic bit fiftyfifty = i[0]; + randsequence(main) + main: count_1 check count_2; + check: count_3 { if (fiftyfifty) break; } count_4; + count_1: { ++counts[1]; }; + count_2: { ++counts[2]; }; + count_3: { ++counts[3]; }; + count_4: { ++counts[4]; }; + endsequence + end + `checkd(counts[1], COUNT * 1 / 1); + `checkd(counts[2], COUNT * 1 / 2); // break + `checkd(counts[3], COUNT * 1 / 1); + `checkd(counts[4], COUNT * 1 / 2); // break or return - // functions - prep(); - for (int i = 0; i < COUNT; ++i) begin - randsequence(main) - main: f_1 f_2 f_3; - f_1 : func(10); - f_2 : func(20); - f_3 : fnoarg; - void func(int n) : { counts[1] += n; }; - void fnoarg : { ++counts[2]; }; - endsequence - end - `checkd(counts[1], COUNT * (10 + 20)); - `checkd(counts[2], COUNT * 1 / 1); // return + // return + prep(); + for (int i = 0; i < COUNT; ++i) begin + automatic bit fiftyfifty = i[0]; + randsequence(main) + main: count_1 check count_2; + check: count_3 { if (fiftyfifty) return; } count_4; + count_1: { ++counts[1]; }; + count_2: { ++counts[2]; }; + count_3: { ++counts[3]; }; + count_4: { ++counts[4]; }; + endsequence + end + `checkd(counts[1], COUNT * 1 / 1); + `checkd(counts[2], COUNT * 1 / 1); // return + `checkd(counts[3], COUNT * 1 / 1); + `checkd(counts[4], COUNT * 1 / 2); // break or return - $write("*-* All Finished *-*\n"); - $finish; - end + // functions + prep(); + for (int i = 0; i < COUNT; ++i) begin + randsequence(main) + main: f_1 f_2 f_3; + f_1 : func(10); + f_2 : func(20); + f_3 : fnoarg; + void func(int n) : { counts[1] += n; }; + void fnoarg : { ++counts[2]; }; + endsequence + end + `checkd(counts[1], COUNT * (10 + 20)); + `checkd(counts[2], COUNT * 1 / 1); // return + + $write("*-* All Finished *-*\n"); + $finish; + end endmodule diff --git a/test_regress/t/t_randsequence_bad.out b/test_regress/t/t_randsequence_bad.out index bf1205d04..3c7b195df 100644 --- a/test_regress/t/t_randsequence_bad.out +++ b/test_regress/t/t_randsequence_bad.out @@ -1,11 +1,11 @@ -%Error-UNSUPPORTED: t/t_randsequence_bad.v:12:7: Unsupported: randsequence - 12 | randsequence(no_such_production) - | ^~~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_randsequence_bad.v:12:5: Unsupported: randsequence + 12 | randsequence(no_such_production) + | ^~~~~~~~~~~~ ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest -%Error-UNSUPPORTED: t/t_randsequence_bad.v:16:7: Unsupported: randsequence - 16 | randsequence(main) - | ^~~~~~~~~~~~ -%Error-UNSUPPORTED: t/t_randsequence_bad.v:21:7: Unsupported: randsequence - 21 | randsequence() - | ^~~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_randsequence_bad.v:16:5: Unsupported: randsequence + 16 | randsequence(main) + | ^~~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_randsequence_bad.v:21:5: Unsupported: randsequence + 21 | randsequence() + | ^~~~~~~~~~~~ %Error: Exiting due to diff --git a/test_regress/t/t_randsequence_bad.py b/test_regress/t/t_randsequence_bad.py index e33e10acf..31228c9a7 100755 --- a/test_regress/t/t_randsequence_bad.py +++ b/test_regress/t/t_randsequence_bad.py @@ -9,7 +9,7 @@ import vltest_bootstrap -test.scenarios('vlt') +test.scenarios('linter') test.lint(fails=True, expect_filename=test.golden_filename) diff --git a/test_regress/t/t_randsequence_bad.v b/test_regress/t/t_randsequence_bad.v index e6e5515bc..1d19f5d2c 100644 --- a/test_regress/t/t_randsequence_bad.v +++ b/test_regress/t/t_randsequence_bad.v @@ -8,23 +8,23 @@ module t; - initial begin; - randsequence(no_such_production) // Bad - such_production: { }; - endsequence + initial begin; + randsequence(no_such_production) // Bad + such_production: { }; + endsequence - randsequence(main) - main: production_bad; // Bad - production_baa: {}; - endsequence + randsequence(main) + main: production_bad; // Bad + production_baa: {}; + endsequence - randsequence() - duplicated_bad: { $display("dup1"); }; - duplicated_bad: { $display("dup2"); }; // Bad - endsequence + randsequence() + duplicated_bad: { $display("dup1"); }; + duplicated_bad: { $display("dup2"); }; // Bad + endsequence - $write("*-* All Finished *-*\n"); - $finish; - end + $write("*-* All Finished *-*\n"); + $finish; + end endmodule diff --git a/test_regress/t/t_randsequence_recurse.out b/test_regress/t/t_randsequence_recurse.out index 82d3e33fe..c7af7993e 100644 --- a/test_regress/t/t_randsequence_recurse.out +++ b/test_regress/t/t_randsequence_recurse.out @@ -1,5 +1,5 @@ -%Error-UNSUPPORTED: t/t_randsequence_recurse.v:21:7: Unsupported: randsequence - 21 | randsequence(main) - | ^~~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_randsequence_recurse.v:21:5: Unsupported: randsequence + 21 | randsequence(main) + | ^~~~~~~~~~~~ ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest %Error: Exiting due to diff --git a/test_regress/t/t_randsequence_recurse.v b/test_regress/t/t_randsequence_recurse.v index e645d2b45..c18f20b99 100644 --- a/test_regress/t/t_randsequence_recurse.v +++ b/test_regress/t/t_randsequence_recurse.v @@ -11,23 +11,23 @@ module t(/*AUTOARG*/); - initial begin + initial begin - int o; - int i; - o = 0; - i = 0; + int o; + int i; + o = 0; + i = 0; - randsequence(main) - main : recurse recurse; - recurse: { i++; if ((i % 4) == 0) break; } add recurse; - add: { o++; } ; - endsequence + randsequence(main) + main : recurse recurse; + recurse: { i++; if ((i % 4) == 0) break; } add recurse; + add: { o++; } ; + endsequence - `checkd(o, 3); + `checkd(o, 3); - $write("*-* All Finished *-*\n"); - $finish; - end + $write("*-* All Finished *-*\n"); + $finish; + end endmodule diff --git a/test_regress/t/t_randsequence_rs_bad.out b/test_regress/t/t_randsequence_rs_bad.out new file mode 100644 index 000000000..0bf04d9ff --- /dev/null +++ b/test_regress/t/t_randsequence_rs_bad.out @@ -0,0 +1,8 @@ +%Error-UNSUPPORTED: t/t_randsequence_rs_bad.v:12:5: Unsupported: randsequence + 12 | randsequence() + | ^~~~~~~~~~~~ + ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest +%Error-UNSUPPORTED: t/t_randsequence_rs_bad.v:14:10: Unsupported: randsequence + 14 | randsequence() + | ^~~~~~~~~~~~ +%Error: Exiting due to diff --git a/test_regress/t/t_randsequence_rs_bad.py b/test_regress/t/t_randsequence_rs_bad.py new file mode 100755 index 000000000..31228c9a7 --- /dev/null +++ b/test_regress/t/t_randsequence_rs_bad.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2024 by Wilson Snyder. This program is free software; you +# can redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. +# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +import vltest_bootstrap + +test.scenarios('linter') + +test.lint(fails=True, expect_filename=test.golden_filename) + +test.passes() diff --git a/test_regress/t/t_randsequence_rs_bad.v b/test_regress/t/t_randsequence_rs_bad.v new file mode 100644 index 000000000..7fe20dade --- /dev/null +++ b/test_regress/t/t_randsequence_rs_bad.v @@ -0,0 +1,23 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// Copyright 2025 by Wilson Snyder. This program is free software; you can +// redistribute it and/or modify it under the terms of either the GNU +// Lesser General Public License Version 3 or the Perl Artistic License +// Version 2.0. +// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +module t; + + initial begin + randsequence() + a: { + randsequence() + b: {}; + endsequence + }; + endsequence + $write("*-* All Finished *-*\n"); + $finish; + end + +endmodule diff --git a/test_regress/t/t_randsequence_rule_code_bad.out b/test_regress/t/t_randsequence_rule_code_bad.out new file mode 100644 index 000000000..1b33d9dee --- /dev/null +++ b/test_regress/t/t_randsequence_rule_code_bad.out @@ -0,0 +1,5 @@ +%Error-UNSUPPORTED: t/t_randsequence_rule_code_bad.v:12:5: Unsupported: randsequence + 12 | randsequence() + | ^~~~~~~~~~~~ + ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest +%Error: Exiting due to diff --git a/test_regress/t/t_randsequence_rule_code_bad.py b/test_regress/t/t_randsequence_rule_code_bad.py new file mode 100755 index 000000000..31228c9a7 --- /dev/null +++ b/test_regress/t/t_randsequence_rule_code_bad.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2024 by Wilson Snyder. This program is free software; you +# can redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. +# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +import vltest_bootstrap + +test.scenarios('linter') + +test.lint(fails=True, expect_filename=test.golden_filename) + +test.passes() diff --git a/test_regress/t/t_randsequence_rule_code_bad.v b/test_regress/t/t_randsequence_rule_code_bad.v new file mode 100644 index 000000000..6d3dbc0bd --- /dev/null +++ b/test_regress/t/t_randsequence_rule_code_bad.v @@ -0,0 +1,21 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// Copyright 2025 by Wilson Snyder. This program is free software; you can +// redistribute it and/or modify it under the terms of either the GNU +// Lesser General Public License Version 3 or the Perl Artistic License +// Version 2.0. +// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +module t; + + initial begin + randsequence() + main : first := 1 { $stop; } | second := 0; + first : { $display("first"); }; + second : { $display("second"); }; + endsequence + $write("*-* All Finished *-*\n"); + $finish; + end + +endmodule diff --git a/test_regress/t/t_stream_dynamic.v b/test_regress/t/t_stream_dynamic.v index bae9c6007..57b6ce26d 100644 --- a/test_regress/t/t_stream_dynamic.v +++ b/test_regress/t/t_stream_dynamic.v @@ -194,7 +194,7 @@ module t; `checkh(rbits, 64'hefbeaddefecadefa); endtask - initial begin; + initial begin test1(); test2(); test3(); diff --git a/test_regress/t/t_structu_dataType_assignment.v b/test_regress/t/t_structu_dataType_assignment.v index 5e658cfe1..734b4dd46 100644 --- a/test_regress/t/t_structu_dataType_assignment.v +++ b/test_regress/t/t_structu_dataType_assignment.v @@ -65,7 +65,7 @@ module top(); // struct HIJ HIJ_struct HIJ; - initial begin; + initial begin // struct ab ab = '{0, 0}; //constant member by position if (ab.a != 0) $stop;