Forum Discussion
Altera_Forum
Honored Contributor
10 years agoAbout styles of writing FSM
Hi, I find many people on their blog suggest coding FSM as follow.
always @ (posedge clk or negedge rst_n)
if(!rst_n)
current_state <= IDLE;
else
current_state <= next_state;
alw...
Altera_Forum
Honored Contributor
10 years agoThis is down to personal preference. It's highly unlikely that the final implementation will differ as a result of using the different styles. You might argue that a more verbose coding style is more explicit and therefore helps the tools digest your code - there may be some particular inferences that cause the tools difficulty. I don't personally subscribe to this point of view. More relevant (I think) is the comment made regarding a more verbose style - it's more prone to error.
So, in short the "advantages and disadvantages between them" are down to your own subjective take on the two styles. I suggest you use the one that comes more naturally to you. Cheers, Alex