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: 
Highlighted
Participant scmicron
Participant
1,532 Views
Registered: ‎08-23-2017

FSM not inferred

Jump to solution

Hello all,

I am running Vivado 2017.3 for synthesis, and I get unexpected results. 

 

My design contains several FSMs, each coded following suggestions from Xilinx UG901: a single clocked process, with synchronous reset and a single case statement where I decide the (next) state and the outputs according to current input and state.

 

However, none of them gets inferred as FSM. For some of them I get the following:

ROM "curr_state" won't be mapped to Block RAM because address size (2) smaller than threshold (5)

 

while for others:

ROM "curr_state" won't be mapped to RAM because it is too sparse

 

The Internet suggests a way to solve the first of these issues by setting the minimum number of states for an FSM to be inferred. However, nothing changes from the synthesis logs.

 

Any idea?

Many thanks

 

Cheers

Simone

0 Kudos
1 Solution

Accepted Solutions
Participant scmicron
Participant
2,015 Views
Registered: ‎08-23-2017

Re: FSM not inferred

Jump to solution

Hello @hemangd,

 

I think I have found the issue, looking at an older Answer Record: AR#60104

 

It seems I cannot set the (current) state of the FSM from a register (i.e., older state). Indeed, by removing the following and only occurrence does the job:

 

curr_state <= last_state;

 

Thanks

Cheers

 

S

0 Kudos
6 Replies
Scholar markcurry
Scholar
1,501 Views
Registered: ‎09-16-2009

Re: FSM not inferred

Jump to solution

Two points / Questions.

 

1.  I believe the tool is telling you that it DID infer the FSM - however it's NOT mapping the FSM to a Block RAM.  Meaning it will still search / optimize through other State Machine encodings (i.e. one-hot, user, grey, etc...)

 

2. Why does it matter?  In either case you'll still get a resulting netlist that matches your RTL description.

 

(The second question I wonder all the time for any State Machine related question on these forums....)

 

Regards,

 

Mark

 

 

0 Kudos
Scholar markcurry
Scholar
1,494 Views
Registered: ‎09-16-2009

Re: FSM not inferred

Jump to solution

 

Actually, I take that back.  Reviewing some of my own logs, it appears I'm reading (both your) and my log files too quickly.

Vivado's missing most of my state machines too. (some snippage from my own logs)

INFO: [Synth 8-802] inferred FSM for state register 'state_reg' in module 'axi_dma_wrdata_fsm'
INFO: [Synth 8-5544] ROM "next_state" won't be mapped to Block RAM because address size (1) smaller than threshold (5)

I see the lines next to each other, and assume they're related.  But maybe not.  It's hard to tell from the messages within the log as the tool doens't give enough context.

 

My second question still applies - why should I (or the OP care)?  I've mild curiosity why my state machines are (perhaps) no longer being recognized.  But probably not sufficient curiosity to spend much time figuring it out.  My quality of results is fine  - I usually have registers to spare.  I can't believe that FSM optimizations would optimize things all that much.  The OP may have different designs / criteria however...

 

Regards,

 

Mark

 

 

 

 

0 Kudos
Scholar richardhead
Scholar
1,485 Views
Registered: ‎08-01-2012

Re: FSM not inferred

Jump to solution
Can you post some code to give us some hints as to what we're looking at?

Im a little confused as to why its trying to map your state machine to ram anyway?
0 Kudos
Participant scmicron
Participant
1,477 Views
Registered: ‎08-23-2017

Re: FSM not inferred

Jump to solution

Hello @richardhead,

I cannot post complete code, but I can post a template of it, hoping it will help as well.

 

... my libraries ...

entity fsm is
   ... my generics ...
   ... my ports ...
end entity fsm;

architecture behavioral of fsm is
   ... my components ...

   -- States define
   type fsm_state_t is ( ... );
   signal curr_state : fsm_state_t;
   signal last_state : fsm_state_t;

   ... my signals ...
begin
   ... top-level wiring ...

   ... some procs and combinational instances ...

   -- Single clocked process
   FSM_proc : process(clk_i)
   begin
      if(rising_edge(clk_i)) then
         if(rstn_i = '0') then
            curr_state <= RESET;
            last_state <= RESET;
         else
            ... defaults assignments ...

            case curr_state is
               when RESET =>
                  if( ... condition ... ) then
                     ... do stuff ...
                  end if;

               ... for every state ...

               when UNKNOWN =>
                  null;

               when others =>
                  curr_state <= UNKNOWN;
                  last_state <= UNKNOWN;
            end case;
         end if;
      end if;
   end process FSM_proc;
end architecture behavioral;

 

In the meanwhile I gave few trials, failing every time:

- User-defined states encoding attributes (in the VHDL code) and synthesis option -fsm_extraction user_encoding;

- fsm_style attribute set to "bram" in VHDL code on the curr_state signal.

 

Thanks

Cheers

 

S

 

0 Kudos
Moderator
Moderator
1,421 Views
Registered: ‎03-16-2017

Re: FSM not inferred

Jump to solution

Hi @scmicron,

 

I think the issue here is in the case statement where the states are not changing as per your requirement.

 

You may try like this: 

 

case curr_state is

  when RESET = >

      if (....condition ....) then 

                   ... do stuff...

           curr_state <= UNKNOWN

       end if;

          else  

               curr_state <= RESET

      ... do stuff...

 

You need to do the same with state UNKNOWN too. 

 

For more info. You can have a look in to UG901 FSM Example with Single Sequential Block. (page 155 )

 

https://www.xilinx.com/support/documentation/sw_manuals/xilinx2014_1/ug901-vivado-synthesis.pdf

 

Regards,

hemangd

 

Regards,
hemangd

Don't forget to give kudos and mark it as accepted solution if your issue gets resolved.
0 Kudos
Participant scmicron
Participant
2,016 Views
Registered: ‎08-23-2017

Re: FSM not inferred

Jump to solution

Hello @hemangd,

 

I think I have found the issue, looking at an older Answer Record: AR#60104

 

It seems I cannot set the (current) state of the FSM from a register (i.e., older state). Indeed, by removing the following and only occurrence does the job:

 

curr_state <= last_state;

 

Thanks

Cheers

 

S

0 Kudos