This is the testbench in question:
module tb;
reg a,b;
initial begin
$display("a=%0d | b=%0d", a,b);
a = 1;
b = 0;
a <= b;
b <= a;
end
endmodule
Ignoring the evaluation of RHS of non-blocking assignments, which will be assigned to the LHS in the NBA region, the active region consists of:
$display
a=1
b=0
Since the active region is non-deterministic in nature, $display will can now either print the default values of a and b, ie. x x
, or their values after the assignment, ie. 1 0
, or their values after the assignment of any one of the variable, ie. 1 x
or x 0
, ultimately resulting in a race condition.
This is how I think it should work internally. But I was told by my teacher that this does not undergo any race condition. Can someone explain why?