Race conditions

In reply to sush:

Dear Dave,
Please explain if the below code creates a write-write race condition for “y” :

initial
begin
#5 y <= 2;
end
initial
begin
y <= #5 3;
end

Observation : y always takes the value of 2 irrespective of the order of simulation .

Hi,

I see a race condition here! Which means incorrect usage of constructs.

For e.g. look at the code below,

//This is a race condition as you would agree.
initial
 begin
  #5 
  y <= 2;
 end
 
initial
 begin
   #5;
   y <= 3;
 end
//Now only confusion could be of having an 'intra' assignment delay
//Which can be converted to simple delays(IEEE 1800-2012 Sec 9.4.5)
initial
 begin
  #5 
  y <= 2;
 end
 
initial
 begin
   //y <= #5 3;
   //Is same as
   tempY = 3;
   #5
   y <= tempY;
 end

In short any tool you use will give correct behavior(race/incorrect behavior) regardless.