From 542d80b1b1f87f7ab183d3b8818778c8bfb7dab8 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 11 Jun 2023 09:15:09 -0700 Subject: [PATCH] Add regression tests for implicit function/task import the unit scope Check that implicit import of functions and tasks is supported if the wildcard import statement is in the unit scope. Signed-off-by: Lars-Peter Clausen --- ivtest/ivltests/sv_wildcard_import8.v | 28 +++++++++++++++++++++++ ivtest/regress-vvp.list | 1 + ivtest/vvp_tests/sv_wildcard_import8.json | 5 ++++ 3 files changed, 34 insertions(+) create mode 100644 ivtest/ivltests/sv_wildcard_import8.v create mode 100644 ivtest/vvp_tests/sv_wildcard_import8.json diff --git a/ivtest/ivltests/sv_wildcard_import8.v b/ivtest/ivltests/sv_wildcard_import8.v new file mode 100644 index 000000000..fd0d1d77b --- /dev/null +++ b/ivtest/ivltests/sv_wildcard_import8.v @@ -0,0 +1,28 @@ +// Check that implicit imports of functions and tasks works if the wildcard +// import statement is in the unit scope. + +package P; + + function integer f(integer x); + return x * 2; + endfunction + + task t(bit failed); + if (failed) begin + $display("FAILED"); + end else begin + $display("PASSED"); + end + endtask + +endpackage + +import P::*; + +module test; + + initial begin + t(f(10) !== 20); + end + +endmodule diff --git a/ivtest/regress-vvp.list b/ivtest/regress-vvp.list index 681dd1a81..010bbd743 100644 --- a/ivtest/regress-vvp.list +++ b/ivtest/regress-vvp.list @@ -41,6 +41,7 @@ sv_array_cassign6 vvp_tests/sv_array_cassign6.json sv_array_cassign7 vvp_tests/sv_array_cassign7.json sv_foreach9 vvp_tests/sv_foreach9.json sv_foreach10 vvp_tests/sv_foreach10.json +sv_wildcard_import8 vvp_tests/sv_wildcard_import8.json sdf_header vvp_tests/sdf_header.json task_return1 vvp_tests/task_return1.json task_return2 vvp_tests/task_return2.json diff --git a/ivtest/vvp_tests/sv_wildcard_import8.json b/ivtest/vvp_tests/sv_wildcard_import8.json new file mode 100644 index 000000000..aefcb09a9 --- /dev/null +++ b/ivtest/vvp_tests/sv_wildcard_import8.json @@ -0,0 +1,5 @@ +{ + "type" : "normal", + "source" : "sv_wildcard_import8.v", + "iverilog-args" : [ "-g2005-sv" ] +}