3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-23 00:55:32 +00:00

add attributes for enumerated values in ilang

- information also useful for strongly-typed enums (not implemented)
- resolves enum values in ilang part of #1594
- still need to output enums to VCD (or better yet FST) files
This commit is contained in:
Jeff Wang 2020-02-03 01:12:24 -05:00 committed by Jeff Wang
parent 6320f2692b
commit d12ba42a74
5 changed files with 79 additions and 5 deletions

View file

@ -6,7 +6,7 @@ module enum_simple(input clk, input rst);
ts0, ts1, ts2, ts3
} states_t;
(states_t) state;
(states_t) enum_const = s1;
(states_t) enum_const = ts1;
always @(posedge clk) begin
if (rst) begin
@ -41,7 +41,7 @@ module enum_simple(input clk, input rst);
assert(state != 2'h3);
assert(s0 == '0);
assert(ts0 == '0);
assert(enum_const == s1);
assert(enum_const == ts1);
end
endmodule

View file

@ -27,7 +27,7 @@ module top;
end
(inner_type) inner_i2 = 8'h42;
(inner_type) inner_enum2 = s4;
(inner_enum_t) inner_enum2 = s4;
always @(*) assert(inner_i2 == 4'h2);
always @(*) assert(inner_enum2 == 3'h4);