Forum Discussion
Tim10
New Contributor
7 years agoState Machine Wizard
I used the State Machine Wizard to create a machine with 9 states. Looking through the generated code I saw this: reg [8:0] fstate;
reg [8:0] reg_fstate;
parameter State1=0,State2=1,State3=2,State4...
ak6dn
Regular Contributor
7 years agoThe "StateX=N" is using N as the bit number. Quartus will by default decompose state machines and reencode them as one-hot, as this form is much more resource efficient when implementing in the FPGA. You can direct Quartus not to do this by adding the syn_encoding attribute to the Verilog source on the state machine definition. Or to influence all state machines, in the .qsf file use the state_machine_processing directive as in:
https://www.intel.com/content/www/us/en/programmable/quartushelp/current/index.htm#logicops/logicops/def_smp_process_type.htm
The default is 'auto', where Quartus will decide the 'best' encoding that meets timing and uses minimal resources. Choose 'user-encoded' if you want quartus to leave as is.