mdep87
Newbie level 2
I have a question about implementing an FSM in Verilog. In VHDL, we assign states using a type:
type state is (s1,s2,s3);
the only way I can see to do something like this in verilog is with parameters:
parameter s1=2'b00, s2=2'b01, s3=2'b10;
this implementation seems very lacking to me for couple reasons. If I go back and add more states, I could end up needing more bits. I could end up needing to modify the declaration of 128 states to add number 129, etc.
More importantly, optimal state assignment is not a trivial problem. Different state assignments can have significant impact on power, area and speed of a design. In the VHDL case, the synthesizer can assign the states according to an optimization algorithm, whereas when I write the code, states are just going to be added in the order I think of them, practically guaranteeing a sub-optimal assignment.
Sorry for the long lead-in. My basic question is:
How do I write a verilog FSM that allows the compiler to assign states? I'm using synplify, if anyone is aware of a compiler directive for this.
Matthew
type state is (s1,s2,s3);
the only way I can see to do something like this in verilog is with parameters:
parameter s1=2'b00, s2=2'b01, s3=2'b10;
this implementation seems very lacking to me for couple reasons. If I go back and add more states, I could end up needing more bits. I could end up needing to modify the declaration of 128 states to add number 129, etc.
More importantly, optimal state assignment is not a trivial problem. Different state assignments can have significant impact on power, area and speed of a design. In the VHDL case, the synthesizer can assign the states according to an optimization algorithm, whereas when I write the code, states are just going to be added in the order I think of them, practically guaranteeing a sub-optimal assignment.
Sorry for the long lead-in. My basic question is:
How do I write a verilog FSM that allows the compiler to assign states? I'm using synplify, if anyone is aware of a compiler directive for this.
Matthew