Friday, March 02, 2012

Process Execution Threads

Process Execution Threads

SystemVerilog creates a thread of execution for:

» Each initial block
» Each always block
» Each parallel statement in a fork...join (or join_any or join_none) statement group
» Each dynamic process

Each continuous assignment can also be considered its own thread.

Process control:

SystemVerilog provides constructs that allow one process to terminate or wait for the completion of other processes.

The wait fork construct waits for the completion of processes. The disable fork construct stops the execution of processes.

Wait fork:

The wait fork statement is used to ensure that all child processes (processes created by the calling process) have completed their execution.

In the following example, in the task do_test, the first two processes are spawned and the task blocks until one of the two processes completes (either exec1, or exec2). Next, two more processes are spawned in the background.

The wait fork statement shall ensure that the task do_test waits for all four spawned processes to complete before returning to its caller.

task do_test;
fork
exec1();
exec2();
join_any
fork
exec3();
exec4();
join_none
wait fork; // block until exec1 ... exec4 complete
endtask

Disable fork:

The disable fork statement terminates all active descendants (sub-processes) of the calling process.

The syntax for disable fork is:

disable fork ;

No comments:

Post a Comment

Popular Posts