Add regression test for `const var`

Check that variables declared with `const var` can not be modified.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2023-07-29 12:20:48 -07:00
parent 06428f3d11
commit bdfd873dc4
3 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,13 @@
// Check that blocking assignment to a const variable fails, when the variable is
// declared with the `var` keyword.
module test;
const var integer x = 10;
initial begin
x = 20; // Error: Assignment to const variable
$display("FAILED");
end
endmodule

View File

@ -73,6 +73,7 @@ sv_const_fail5 vvp_tests/sv_const_fail5.json
sv_const_fail6 vvp_tests/sv_const_fail6.json
sv_const_fail7 vvp_tests/sv_const_fail7.json
sv_const_fail8 vvp_tests/sv_const_fail8.json
sv_const_fail9 vvp_tests/sv_const_fail9.json
sv_foreach9 vvp_tests/sv_foreach9.json
sv_foreach10 vvp_tests/sv_foreach10.json
sv_module_port1 vvp_tests/sv_module_port1.json

View File

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