diff options
author | N. Engelhardt <nak@symbioticeda.com> | 2020-08-18 18:54:22 +0200 |
---|---|---|
committer | N. Engelhardt <nak@symbioticeda.com> | 2020-08-18 18:54:22 +0200 |
commit | 850f66cfdd395158e56ef1207d4dc0045ab2fc68 (patch) | |
tree | 330f7c7bf30e64bfc6ac475f7f74ea20fb056cc1 /tests/svtypes/struct_array.sv | |
parent | f80b09fc5853da904dad902b3dfaa5fa44fc51af (diff) | |
download | yosys-850f66cfdd395158e56ef1207d4dc0045ab2fc68.tar.gz yosys-850f66cfdd395158e56ef1207d4dc0045ab2fc68.tar.bz2 yosys-850f66cfdd395158e56ef1207d4dc0045ab2fc68.zip |
include both power-of-two and non-power-of-two testcases
Diffstat (limited to 'tests/svtypes/struct_array.sv')
-rw-r--r-- | tests/svtypes/struct_array.sv | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/tests/svtypes/struct_array.sv b/tests/svtypes/struct_array.sv index 9c90375ee..873f7befd 100644 --- a/tests/svtypes/struct_array.sv +++ b/tests/svtypes/struct_array.sv @@ -1,9 +1,9 @@ // test for array indexing in structures module top; - + struct packed { - bit [7:0] [7:0] a; // 8 element packed array of bytes + bit [5:0] [7:0] a; // 6 element packed array of bytes bit [15:0] b; // filler for non-zero offset } s; @@ -13,13 +13,30 @@ module top; s.a[2:1] = 16'h1234; s.a[5] = 8'h42; - s.a[7] = '1; - s.a[7][1:0] = '0; - s.b = '1; s.b[1:0] = '0; end - always_comb assert(s==80'hFC00_4200_0012_3400_FFFC); + always_comb assert(s==64'h4200_0012_3400_FFFC); + + struct packed { + bit [7:0] [7:0] a; // 8 element packed array of bytes + bit [15:0] b; // filler for non-zero offset + } s2; + + initial begin + s2 = '0; + + s2.a[2:1] = 16'h1234; + s2.a[5] = 8'h42; + + s2.a[7] = '1; + s2.a[7][1:0] = '0; + + s2.b = '1; + s2.b[1:0] = '0; + end + + always_comb assert(s2==80'hFC00_4200_0012_3400_FFFC); endmodule |