There is no race in the code you show. There is only a race if some other process tries to read the reset variable at the same instant that another process is writing to it.
Code:
initial #20 $display(reset);
The code above would be in a race with the #20 reset = 1’b1; statement because you don't know if the blocking assignment updates reset before or after the $display.
initial begin // has race condition.
reset = 1’b0;
#20 reset = 1’b1;
#40 reset = 1’b0;
end
reset = 1’b0 will cause race condition only in case the design is modeled to use asynchronous active low reset as follows.
always @ (posedge clk or negedge reset)
if (!reset)
q <= 1'b0;
else
q <= d;
Because the tool does not guarantee the sequence in which procedural blocks like initial and always gets triggered.
If the always block gets triggered first the flop q will be reset properly. Otherwise it will miss the reset.
Whereas if you use the non-blocking assignment based reset initial block, the always block will get reset properly.
I think you have picked this code from cummins poaper. I don't remember which paper it is exactly.