aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJannis Harder <me@jix.one>2022-12-07 19:24:12 +0100
committerGitHub <noreply@github.com>2022-12-07 19:24:12 +0100
commit7ad7b550cb1157fb4c5c901006a700cb10d0e722 (patch)
tree3425af2a8929cc520419048314ff73d0ee73edfc /tests
parent1f6ac926a45cd5b757a3ea171777a9a2830cff3f (diff)
parent22090011abda843d79d49bd0a4632592d146e09d (diff)
downloadyosys-7ad7b550cb1157fb4c5c901006a700cb10d0e722.tar.gz
yosys-7ad7b550cb1157fb4c5c901006a700cb10d0e722.tar.bz2
yosys-7ad7b550cb1157fb4c5c901006a700cb10d0e722.zip
Merge pull request #3573 from daglem/struct-array-multidimensional
Support for packed multidimensional arrays within packed structs
Diffstat (limited to 'tests')
-rw-r--r--tests/svtypes/struct_array.sv60
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.