diff options
author | Jeff Wang <jjj11x@gmail.com> | 2020-01-16 17:12:00 -0500 |
---|---|---|
committer | Jeff Wang <jeffrey.wang@ll.mit.edu> | 2020-01-16 18:13:30 -0500 |
commit | 8ef5c7d48cc395535fe589d9798ad9985729b635 (patch) | |
tree | c26f631196ad99ff41c34151d44089a2bc3f8033 /tests/svtypes/typedef_scopes.sv | |
parent | 549deb637305a4bf4c9e2c58388b149ee8fa6089 (diff) | |
download | yosys-8ef5c7d48cc395535fe589d9798ad9985729b635.tar.gz yosys-8ef5c7d48cc395535fe589d9798ad9985729b635.tar.bz2 yosys-8ef5c7d48cc395535fe589d9798ad9985729b635.zip |
scoped enum tests
Diffstat (limited to 'tests/svtypes/typedef_scopes.sv')
-rw-r--r-- | tests/svtypes/typedef_scopes.sv | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/svtypes/typedef_scopes.sv b/tests/svtypes/typedef_scopes.sv index faa385bd6..9b3331c60 100644 --- a/tests/svtypes/typedef_scopes.sv +++ b/tests/svtypes/typedef_scopes.sv @@ -1,23 +1,35 @@ typedef logic [3:0] outer_uint4_t; +typedef enum logic {s0, s1} outer_enum_t; module top; (outer_uint4_t) u4_i = 8'hA5; + (outer_enum_t) enum4_i = s0; always @(*) assert(u4_i == 4'h5); + always @(*) assert(enum4_i == 1'b0); typedef logic [3:0] inner_type; + typedef enum logic [2:0] {s2=2, s3, s4} inner_enum_t; (inner_type) inner_i1 = 8'h5A; + (inner_enum_t) inner_enum1 = s3; always @(*) assert(inner_i1 == 4'hA); + always @(*) assert(inner_enum1 == 3'h3); if (1) begin: genblock typedef logic [7:0] inner_type; - (inner_type) inner_gb_i = 8'hA5; + 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); end (inner_type) inner_i2 = 8'h42; + (inner_type) inner_enum2 = s4; always @(*) assert(inner_i2 == 4'h2); + always @(*) assert(inner_enum2 == 3'h4); endmodule |