Add regression test for nested const property initialization
Check that a const property can be assigned from a named block inside its class constructor. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
14066871e5
commit
b883f7713c
|
|
@ -0,0 +1,27 @@
|
|||
// Check const property initialization in a nested constructor block.
|
||||
|
||||
module test;
|
||||
|
||||
class C;
|
||||
const int value;
|
||||
|
||||
function new;
|
||||
begin : initialize
|
||||
value = 42;
|
||||
end
|
||||
endfunction
|
||||
endclass
|
||||
|
||||
C object;
|
||||
|
||||
initial begin
|
||||
object = new;
|
||||
|
||||
if (object.value !== 42) begin
|
||||
$display("FAILED: expected 42, got %0d", object.value);
|
||||
end else begin
|
||||
$display("PASSED");
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -286,6 +286,7 @@ sv_chained_constructor3 vvp_tests/sv_chained_constructor3.json
|
|||
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_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
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"type" : "normal",
|
||||
"source" : "sv_class_const_nested_block.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ],
|
||||
"vlog95" : {
|
||||
"__comment" : "Classes are not supported",
|
||||
"type" : "CE"
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue