Add regression tests for automatic 2-state variable default value
Check that automatic 2-state variables get initialized to 0. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
0dfbcbdf47
commit
6928b38720
|
|
@ -0,0 +1,35 @@
|
|||
// Check that automatic 2-state variables are initialized to 0.
|
||||
|
||||
module test;
|
||||
|
||||
bit failed = 1'b0;
|
||||
|
||||
function automatic int f(int x);
|
||||
int a;
|
||||
if (a !== 0) begin
|
||||
failed = 1'b1;
|
||||
end
|
||||
return x;
|
||||
endfunction
|
||||
|
||||
task automatic t;
|
||||
int a;
|
||||
if (a !== 0) begin
|
||||
failed = 1'b1;
|
||||
end
|
||||
endtask
|
||||
|
||||
initial begin
|
||||
int x;
|
||||
|
||||
t;
|
||||
x = f(10);
|
||||
|
||||
if (failed) begin
|
||||
$display("FAILED");
|
||||
end else begin
|
||||
$display("PASSED");
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -60,6 +60,7 @@ sv_array_assign_fail1 vvp_tests/sv_array_assign_fail1.json
|
|||
sv_array_assign_fail2 vvp_tests/sv_array_assign_fail2.json
|
||||
sv_array_cassign6 vvp_tests/sv_array_cassign6.json
|
||||
sv_array_cassign7 vvp_tests/sv_array_cassign7.json
|
||||
sv_automatic_2state vvp_tests/sv_automatic_2state.json
|
||||
sv_const1 vvp_tests/sv_const1.json
|
||||
sv_const2 vvp_tests/sv_const2.json
|
||||
sv_const3 vvp_tests/sv_const3.json
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "normal",
|
||||
"source" : "sv_automatic_2state.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
Loading…
Reference in New Issue