diff --git a/ivtest/ivltests/sv_ps_member_sel1.v b/ivtest/ivltests/sv_ps_member_sel1.v new file mode 100644 index 000000000..7886f306a --- /dev/null +++ b/ivtest/ivltests/sv_ps_member_sel1.v @@ -0,0 +1,18 @@ +// Check that indices to a package scoped identifier get evaluated in the scope +// where the identifier is used, not where the identifier is declared. + +package P; + localparam N = 1; + logic [3:0] x = 4'b0101; +endpackage + +module test; + localparam N = 2; + initial begin + if (P::x[N] === 1'b1) begin + $display("PASSED"); + end else begin + $display("FAILED"); + end + end +endmodule diff --git a/ivtest/ivltests/sv_ps_member_sel2.v b/ivtest/ivltests/sv_ps_member_sel2.v new file mode 100644 index 000000000..122f41782 --- /dev/null +++ b/ivtest/ivltests/sv_ps_member_sel2.v @@ -0,0 +1,21 @@ +// Check that indices to a struct member for package scoped identifier get +// evaluated in the scope where the identifier is used, not where the identifier +// is declared. + +package P; + localparam N = 1; + struct packed { + logic [3:0] x; + } s = 4'b0101; +endpackage + +module test; + localparam N = 2; + initial begin + if (P::s.x[N] === 1'b1) begin + $display("PASSED"); + end else begin + $display("FAILED"); + end + end +endmodule diff --git a/ivtest/ivltests/sv_ps_member_sel3.v b/ivtest/ivltests/sv_ps_member_sel3.v new file mode 100644 index 000000000..fe4fda72c --- /dev/null +++ b/ivtest/ivltests/sv_ps_member_sel3.v @@ -0,0 +1,24 @@ +// Check that indices to a property for package scoped identifier get evaluated +// in the scope where the identifier is used, not where the identifier is +// declared. + +package P; + localparam N = 1; + class C; + localparam X = 4'b0101; + endclass + C c = new; +endpackage + +module test; + localparam N = 2; + + initial begin + if (P::c.X[N] === 1'b1) begin + $display("PASSED"); + end else begin + $display("FAILED"); + end + end + +endmodule diff --git a/ivtest/regress-sv.list b/ivtest/regress-sv.list index 880eeb8d6..cc5a8ec25 100644 --- a/ivtest/regress-sv.list +++ b/ivtest/regress-sv.list @@ -692,6 +692,9 @@ sv_ps_function4 normal,-g2009 ivltests sv_ps_function5 normal,-g2009 ivltests sv_ps_function6 normal,-g2009 ivltests sv_ps_function7 normal,-g2009 ivltests +sv_ps_member_sel1 normal,-g2009 ivltests +sv_ps_member_sel2 normal,-g2009 ivltests +sv_ps_member_sel3 normal,-g2009 ivltests sv_ps_type1 normal,-g2009 ivltests sv_ps_type_cast1 normal,-g2009 ivltests sv_ps_type_cast2 normal,-g2009 ivltests diff --git a/ivtest/regress-vlog95.list b/ivtest/regress-vlog95.list index 375c010a4..76d299369 100644 --- a/ivtest/regress-vlog95.list +++ b/ivtest/regress-vlog95.list @@ -458,6 +458,7 @@ sv_port_default6 CE,-g2009,-pallowsigned=1 ivltests sv_port_default7 CE,-g2009,-pallowsigned=1 ivltests sv_port_default8 CE,-g2009,-pallowsigned=1 ivltests sv_port_default9 CE,-g2009 ivltests +sv_ps_member_sel3 CE,-g2009 ivltests sv_ps_type_class1 CE,-g2009 ivltests sv_ps_type_class_prop CE,-g2009 ivltests sv_root_class CE,-g2009 ivltests