diff options
author | Peter Crozier <peter@crozier.com> | 2020-06-07 18:28:45 +0100 |
---|---|---|
committer | Peter Crozier <peter@crozier.com> | 2020-06-07 18:33:11 +0100 |
commit | 76c499db71fd6aaae8d2c5436c648d81cc8233f5 (patch) | |
tree | 74f227ad74683dbda53e1f38088b84aa601200e0 /tests/svtypes/struct_array.sv | |
parent | 534be6670d765fd73ff222fca1899b2b83670d5f (diff) | |
download | yosys-76c499db71fd6aaae8d2c5436c648d81cc8233f5.tar.gz yosys-76c499db71fd6aaae8d2c5436c648d81cc8233f5.tar.bz2 yosys-76c499db71fd6aaae8d2c5436c648d81cc8233f5.zip |
Support packed arrays in struct/union.
Diffstat (limited to 'tests/svtypes/struct_array.sv')
-rw-r--r-- | tests/svtypes/struct_array.sv | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/svtypes/struct_array.sv b/tests/svtypes/struct_array.sv new file mode 100644 index 000000000..022ad56c6 --- /dev/null +++ b/tests/svtypes/struct_array.sv @@ -0,0 +1,22 @@ +// test for array indexing in structures + +module top; + + struct packed { + bit [5:0] [7:0] a; // 6 element packed array of bytes + bit [15:0] b; // filler for non-zero offset + } s; + + initial begin + s = '0; + + s.a[2:1] = 16'h1234; + s.a[5] = 8'h42; + + s.b = '1; + s.b[1:0] = '0; + end + + always_comb assert(s==64'h4200_0012_3400_FFFC); + +endmodule |