From c670170ac03f14d122a3471342abcab6cf0d5560 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sat, 15 Jan 2022 19:02:10 +0100 Subject: [PATCH] Add test for direct packed arrays of struct and enums It is possible to directly declare a packed array of a struct or enum without having to create a typedef first. Add a check to the array_packed test that this is supported and works as expected. Signed-off-by: Lars-Peter Clausen --- ivtest/ivltests/array_packed.v | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/ivtest/ivltests/array_packed.v b/ivtest/ivltests/array_packed.v index f84213381..10d2ebadd 100644 --- a/ivtest/ivltests/array_packed.v +++ b/ivtest/ivltests/array_packed.v @@ -23,6 +23,10 @@ EP [2:0] epp1; EPP epp2; EPP [3:0] eppp; +enum logic [7:0] { + B +} [1:0] ep3; + typedef struct packed { longint x; } S1; @@ -54,6 +58,10 @@ SP [9:0] spp1; SPP spp2; SPP [1:0] sppp; +struct packed { + S2 s; +} [3:0] sp3; + bit failed = 1'b0; initial begin @@ -65,17 +73,19 @@ initial begin failed |= $bits(e) !== 8; failed |= $bits(ep1) !== $bits(e) * 2; failed |= $bits(ep2) !== $bits(ep1); + failed |= $bits(ep3) !== $bits(ep1); failed |= $bits(epp1) !== $bits(ep1) * 3; failed |= $bits(epp2) !== $bits(epp1); failed |= $bits(eppp) !== $bits(epp1) * 4; // Packed arrays of structs failed |= $bits(s) !== S_SIZE; - failed |= $bits(sp1) != $bits(s) * 4; - failed |= $bits(sp2) != $bits(sp1); - failed |= $bits(spp1) != $bits(sp1) * 10; - failed |= $bits(spp1) != $bits(spp2); - failed |= $bits(sppp) != $bits(spp1) * 2; + failed |= $bits(sp1) !== $bits(s) * 4; + failed |= $bits(sp2) !== $bits(sp1); + failed |= $bits(sp3) !== $bits(sp1); + failed |= $bits(spp1) !== $bits(sp1) * 10; + failed |= $bits(spp1) !== $bits(spp2); + failed |= $bits(sppp) !== $bits(spp1) * 2; if (failed) $display("FAILED");