diff options
author | Dag Lem <dag@nimrod.no> | 2022-12-03 19:54:47 +0100 |
---|---|---|
committer | Dag Lem <dag@nimrod.no> | 2022-12-03 19:54:47 +0100 |
commit | f94eec952f6ec5f04d5951019a5de2d050076df6 (patch) | |
tree | 605f5d35c160ebf29de6f062f788eefe3a1cbfce /tests/svtypes | |
parent | a64ed824ed6fadf24cf2871d7752f63ab6613c8b (diff) | |
download | yosys-f94eec952f6ec5f04d5951019a5de2d050076df6.tar.gz yosys-f94eec952f6ec5f04d5951019a5de2d050076df6.tar.bz2 yosys-f94eec952f6ec5f04d5951019a5de2d050076df6.zip |
Support for packed multidimensional arrays within packed structs
Diffstat (limited to 'tests/svtypes')
-rw-r--r-- | tests/svtypes/struct_array.sv | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/svtypes/struct_array.sv b/tests/svtypes/struct_array.sv index f69c4c577..739f202ab 100644 --- a/tests/svtypes/struct_array.sv +++ b/tests/svtypes/struct_array.sv @@ -81,6 +81,66 @@ module top; always_comb assert(s3_b==80'hFC00_4200_0012_3400_FFFC); + struct packed { + bit [0:7] [0:1] [0:3] a; + bit [0:15] b; // filler for non-zero offset + } s3_lll; + + initial begin + s3_lll = '0; + + s3_lll.a[5:6] = 16'h1234; + s3_lll.a[2] = 8'h42; + + s3_lll.a[0] = '1; + s3_lll.a[0][1][2:3] = '0; + + s3_lll.b = '1; + s3_lll.b[14:15] = '0; + end + + always_comb assert(s3_lll==80'hFC00_4200_0012_3400_FFFC); + + struct packed { + bit [0:7] [1:0] [0:3] a; + bit [0:15] b; // filler for non-zero offset + } s3_lbl; + + initial begin + s3_lbl = '0; + + s3_lbl.a[5:6] = 16'h1234; + s3_lbl.a[2] = 8'h42; + + s3_lbl.a[0] = '1; + s3_lbl.a[0][0][2:3] = '0; + + s3_lbl.b = '1; + s3_lbl.b[14:15] = '0; + end + + always_comb assert(s3_lbl==80'hFC00_4200_0012_3400_FFFC); + + struct packed { + bit [0:7] [0:1] [3:0] a; + bit [0:15] b; // filler for non-zero offset + } s3_llb; + + initial begin + s3_llb = '0; + + s3_llb.a[5:6] = 16'h1234; + s3_llb.a[2] = 8'h42; + + s3_llb.a[0] = '1; + s3_llb.a[0][1][1:0] = '0; + + s3_llb.b = '1; + s3_llb.b[14:15] = '0; + end + + always_comb assert(s3_llb==80'hFC00_4200_0012_3400_FFFC); + `ifndef VERIFIC // Note that the tests below for unpacked arrays in structs rely on the // fact that they are actually packed in Yosys. |