Altera_Forum
Honored Contributor
13 years agodefine base types when using enum
I noticed something with using the system verilog enum construct to define the states of a state machine.
If the following syntax is used, Quartus seems to detect the FSM correctly and the Transitions and Encoding shows up in the State Machine Viewer correctly. enum logic [1:0] {INIT, RD_PTR_BEHIND, RD_PTR_AHEAD} ptrState; If you do not define the base type of the enum (as shown below) then Quartus will generate logic that works but it either won't detect it as a FSM or it does this weird thing where it shows up in the State Machine Viewer but the transitions tab is blank. (seems like a bug to me) enum {INIT, RD_PTR_BEHIND, RD_PTR_AHEAD} ptrState; This last method would have been convenient if it worked since one could then add states as they go along and not have to worry about how many bits its going to take. The behavior is the same if you use typedef along with enum.