aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorclairexen <claire@symbioticeda.com>2020-06-08 15:22:09 +0200
committerGitHub <noreply@github.com>2020-06-08 15:22:09 +0200
commitf57524cf713e2cdc368ded8b7e13f85d310b8749 (patch)
treecf7f12ad2bc19cc9255a70739a4bdd07c5b90bdf /tests
parent680913be851967225ec7fbfe3ca44c871e6143a0 (diff)
parent76c499db71fd6aaae8d2c5436c648d81cc8233f5 (diff)
downloadyosys-f57524cf713e2cdc368ded8b7e13f85d310b8749.tar.gz
yosys-f57524cf713e2cdc368ded8b7e13f85d310b8749.tar.bz2
yosys-f57524cf713e2cdc368ded8b7e13f85d310b8749.zip
Merge pull request #2117 from PeterCrozier/struct_array
Support packed arrays in struct/union.
Diffstat (limited to 'tests')
-rw-r--r--tests/svtypes/struct_array.sv22
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