Verilog - Fork/join

The fork/join pair are used by Verilog to create parallel processes. All statements (or blocks) between a fork/join pair begin execution simultaneously upon execution flow hitting the fork. Execution continues after the join upon completion of the longest running statement or block between the fork and join.

initial fork $write("A"); // Print Char A $write("B"); // Print Char B begin #1; // Wait 1 time unit $write("C");// Print Char C end join

The way the above is written, it is possible to have either the sequences "ABC" or "BAC" print out. The order of simulation between the first $write and the second $write depends on the simulator implementation, and may purposefully be randomized by the simulator. This allows the simulation to contain both accidental race conditions as well as intentional non-deterministic behavior.

Notice that VHDL cannot dynamically spawn multiple processes like Verilog.

Read more about this topic:  Verilog

Famous quotes containing the words fork and/or join:

    Wherever a man separates from the multitude, and goes his own way in this mood, there indeed is a fork in the road, though ordinary travelers may see only a gap in the paling. His solitary path across lots will turn out the higher way of the two.
    Henry David Thoreau (1817–1862)

    I respect the ways of old folks, but the blood of a rooster or a goat cannot turn the seasons, change the course of the clouds and fill them up with water like bladders. The other night, at the ceremony for Legba, I danced and sang my fill: I am a black man, no? and I enjoyed it like a true Negro should. When the drums beat, I feel it in the pit of my stomach, I feel the itch in my hips and up and down my legs, I have got to join the party. But that is all.
    Jacques Roumain (1907–1945)