Add regression test for module port with vector typedef

Check that for a module port with a vector type identifier the type is
elaborated in the scope where it is declared rather than the scope of the
module port.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-10-01 13:49:10 +02:00
parent b7fce4a66e
commit 54afdc1e6b
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,29 @@
// Check that a packed array type identifier used for a module port is
// elaborated in the correct scope.
localparam A = 2;
typedef logic [A-1:0] T;
module test (
input T x
);
localparam A = 5;
bit failed = 1'b0;
`define check(expr, val) \
if (expr !== val) begin \
$display("FAILED: %s, expected %0d, got %0d", `"expr`", val, expr); \
failed = 1'b1; \
end
initial begin
`check($bits(x), 2);
if (!failed) begin
$display("PASSED");
end
end
endmodule

View File

@ -371,6 +371,7 @@ module_nonansi_struct_fail CE,-g2005-sv ivltests
module_output_port_sv_var1 normal,-g2005-sv ivltests
module_output_port_sv_var2 normal,-g2005-sv ivltests
module_port_typedef_array1 normal,-g2005-sv ivltests
module_port_typedef_vector normal,-g2005-sv ivltests
named_begin normal,-g2009 ivltests
named_begin_fail CE,-g2009 ivltests
named_fork normal,-g2009 ivltests