System Verilog : Disable Fork & Wait Fork

To model concurrent and serial behavior, disable fork and wait fork will be used along with fork join constructs. These constructs allow one process to terminate or wait for the completion of other processes.

If you want to model your verification environment in such a way that, it has to spawn concurrent processes which will be waiting for events. And as soon as one event is received, terminate the other outstanding processes to go ahead with your next process. In this case disable fork would be the best option along with join_any.

Disable Fork :

The disable fork terminates all active descendants of the current process. In this case BLK1,BLK3 and BLK4 are terminated.

Wait Fork :

The wait fork statement blocks process execution flow until all immediate child subprocesses (processes
created by the current process, excluding their descendants) have completed their execution.

In the above code, FJ1 uses join_any and FJ2 uses join_none. Without wait fork construct (Line 52), BLK2 will be executed first and then P1 . Execution of other processes depend on when simulation ends. With wait fork construct(Line 52), all spawned child processes in FJ1 and FJ2 will be executed before going to P1 process.

1 comment on “System Verilog : Disable Fork & Wait Fork

  1. Novice

    Could u pls explain Why

    1] “FJ2 block4” occurs before “FJ1 block 4”
    2] “FJ2 block3” doesn’t occur right after “FJ2 block 4”
    “FJ1 block3” doesn’t occur just after “FJ1 block 4”


Leave a Reply

Your email address will not be published. Required fields are marked *