diff options
author | Xiretza <xiretza@xiretza.xyz> | 2021-03-18 21:53:02 +0100 |
---|---|---|
committer | Zachary Snow <zachary.j.snow@gmail.com> | 2021-03-21 19:35:13 -0400 |
commit | 92d5550a90558a0292c8ac63cecabb2de30eb6aa (patch) | |
tree | 58ed982822080494e7ca632c0e9c1d566f15fca2 /tests/svtypes/typedef_scopes.sv | |
parent | 4f4e70876f06738fa7dda24e01ac296fe318264a (diff) | |
download | yosys-92d5550a90558a0292c8ac63cecabb2de30eb6aa.tar.gz yosys-92d5550a90558a0292c8ac63cecabb2de30eb6aa.tar.bz2 yosys-92d5550a90558a0292c8ac63cecabb2de30eb6aa.zip |
verilog: check entire user type stack for type definition
Diffstat (limited to 'tests/svtypes/typedef_scopes.sv')
-rw-r--r-- | tests/svtypes/typedef_scopes.sv | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/svtypes/typedef_scopes.sv b/tests/svtypes/typedef_scopes.sv index 5507d84f2..9a898fac8 100644 --- a/tests/svtypes/typedef_scopes.sv +++ b/tests/svtypes/typedef_scopes.sv @@ -4,6 +4,7 @@ typedef enum logic {s0, s1} outer_enum_t; module top; + // globals are inherited outer_uint4_t u4_i = 8'hA5; outer_enum_t enum4_i = s0; always @(*) assert(u4_i == 4'h5); @@ -17,13 +18,22 @@ module top; always @(*) assert(inner_enum1 == 3'h3); if (1) begin: genblock + // type declarations in child scopes shadow their parents typedef logic [7:0] inner_type; parameter inner_type inner_const = 8'hA5; typedef enum logic [2:0] {s5=5, s6, s7} inner_enum_t; + inner_type inner_gb_i = inner_const; //8'hA5; inner_enum_t inner_gb_enum1 = s7; always @(*) assert(inner_gb_i == 8'hA5); always @(*) assert(inner_gb_enum1 == 3'h7); + + // check that copying of struct member types works over multiple type scopes + typedef struct packed { + outer_uint4_t x; + } mystruct_t; + mystruct_t mystruct; + always @(*) assert($bits(mystruct) == 4); end inner_type inner_i2 = 8'h42; |