From 7429a948cca3e9e3c5c0b972d498416c804aea7f Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 28 Dec 2022 19:06:08 -0800 Subject: [PATCH] Add regression tests for package scope identifiers that cross the package boundary Check that an error is reported when accessing a hierarchical identifier through a package scoped identifier. Signed-off-by: Lars-Peter Clausen --- ivtest/ivltests/sv_ps_hier_fail1.v | 16 ++++++++++++++++ ivtest/ivltests/sv_ps_hier_fail2.v | 16 ++++++++++++++++ ivtest/regress-sv.list | 2 ++ 3 files changed, 34 insertions(+) create mode 100644 ivtest/ivltests/sv_ps_hier_fail1.v create mode 100644 ivtest/ivltests/sv_ps_hier_fail2.v diff --git a/ivtest/ivltests/sv_ps_hier_fail1.v b/ivtest/ivltests/sv_ps_hier_fail1.v new file mode 100644 index 000000000..8beaad489 --- /dev/null +++ b/ivtest/ivltests/sv_ps_hier_fail1.v @@ -0,0 +1,16 @@ +// Check that package scoped identifiers lookup does not cross the package +// boundary. + +int x; + +package P; +endpackage + +module test; + initial begin + int y; + y = P::x; // This should fail. x is visible from within the package, + // but can't be accessed through a package scoped identifier. + $display("FAILED"); + end +endmodule diff --git a/ivtest/ivltests/sv_ps_hier_fail2.v b/ivtest/ivltests/sv_ps_hier_fail2.v new file mode 100644 index 000000000..0de96df78 --- /dev/null +++ b/ivtest/ivltests/sv_ps_hier_fail2.v @@ -0,0 +1,16 @@ +// Check that package scoped identifiers lookup does not cross the package +// boundary. + +package P; +endpackage + +module test; + int x; + initial begin + int y; + y = P::test.x; // This should fail. test.x is visible from within the + // package, but it can not be accessed through a package + // scoped identifier. + $display("FAILED"); + end +endmodule diff --git a/ivtest/regress-sv.list b/ivtest/regress-sv.list index 18d0d6f0c..f44c6f748 100644 --- a/ivtest/regress-sv.list +++ b/ivtest/regress-sv.list @@ -704,6 +704,8 @@ sv_ps_function7 normal,-g2009 ivltests sv_ps_function_fail1 CE,-g2009 ivltests sv_ps_function_fail2 CE,-g2009 ivltests sv_ps_function_fail3 CE,-g2009 ivltests +sv_ps_hier_fail1 CE,-g2009 ivltests +sv_ps_hier_fail2 CE,-g2009 ivltests sv_ps_member_sel1 normal,-g2009 ivltests sv_ps_member_sel2 normal,-g2009 ivltests sv_ps_member_sel3 normal,-g2009 ivltests