SystemVerilog creates a
thread of execution for each initial or always block, for each parallel statement in a fork...join block and for each dynamic process. Each continuous
assignment may also be considered its own thread. Execution of each thread may
be interrupted between statements at a semicolon, but a single statement (not a
block) containing no user task or function call is cannot be
uninterrupted. This allows atomic test-and-set using assignment operators in an if statement.
SystemVerilog 3.1 adds
dynamic processes by enhancing the fork...join construct, in a
way that is more natural to Verilog users. SystemVerilog 3.1 also introduces
dynamic process control constructs that can terminate or wait for processes
using their dynamic, parent-child relationship. These are wait
fork and disable
fork.
9.2 Level sensitive Combinational logic
9.3
Latched sensitive logic
9.4 Sequential Edge
sensitive logic
The fork...join construct enables the creation
of concurrent processes from each of its parallel statements provides the primary
mechanism for creating concurrent processes.
In Verilog a fork...join block always causes the process executing the fork
statement to block until the termination of all forked
processes all the forked off processes terminate. With the addition of SystemVerilog adds the join_any and join_none keywords, SystemVerilog provides three
choices for specifying that specify when the parent (forking) process resumes
execution.
The
parent process blocks until all the processes spawned by this fork complete. This is the same as a Verilog fork...join .
In the following example,
two processes are forked off, the first one
will wait for 20ns and the second will wait for the named event eventA to be triggered. Because the join
keyword is specified, the parent
process will block until the two processes complete.,
tThat is,
20ns have elapsed and eventA has been triggered.
task function int wait_20;
fork
# 20;
return
4; // Illegal: cannot return; task function lives in another process
join_none
endtask endfunction
SystemVerilog 3.0 provided a
process statement, which
gave the same functionality as the fork...join_none
construct. SystemVerilog 3.1
deprecates the process statement, in favor of or the fork...join_none
form.
Execution of each thread
can be interrupted between statements at a semicolon, but a single statement
(not a block) containing neither a no user
task nor a
function call shall not be interrupted. This allows atomic test-and-set using assignment
operators in an if
statement.
Verilog supports the disable
construct, which will end a process
when applied to the named block being executed by the process. The disable
fork statement differs from disable
in that disable
fork considers the dynamic
parent-child relationship of the processes, whereas disable
uses the static, syntactical information of the disabled block. Thus,
disable will end all
processes executing a particular block, whether the processes were forked by
the calling thread or not, while disable fork will end only those processes that were spawned by the
calling thread.