Add regression tests for package scoped function calls

Check that package scope function calls work with and without arguments as
well as empty positional arguments.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-09-20 19:52:28 +02:00
parent fb8681a376
commit 6fe3e52085
4 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,20 @@
// Check that it is possible to call a package scoped function.
package P;
function integer T(integer x, integer y);
return x + y;
endfunction
endpackage
module test;
initial begin
integer x;
x = P::T(1, 2);
if (x === 3) begin
$display("PASSED");
end else begin
$display("FAILED. x = %d, expected 3", x);
end
end
endmodule

View File

@ -0,0 +1,21 @@
// Check that it is possible to call a package scoped function with no
// arguments.
package P;
function integer T();
return 1;
endfunction
endpackage
module test;
initial begin
integer x;
x = P::T();
if (x === 1) begin
$display("PASSED");
end else begin
$display("FAILED: x = %d, expected 1", x);
end
end
endmodule

View File

@ -0,0 +1,21 @@
// Check that it is possible to call a package scoped function with empty
// positional arguments.
package P;
function integer T(integer x = 1, integer y = 2);
return x + y;
endfunction
endpackage
module test;
initial begin
integer x;
x = P::T(, 4);
if (x === 5) begin
$display("PASSED");
end else begin
$display("FAILED. x = %d, expected 5", x);
end
end
endmodule

View File

@ -609,6 +609,9 @@ sv_port_default11 normal,-g2009 ivltests
sv_port_default12 normal,-g2009 ivltests
sv_port_default13 CE,-g2009 ivltests
sv_port_default14 CE,-g2009 ivltests
sv_ps_function1 normal,-g2009 ivltests
sv_ps_function2 normal,-g2009 ivltests
sv_ps_function3 normal,-g2009 ivltests
sv_queue1 normal,-g2009 ivltests
sv_queue2 normal,-g2009 ivltests
sv_queue3 normal,-g2009 ivltests