aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPeter Crozier <peter@crozier.com>2020-05-12 17:20:34 +0100
committerPeter Crozier <peter@crozier.com>2020-05-12 17:20:34 +0100
commit17f050d3c6b8934141c42f96a3418de67a687b2c (patch)
tree1fefeb271584c45d2baec781cecc869cf36fda64 /tests
parentf482c9c0168a6857383e7d9360c8ca1df36ba2bc (diff)
downloadyosys-17f050d3c6b8934141c42f96a3418de67a687b2c.tar.gz
yosys-17f050d3c6b8934141c42f96a3418de67a687b2c.tar.bz2
yosys-17f050d3c6b8934141c42f96a3418de67a687b2c.zip
Allow structs within structs.
Diffstat (limited to 'tests')
-rw-r--r--tests/svtypes/struct_simple.sv9
-rw-r--r--tests/svtypes/union_simple.sv11
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/svtypes/struct_simple.sv b/tests/svtypes/struct_simple.sv
index e29489fb7..c74289cc3 100644
--- a/tests/svtypes/struct_simple.sv
+++ b/tests/svtypes/struct_simple.sv
@@ -15,6 +15,13 @@ module top;
bit [7:0] d;
} pack1;
+ struct packed {
+ byte a;
+ struct packed {
+ byte x, y;
+ } b;
+ } s2;
+
assign s.a = '1;
assign s.b = '1;
assign s.c = 8'hAA;
@@ -25,6 +32,7 @@ module top;
assign pack1.b = 16'hAAAA;
assign pack1.c = '1;
assign pack1.d = 8'h55;
+ assign s2.b.x = 'h42;
always_comb assert(s.a == 1'b1);
always_comb assert(s.c == 8'hAA);
@@ -35,5 +43,6 @@ module top;
always_comb assert(pack1.c == 8'hFF);
always_comb assert(pack1[15:8] == 8'hFF);
always_comb assert(pack1.d == 8'h55);
+ always_comb assert(s2.b.x == 'h42);
endmodule
diff --git a/tests/svtypes/union_simple.sv b/tests/svtypes/union_simple.sv
index fc23fe6e8..12e4b376f 100644
--- a/tests/svtypes/union_simple.sv
+++ b/tests/svtypes/union_simple.sv
@@ -58,4 +58,15 @@ module top;
assert(ir1.u.imm == 'hAA01);
end
+ union packed {
+ int word;
+ struct packed {
+ byte a, b, c, d;
+ } byte4;
+ } u;
+ assign u.word = 'h42;
+ always_comb begin
+ assert(u.byte4.d == 'h42);
+ end
+
endmodule