Verilog - Race Conditions

Race Conditions

The order of execution isn't always guaranteed within Verilog. This can best be illustrated by a classic example. Consider the code snippet below:

initial a = 0; initial b = a; initial begin #1; $display("Value a=%b Value of b=%b",a,b); end

What will be printed out for the values of a and b? Depending on the order of execution of the initial blocks, it could be zero and zero, or alternately zero and some other arbitrary uninitialized value. The $display statement will always execute after both assignment blocks have completed, due to the #1 delay.

Read more about this topic:  Verilog

Famous quotes containing the words race and/or conditions:

    There are times when they seem so small! And then again, although they never seem large, there is a vastness behind them, a past of indefinite complexity and marvel, an amazing power of absorbing and assimilating, which forces one to suspect some power in the race so different from our own that one cannot understand that power. And ... whatever doubts or vexations one has in Japan, it is only necessary to ask oneself: “Well, who are the best people to live with?”
    Lafcadio Hearn (1850–1904)

    A society which is clamoring for choice, which is filled with many articulate groups, each urging its own brand of salvation, its own variety of economic philosophy, will give each new generation no peace until all have chosen or gone under, unable to bear the conditions of choice. The stress is in our civilization.
    Margaret Mead (1901–1978)