Add regression tests for nested function and final contexts

Check that statements that are not allowed in functions or final procedures
are still rejected when they are placed in a named block scope.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2026-06-06 14:19:25 -07:00
parent 5b512e4f1e
commit de415b2f03
5 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,12 @@
// Check that final context is preserved when elaborating nested blocks.
module test;
task t;
endtask
final begin : nested
t;
end
endmodule

View File

@ -0,0 +1,21 @@
// Check that function context is preserved when elaborating nested blocks.
module test;
reg x;
integer y;
function integer f;
input a;
begin : nested
x <= a;
f = 0;
end
endfunction
initial begin
y = f(1'b1);
$display("FAILED");
end
endmodule

View File

@ -137,9 +137,11 @@ early_sig_elab3 vvp_tests/early_sig_elab3.json
eofmt_percent vvp_tests/eofmt_percent.json
fdisplay3 vvp_tests/fdisplay3.json
final3 vvp_tests/final3.json
final_nested_block_task_fail vvp_tests/final_nested_block_task_fail.json
fmonitor1 vvp_tests/fmonitor1.json
fmonitor2 vvp_tests/fmonitor2.json
fread-error vvp_tests/fread-error.json
func_nested_block_nb_fail vvp_tests/func_nested_block_nb_fail.json
line_directive vvp_tests/line_directive.json
localparam_type vvp_tests/localparam_type.json
macro_str_esc vvp_tests/macro_str_esc.json

View File

@ -0,0 +1,5 @@
{
"type" : "CE",
"source" : "final_nested_block_task_fail.v",
"iverilog-args" : [ "-g2009" ]
}

View File

@ -0,0 +1,4 @@
{
"type" : "CE",
"source" : "func_nested_block_nb_fail.v"
}