UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Explorer
Explorer
10,170 Views
Registered: ‎11-23-2009

vivado fsm inference or information about state encoding

Jump to solution

I'm porting VHDL designs from Spartan-6 and ISE to Artix-7 and Vivado. There are many FSMs, and ISE infered all of them and in the log files I found information about the state encoding. In Vivado not a single FSM is recognized, and consequently there is no information on state encoding.

 

There are multiple threads in this, I've read at least some of them, e.g. https://forums.xilinx.com/t5/Synthesis/Rules-for-inferring-FSM-in-Vivado/td-p/571393/highlight/true .

 

The upshot of many answers is

  1. don't care whether Vivado infers a state machine, the logic will be correct

  2. fsm_style must be 'auto'

 

True, the ported designs work, so point (1.) has some truth. However, in case of problems, e.g, with timing closure or in case I suspect a synthesis issue, I absolutely do need information about the state vector encoding. In all my designs the state is an enumerated type, so the design tool must do some mapping of the state names to whatever representation it chooses. Without knowing this mapping it's very hard to debug.

 

I also don't understand the often given argument that fsm_style must be 'auto' to receive a state vector representation. As said, Vivado must anyway determine such a mapping when the state variable is an enumerated type, no matter what fsm style is choosen.

 

So what I simply expect is that Vivado outputs such a state variable mapping, whether a FSM is infered or not, and I really wonder why this apparently doesn't happen.

 

Great to hear some comments on this.

 

 

 

 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Explorer
Explorer
13,919 Views
Registered: ‎11-23-2009

Re: vivado fsm inference or information about state encoding

Jump to solution

Hi @anusheel,

 

I finally localized the problem with my large FSM, for full story see this posting.

The eliminated state mentioned in the previous posting was actually removed because it was indeed unreachable in the given context.

 

Bottom line is that all FSMs are now recongized, and if desired re-encoded as one_hot.

 

What I learned though is that the fsm extraction logic is

  • fragile: see the 'don't init next state' issue, or the 'spurious iSTATE' issue.
  • intransparent: vivado generates a lot or message for quite mundane situations. When it comes to FSMs is as silent as a fish. I'd love to see a message when vivado
    - generates an additional state (aka iSTATE)
    - eliminates a state
    - ignores an encoding specified via fsm_extract option or signal attribute

With best regards,  Walter

 

0 Kudos
6 Replies
Moderator
Moderator
10,034 Views
Registered: ‎07-21-2014

Re: vivado fsm inference or information about state encoding

Jump to solution

@wfjmueller

 

Which version of Vivado are you using? Did you check fsm_encoding.os file generated in .runs/synth_1 folder?

Refer below answer record and let us know if your query is not addressed:

http://www.xilinx.com/support/answers/59237.html

 

Thanks,
Anusheel
-----------------------------------------------------------------------------------------------
Search for documents/answer records related to your device and tool before posting query on forums.
Search related forums and make sure your query is not repeated.

Please mark the post as an answer "Accept as solution" in case it helps to resolve your query.
Helpful answer -> Give Kudos
-----------------------------------------------------------------------------------------------

 

0 Kudos
Explorer
Explorer
9,970 Views
Registered: ‎11-23-2009

Re: vivado fsm inference or information about state encoding

Jump to solution

@anusheel

 

I'm using Vivado 2015.4. I've for example a design where ISE finds one dozen FSMs, of very different complexity. All in two process notation, in VHDL, and using an enumeration type for the state variable. A grep of the 'States' line of the 'Found finite state machine' gives for ISE 14.7

 

  | States |   4 |
  | States |   7 |
  | States |   3 |
  | States | 113 |
  | States |   6 |
  | States |  22 |
  | States |   9 |
  | States |   4 |
  | States |   3 |
  | States |  13 |
  | States |  40 |
  | States |  11 |

 

The same basic design, just ported to a different board with an Artix-7 under Vivado infers not a single fsm. I use a batch build flow, use project mode. In the project directory I get

 

  find -name "*.rpt" | xargs grep -i fsm

  --> nothing !

 

  find -name "*fsm*"

  --> nothing !

 

There is no Synth 8-802, no Synth 8-3354, and no fsm_encoding.os file.

0 Kudos
7,944 Views
Registered: ‎07-15-2015

Re: vivado fsm inference or information about state encoding

Jump to solution

fsm_encoding.os file

 

^This is a nice, interesting discovery!

 

Does Vivado generate this for every FSM extracted, or only FSMs where state encoding is changed from the tool default?

 

Snippet from mine, where 113-state FSM was re-encoded from default sequential to one_hot:

 

add_fsm_encoding \
{state_mach.curr_st}
\
{ }
\
{{0000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001}
{0000001 00001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000}
{0000010 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010}
{0000011 00010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000}
{0000100 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100}

.....

 

Hard to read at that font size, but first column (bold) is default encoding, second column (remaining long string) is the new encoding.

 

 

0 Kudos
Moderator
Moderator
7,886 Views
Registered: ‎07-21-2014

Re: vivado fsm inference or information about state encoding

Jump to solution

@wfjmueller

 

Vivado should infer FSM for the correct RTL logic. Are you using async reset? Can you share a sample FSM RTL file for us to replicate the same behaviour?

 

Thanks,
Anusheel
-----------------------------------------------------------------------------------------------
Search for documents/answer records related to your device and tool before posting query on forums.
Search related forums and make sure your query is not repeated.

Please mark the post as an answer "Accept as solution" in case it helps to resolve your query.
Helpful answer -> Give Kudos
-----------------------------------------------------------------------------------------------

Explorer
Explorer
7,744 Views
Registered: ‎11-23-2009

Re: vivado fsm inference or information about state encoding

Jump to solution

Hi @anusheel,

 

turns out there are several reasons why vivado didn't recognize any of my FSMs:

  • main reason was that vivado doen't like that the 'next state' signal in a two process FSM is initialized. Very odd behaviour, for details see this thread. After removing the initializations most FSMs where inferred.
  • some FSMs where small, 3 or 4 states. By default vivado does not handle such small FSMs. See AR #58574 and this thread. After setting minFsmStates to 3 most small FSMs were inferred, if desired.
  • I have one case of a large FSMs which is recognized, but not recoded. See this thread.

Beyond that I ran into

  • that vivado creates sometimes spurious states, named iSTATE. For details see this thread. Even though the synthezied FSMs might work correctly it is certainly not acceptable to see that a synthesis tool creates spurious states (even when they are never reached).
  • and just discoved that vivado eliminates under some circumstances a used and needed state. I'll investigate and document this in the next days.

To answer the question:

  • all FSMs have a synchronous reset
  • reproducers and/or examples are included in the threads cited above
0 Kudos
Highlighted
Explorer
Explorer
13,920 Views
Registered: ‎11-23-2009

Re: vivado fsm inference or information about state encoding

Jump to solution

Hi @anusheel,

 

I finally localized the problem with my large FSM, for full story see this posting.

The eliminated state mentioned in the previous posting was actually removed because it was indeed unreachable in the given context.

 

Bottom line is that all FSMs are now recongized, and if desired re-encoded as one_hot.

 

What I learned though is that the fsm extraction logic is

  • fragile: see the 'don't init next state' issue, or the 'spurious iSTATE' issue.
  • intransparent: vivado generates a lot or message for quite mundane situations. When it comes to FSMs is as silent as a fish. I'd love to see a message when vivado
    - generates an additional state (aka iSTATE)
    - eliminates a state
    - ignores an encoding specified via fsm_extract option or signal attribute

With best regards,  Walter

 

0 Kudos