diff options
author | Peter Crozier <peter@crozier.com> | 2020-05-08 14:40:49 +0100 |
---|---|---|
committer | Peter Crozier <peter@crozier.com> | 2020-05-08 14:40:49 +0100 |
commit | 0b6b47ca670b9219bcb81ab7d3599267c2ef7571 (patch) | |
tree | 7f185ed9add86d52c5f55828e07b190420c77511 /tests/svtypes/typedef_struct.sv | |
parent | aafaeb66dfd839b8223059884d2741dadc9e2d92 (diff) | |
download | yosys-0b6b47ca670b9219bcb81ab7d3599267c2ef7571.tar.gz yosys-0b6b47ca670b9219bcb81ab7d3599267c2ef7571.tar.bz2 yosys-0b6b47ca670b9219bcb81ab7d3599267c2ef7571.zip |
Implement SV structs.
Diffstat (limited to 'tests/svtypes/typedef_struct.sv')
-rw-r--r-- | tests/svtypes/typedef_struct.sv | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/svtypes/typedef_struct.sv b/tests/svtypes/typedef_struct.sv new file mode 100644 index 000000000..7ae007952 --- /dev/null +++ b/tests/svtypes/typedef_struct.sv @@ -0,0 +1,42 @@ +package p; + +typedef struct packed { + byte a; + byte b; +} p_t; + +endpackage + + +module top; + + typedef logic[7:0] t_t; + + typedef struct packed { + bit a; + logic[7:0] b; + t_t t; + } s_t; + + s_t s; + s_t s1; + + p::p_t ps; + + assign s.a = '1; + assign s.b = '1; + assign s.t = 8'h55; + assign s1 = s; + assign ps.a = 8'hAA; + assign ps.b = 8'h55; + + always_comb begin + assert(s.a == 1'b1); + assert(s.b == 8'hFF); + assert(s.t == 8'h55); + assert(s1.t == 8'h55); + assert(ps.a == 8'hAA); + assert(ps.b == 8'h55); + end + +endmodule |