Tim10
New Contributor
6 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=3,State5=4,State6=5,State7=6,State8=7,State9=8;The registers are 9 bits whereas the states only require 4 bits because they are binary encoded:
It seems as if the registers are expecting one-hot encoding (9 bits for 9 states):
The state machine seems to work correctly using binary encoding, but the registers have several unused/wasted bits.
Is this a bug?