diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/verific/enum_values.sv | 37 | ||||
-rw-r--r-- | tests/verific/enum_values.ys | 19 |
2 files changed, 56 insertions, 0 deletions
diff --git a/tests/verific/enum_values.sv b/tests/verific/enum_values.sv new file mode 100644 index 000000000..69b53fd8e --- /dev/null +++ b/tests/verific/enum_values.sv @@ -0,0 +1,37 @@ +typedef enum { + WA, WB, WC, WD +} wide_state_t; + +typedef enum logic [1:0] { + A = 3, B = 0, C, D +} state_t; + +module top(input clk, output z); + + wide_state_t wide_state = WA; + + always @(posedge clk) begin + case (wide_state) + WA: wide_state <= WB; + WB: wide_state <= WC; + WC: wide_state <= WD; + default: wide_state <= WA; + endcase + end + + (* some_attribute = shortint'(42) *) + (* another_attribute = -1 *) + state_t state = A; + + always @(posedge clk) begin + case (state) + A: state <= B; + B: state <= C; + C: state <= D; + default: state <= A; + endcase + end + + assign z = (wide_state == WB) ^ (state == B); + +endmodule diff --git a/tests/verific/enum_values.ys b/tests/verific/enum_values.ys new file mode 100644 index 000000000..f580ded8a --- /dev/null +++ b/tests/verific/enum_values.ys @@ -0,0 +1,19 @@ +read -sv enum_values.sv +hierarchy -top top +printattrs a:* + +select -assert-count 1 a:some_attribute=16'd42 +# currently select doesn't support negative values in attributes +select -assert-count 1 a:another_attribute=32'hffffffff + +select -assert-count 1 top/state a:wiretype=\state_t %i +select -assert-count 1 top/state a:enum_value_11=\A %i +select -assert-count 1 top/state a:enum_value_00=\B %i +select -assert-count 1 top/state a:enum_value_01=\C %i +select -assert-count 1 top/state a:enum_value_10=\D %i + +select -assert-count 1 top/wide_state a:wiretype=\wide_state_t %i +select -assert-count 1 top/wide_state a:enum_value_00000000000000000000000000000000=\WA %i +select -assert-count 1 top/wide_state a:enum_value_00000000000000000000000000000001=\WB %i +select -assert-count 1 top/wide_state a:enum_value_00000000000000000000000000000010=\WC %i +select -assert-count 1 top/wide_state a:enum_value_00000000000000000000000000000011=\WD %i |