Add regression test for var init in class method
Check that variable initialization as part of the declaration works as expected in class methods. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
3302ced608
commit
da4ac3607a
|
|
@ -0,0 +1,25 @@
|
|||
// Check that variable initialization as part of the declaration works as
|
||||
// expected in class methods.
|
||||
|
||||
module test;
|
||||
class C;
|
||||
task t(bit check);
|
||||
int x = 10; // The initialization should happen on each invocation
|
||||
if (check) begin
|
||||
if (x === 10) begin
|
||||
$display("PASSED");
|
||||
end else begin
|
||||
$display("FAILED");
|
||||
end
|
||||
end
|
||||
x = 20;
|
||||
endtask
|
||||
endclass
|
||||
|
||||
initial begin
|
||||
C c;
|
||||
c = new;
|
||||
c.t(1'b0);
|
||||
c.t(1'b1);
|
||||
end
|
||||
endmodule
|
||||
|
|
@ -567,6 +567,7 @@ sv_class_method_default1 normal,-g2009 ivltests
|
|||
sv_class_method_default2 normal,-g2009 ivltests
|
||||
sv_class_method_signed1 normal,-g2009 ivltests
|
||||
sv_class_method_signed2 normal,-g2009 ivltests
|
||||
sv_class_method_var_init normal,-g2009 ivltests
|
||||
sv_class_property_signed1 normal,-g2009 ivltests
|
||||
sv_class_property_signed2 normal,-g2009 ivltests
|
||||
sv_class_property_signed3 normal,-g2009 ivltests
|
||||
|
|
|
|||
|
|
@ -422,6 +422,7 @@ sv_class_method_default1 CE,-g2009 ivltests
|
|||
sv_class_method_default2 CE,-g2009 ivltests
|
||||
sv_class_method_signed1 CE,-g2009,-pallowsigned=1 ivltests
|
||||
sv_class_method_signed2 CE,-g2009,-pallowsigned=1 ivltests
|
||||
sv_class_method_var_init CE,-g2009,-pallowsigned=1 ivltests
|
||||
sv_class_property_signed1 CE,-g2009,-pallowsigned=1 ivltests
|
||||
sv_class_property_signed2 CE,-g2009,-pallowsigned=1 ivltests
|
||||
sv_class_property_signed3 CE,-g2009,-pallowsigned=1 ivltests
|
||||
|
|
|
|||
Loading…
Reference in New Issue