diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/svtypes/struct_simple.sv | 9 | ||||
-rw-r--r-- | tests/svtypes/union_simple.sv | 11 |
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 |