- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you notice this comment in the Altera Software Handbook about System Verilog state machine coding style?
--- Quote Start --- In Quartus II integrated synthesis, the enumerated type that defines the states for the state machine must be of an unsigned integer type as in Example 10–52. If you do not specify the enumerated type as int unsigned, a signed int type is used by default. In this case, the Quartus II integrated synthesis synthesizes the design, but does not infer or optimize the logic as a state machine. --- Quote End --- Suggested definition is:enum int unsigned { S0 = 0, S1 = 2, S2 = 4, S3 = 8 } state, next_state;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks! I didn't know about this. I'll have to troll through this document to find other gems.
I still think the behavior I see where the SM Viewer's Transitions Tab page blank is a bug. How can I report that to Altera?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Inferring a FSM without displaying it correctly in the viewer can be at least considered an inconsistency. I hesiate to call it a bug because FSM inference isn't supported for this syntax according to the Software Manual.
In any case, filing a support request at Altera MySupport is the regular way to report bugs or ask for clarifications.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page