aboutsummaryrefslogtreecommitdiffstats
path: root/tests/verific/enum_values.sv
blob: 69b53fd8e64445c4fa9eca1a4fce01af8ccd5cc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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