diff --git a/ivtest/ivltests/sv_class_const_static_assign_fail.v b/ivtest/ivltests/sv_class_const_static_assign_fail.v new file mode 100644 index 000000000..3601af842 --- /dev/null +++ b/ivtest/ivltests/sv_class_const_static_assign_fail.v @@ -0,0 +1,15 @@ +// Check that a const static property cannot be assigned through an object. + +module test; + + class C; + const static int value = 42; + endclass + + C object; + + initial begin + object.value = 1; + end + +endmodule diff --git a/ivtest/ivltests/sv_class_const_static_init.v b/ivtest/ivltests/sv_class_const_static_init.v new file mode 100644 index 000000000..cc3102dc5 --- /dev/null +++ b/ivtest/ivltests/sv_class_const_static_init.v @@ -0,0 +1,20 @@ +// Check initialization of a const static class property. + +module test; + + class C; + const static int value = 42; + endclass + + C object; + + initial begin + // A static property can be accessed without constructing the object. + if (object.value !== 42) begin + $display("FAILED: expected 42, got %0d", object.value); + end else begin + $display("PASSED"); + end + end + +endmodule diff --git a/ivtest/ivltests/sv_class_const_static_local_fail.v b/ivtest/ivltests/sv_class_const_static_local_fail.v new file mode 100644 index 000000000..614811693 --- /dev/null +++ b/ivtest/ivltests/sv_class_const_static_local_fail.v @@ -0,0 +1,13 @@ +// Check that a const static property cannot be assigned by local lookup. + +module test; + + class C; + const static int value = 42; + + static function void write_value; + value = 1; + endfunction + endclass + +endmodule diff --git a/ivtest/regress-vvp.list b/ivtest/regress-vvp.list index a992aea2f..daed884c7 100644 --- a/ivtest/regress-vvp.list +++ b/ivtest/regress-vvp.list @@ -287,6 +287,9 @@ sv_chained_constructor4 vvp_tests/sv_chained_constructor4.json sv_chained_constructor5 vvp_tests/sv_chained_constructor5.json sv_class_const_derived vvp_tests/sv_class_const_derived.json sv_class_const_nested_block vvp_tests/sv_class_const_nested_block.json +sv_class_const_static_assign_fail vvp_tests/sv_class_const_static_assign_fail.json +sv_class_const_static_init vvp_tests/sv_class_const_static_init.json +sv_class_const_static_local_fail vvp_tests/sv_class_const_static_local_fail.json sv_class_nested_method_call vvp_tests/sv_class_nested_method_call.json sv_class_prop_assign_op1 vvp_tests/sv_class_prop_assign_op1.json sv_class_prop_assign_op2 vvp_tests/sv_class_prop_assign_op2.json diff --git a/ivtest/vvp_tests/sv_class_const_static_assign_fail.json b/ivtest/vvp_tests/sv_class_const_static_assign_fail.json new file mode 100644 index 000000000..d43723aa1 --- /dev/null +++ b/ivtest/vvp_tests/sv_class_const_static_assign_fail.json @@ -0,0 +1,9 @@ +{ + "type" : "CE", + "source" : "sv_class_const_static_assign_fail.v", + "iverilog-args" : [ "-g2005-sv" ], + "vlog95" : { + "__comment" : "Classes are not supported", + "type" : "CE" + } +} diff --git a/ivtest/vvp_tests/sv_class_const_static_init.json b/ivtest/vvp_tests/sv_class_const_static_init.json new file mode 100644 index 000000000..44208d5bb --- /dev/null +++ b/ivtest/vvp_tests/sv_class_const_static_init.json @@ -0,0 +1,9 @@ +{ + "type" : "normal", + "source" : "sv_class_const_static_init.v", + "iverilog-args" : [ "-g2005-sv" ], + "vlog95" : { + "__comment" : "Classes are not supported", + "type" : "CE" + } +} diff --git a/ivtest/vvp_tests/sv_class_const_static_local_fail.json b/ivtest/vvp_tests/sv_class_const_static_local_fail.json new file mode 100644 index 000000000..b3b397781 --- /dev/null +++ b/ivtest/vvp_tests/sv_class_const_static_local_fail.json @@ -0,0 +1,9 @@ +{ + "type" : "CE", + "source" : "sv_class_const_static_local_fail.v", + "iverilog-args" : [ "-g2005-sv" ], + "vlog95" : { + "__comment" : "Classes are not supported", + "type" : "CE" + } +}