Add regression test for nested unpacked arrays

Check that it is possible to declare an unpacked array type with an
unpacked array type as the base type.

Also check that it is possible to declare an signal with an unpacked array
dimension with an unpacked array base type.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-04-16 21:15:14 +02:00
parent b19a6a7518
commit 4c0b06329f
2 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,43 @@
// Check that nested unpacked array types are supported.
module test;
localparam A = 3;
localparam B = 5;
localparam C = 2;
localparam D = 7;
typedef logic [31:0] T1[A];
typedef T1 T2[B][C];
T2 x[D];
T2 y;
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($unpacked_dimensions(x), 4)
`check($size(x, 1), A)
`check($size(x, 2), B)
`check($size(x, 3), C)
`check($size(x, 4), D)
`check($unpacked_dimensions(y), 3)
`check($size(y, 1), A)
`check($size(y, 2), B)
`check($size(y, 3), C)
`check($bits(T2), $bits(integer) * A * B * C)
if (!failed) begin
$display("PASSED");
end
end
endmodule

View File

@ -674,6 +674,7 @@ sv_typedef_darray_base1 normal,-g2009 ivltests
sv_typedef_darray_base2 normal,-g2009 ivltests
sv_typedef_darray_base3 normal,-g2009 ivltests
sv_typedef_darray_base4 normal,-g2009 ivltests
sv_typedef_nested_array normal,-g2009 ivltests
sv_typedef_queue_base1 normal,-g2009 ivltests
sv_typedef_queue_base2 normal,-g2009 ivltests
sv_typedef_queue_base3 normal,-g2009 ivltests