From 4c0b06329f0268683dce5e5f35bc14b8639ee514 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sat, 16 Apr 2022 21:15:14 +0200 Subject: [PATCH] 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 --- ivtest/ivltests/sv_typedef_nested_array.v | 43 +++++++++++++++++++++++ ivtest/regress-sv.list | 1 + 2 files changed, 44 insertions(+) create mode 100644 ivtest/ivltests/sv_typedef_nested_array.v diff --git a/ivtest/ivltests/sv_typedef_nested_array.v b/ivtest/ivltests/sv_typedef_nested_array.v new file mode 100644 index 000000000..8078b5c84 --- /dev/null +++ b/ivtest/ivltests/sv_typedef_nested_array.v @@ -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 diff --git a/ivtest/regress-sv.list b/ivtest/regress-sv.list index 547a3752c..d75b11333 100644 --- a/ivtest/regress-sv.list +++ b/ivtest/regress-sv.list @@ -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