Forum Discussion
No output depends on input (outputs stuck at VCC or GND) errors
- 3 years ago
Weird. Other things I notice: you have 6 states, but you set S_FSM_ERROR as 'x (and only using 5 bits for the state). It should probably have a defined value. Also, even though you are manually doing one-hot encoding here, did you create a state machine encoding assignment in the Assignment Editor?
Weird. Other things I notice: you have 6 states, but you set S_FSM_ERROR as 'x (and only using 5 bits for the state). It should probably have a defined value. Also, even though you are manually doing one-hot encoding here, did you create a state machine encoding assignment in the Assignment Editor?
- cdmski3 years ago
New Contributor
This paper (http://www.sunburst-design.com/papers/CummingsSNUG2019SV_FSM1.pdf) also makes use of a don't care state to account for the unused states in the typedef state enumeration. I have used this coding style before without issue.
I'm unfamiliar with creating a state machine encoding assignment, but I do know that a state machine is being inferred by this code as it appears as designed in the "Analysis and Synthesis - State Machine" output.
- cdmski3 years ago
New Contributor
It turns out that my issue was caused by using 'x in my typedef state enum after all.
Something must have changed, or this project's settings are slightly different in some way because I have used this construct successfully before.
typedef enum logic [4:0] {
S_REBOOT = 5'b0_0001,
S_GROUP_1_EN = 5'b0_0010,
S_GROUP_2_EN = 5'b0_0100,
S_GROUP_3_EN = 5'b0_1000,
S_PS_DONE = 5'b1_0000,
S_FSM_ERROR = 'x <-- Removing this fixed my issue.
} state_e;
state_e state;I then decided to add in another state for error catching (the default case switch sends the FSM to this state) and let the compiler assign enum values automatically:
localparam STATE_NUM = 6;
typedef enum logic [STATE_NUM - 1 : 0] {
S_REBOOT,
S_GROUP_1_EN,
S_GROUP_2_EN,
S_GROUP_3_EN,
S_PS_DONE,
S_FSM_ERROR
} state_e;
state_e state;