From 30b70923b51e0faa4d90a654776f1bce48a41766 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sat, 22 Jan 2022 13:19:41 +0100 Subject: [PATCH] Add regression test for variable declarations in unnamed blocks SystemVerilog supports variable declarations in unnamed blocks, while Verilog does not. Add a regression test that checks for this. Signed-off-by: Lars-Peter Clausen --- ivtest/ivltests/unnamed_block_var_decl.v | 30 ++++++++++++++++++++++++ ivtest/regress-fsv.list | 1 + ivtest/regress-vlg.list | 1 + 3 files changed, 32 insertions(+) create mode 100644 ivtest/ivltests/unnamed_block_var_decl.v diff --git a/ivtest/ivltests/unnamed_block_var_decl.v b/ivtest/ivltests/unnamed_block_var_decl.v new file mode 100644 index 000000000..8e7544d96 --- /dev/null +++ b/ivtest/ivltests/unnamed_block_var_decl.v @@ -0,0 +1,30 @@ +// Check variable declarations in unnamed blocks +// All of these should pass in SystemVerilog and all but the last should fail in +// Verilog + +module test; + +initial begin + integer x; +end + +initial begin + integer x; + integer y; +end + +initial begin + integer x, y; +end + +initial begin + integer x; + integer y; + x = y; +end + +initial begin + $display("PASSED"); +end + +endmodule diff --git a/ivtest/regress-fsv.list b/ivtest/regress-fsv.list index 777f40427..6181d0388 100644 --- a/ivtest/regress-fsv.list +++ b/ivtest/regress-fsv.list @@ -82,6 +82,7 @@ pr3015421 CE ivltests gold=pr3015421-fsv.gold resetall normal,-Wtimescale ivltests gold=resetall-fsv.gold scope2b normal ivltests sys_func_task_error RE ivltests gold=sys_func_task_error-fsv.gold +unnamed_block_var_decl normal ivltests # We do not run synthesis when forcing SystemVerilog so these pass br995 normal ivltests diff --git a/ivtest/regress-vlg.list b/ivtest/regress-vlg.list index 7f49555ce..1aafa42eb 100644 --- a/ivtest/regress-vlg.list +++ b/ivtest/regress-vlg.list @@ -1675,6 +1675,7 @@ undef_lval_select4b CE ivltests undef_lval_select4c CE ivltests undef_lval_select5 normal ivltests undefined_shift normal ivltests +unnamed_block_var_decl CE ivltests urand_r normal ivltests gold=urand_r.gold urand_r2 normal ivltests gold=urand_r.gold urand_r3 normal ivltests gold=urand_r.gold