disable fork in SystemVerilog

If a process is started by fork .. join_any then it can be disabled by using disable fork or it can be disabled by using disable LABEL . There are some difference in using both these ways of disabling processes.

Difference 1 :

Here is example :


In this example , you can use disable fork or disable process .

  • If disable fork is used then it disables all process started by fork . Task “wait_for_clk(40)” will be also stopped when disable fork is executed.
  • But , in case of disable process (LABEL) , it will not stop task/process started alreay by fork join_any. Thus wait_for_clk(40)  will not be stopped in this case.
Difference 2 :

Other difference between using disable fork and disable LABEL is that disable LABEL is static . If disable LABEL is in a class then it will stop process in all object of that class.  disable fork will stop all fork processes in current scope.

So , It is better to use disable .. fork by following way in class.


Thus , need to one dummy fork…join as wrapper , so that scope of disable fork is inside dummy fork join and only intended process stopped.

Please note that questa behavior for this example seems to be different.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s