diff options
author | Jannis Harder <me@jix.one> | 2023-02-15 11:21:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-15 11:21:56 +0100 |
commit | 53bda9de542e2e39763520e7291f26f85e57b67b (patch) | |
tree | 33b65583bcd589d6635cfec448c9db028cbee2a3 /tests | |
parent | 59de4a0e7fbc56fdfa8bb8cd2b18c6913ef8a469 (diff) | |
parent | 777c589e8576b3f8fbe6621efffb1224b1f372b7 (diff) | |
download | yosys-53bda9de542e2e39763520e7291f26f85e57b67b.tar.gz yosys-53bda9de542e2e39763520e7291f26f85e57b67b.tar.bz2 yosys-53bda9de542e2e39763520e7291f26f85e57b67b.zip |
Merge pull request #3661 from daglem/struct-array-range-offset
Handle range offsets in packed arrays within packed structs
Diffstat (limited to 'tests')
-rw-r--r-- | tests/svtypes/struct_array.sv | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/svtypes/struct_array.sv b/tests/svtypes/struct_array.sv index 739f202ab..a0b84640d 100644 --- a/tests/svtypes/struct_array.sv +++ b/tests/svtypes/struct_array.sv @@ -141,6 +141,26 @@ module top; always_comb assert(s3_llb==80'hFC00_4200_0012_3400_FFFC); + struct packed { + bit [-10:-3] [-2:-1] [5:2] a; + bit [0:15] b; // filler for non-zero offset + } s3_off; + + initial begin + s3_off = '0; + + s3_off.a[-5:-4] = 16'h1234; + s3_off.a[-8] = 8'h42; + + s3_off.a[-10] = '1; + s3_off.a[-10][-1][3:0] = '0; + + s3_off.b = '1; + s3_off.b[14:15] = '0; + end + + always_comb assert(s3_off==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. |