diff --git a/ivtest/ivltests/sv_class_localparam.v b/ivtest/ivltests/sv_class_localparam.v new file mode 100644 index 000000000..b92923d81 --- /dev/null +++ b/ivtest/ivltests/sv_class_localparam.v @@ -0,0 +1,28 @@ +// Check that it is possible to declare parameters and localparams inside a +// class. Both declared parameters that can not be overridden. + +module test; + +class C; + // `parameter` is also declaring a local parameter inside a class + parameter A = 1; + localparam B = 2; + + function bit test(); + return A == 1 && B == 2; + endfunction + +endclass + +initial begin + C c; + c = new; + + if (c.test() && c.A == 1 && c.B == 2) begin + $display("PASSED"); + end else begin + $display("FAILED"); + end +end + +endmodule diff --git a/ivtest/regress-sv.list b/ivtest/regress-sv.list index c4b8b163c..887715467 100644 --- a/ivtest/regress-sv.list +++ b/ivtest/regress-sv.list @@ -436,6 +436,7 @@ sv_class22 normal,-g2009 ivltests sv_class23 normal,-g2009 ivltests sv_class24 normal,-g2009 ivltests sv_class_extends_scoped normal,-g2009 ivltests +sv_class_localparam normal,-g2009 ivltests sv_class_new_init normal,-g2009 ivltests sv_darray1 normal,-g2009 ivltests sv_darray2 normal,-g2009 ivltests diff --git a/ivtest/regress-vlog95.list b/ivtest/regress-vlog95.list index 1c66d40f6..4196cb366 100644 --- a/ivtest/regress-vlog95.list +++ b/ivtest/regress-vlog95.list @@ -364,6 +364,7 @@ sv_class22 CE,-g2009 ivltests sv_class23 CE,-g2009 ivltests sv_class24 CE,-g2009 ivltests sv_class_extends_scoped CE,-g2009 ivltests +sv_class_localparam CE,-g2009 ivltests sv_class_new_init CE,-g2009 ivltests sv_end_label CE,-g2009 ivltests # Also generate sv_foreach2 CE,-g2009,-pallowsigned=1 ivltests