0

I am trying to use synchronous reset within an always block for a Moore FSM. Following are 2 blocks of code implementing the same, one uses Non-Blocking assignment and other uses Blocking assignment.

always @(posedge clock, posedge reset) begin
 if(reset==1) 
     current_state <= Zero;
 else
     current_state <= next_state; 
end

vs

always @(posedge clock, posedge reset)
begin
 if(reset==1) 
     current_state = Zero;
 else
     current_state = next_state; 
end

What would be the difference in outputs between these 2 blocks of code?

Shashank V M
  • 2,279
  • 13
  • 47
  • Have a look here: https://electronics.stackexchange.com/questions/163018/asynchronous-reset-in-verilog – P2000 Jun 21 '20 at 05:29

1 Answers1

2

From a synthesis perspective, there will be no difference between the two pieces of code.

For simulation, in isolation, both pieces of code will have the same behaviour. However, if you start mixing blocking and non-blocking assignments for synchronous logic, this can sometimes cause weird/inaccurate simulation behaviour due to the way simulators convert the parallel logic into sequential operations.

The same applies to both synchronous and asynchronous reset cases.

Tom Carpenter
  • 63,168
  • 3
  • 139
  • 196