Friday, May 28, 2010

A note on processes and fine grain control

In system verilog fork join block blocks the execution of the parent class until all the process in the fork join are completed. System verilog provides two more keywods join_any and join_none are provided which can be used when we wish to continue with the parent process execution eventhough the currently spawned threads are not completed. join_any waits until any one of the spawned processes to complete where as join_none wait for nothing.

A return statement within the context of a fork...join statement is illegal and results in a compilation error.

SV also provides key words wait fork and disable fork keywords to wait for all the processes are completed for the executing the code after the wait fork. disable fork is to disable all the processes that are active and also the decendents of the processes.

One more advantage of SV is we can do Fine-grain process control i.e.,we can wait,kill,suspend,resume and know the state of a perticular process for individual processes.

LRM states:

A process is a built-in class that allows one process to access and control another process once it has started.

class process;
enum state { FINISHED, RUNNING, WAITING, SUSPENDED, KILLED };
static function process self();
function state status();
task kill();
task await();
task suspend();
task resume();
endclass

Objects of type process are created internally when processes are spawned. Users cannot create objects of type
process; attempts to call new shall not create a new process, and instead result in an error.

Call the 'self()' method of process class in the thread to be monitored and
then assign it to the process class object.

.status gives the status of the process.
= process::self()is like newing the object.
.kill will kill the process
.await will wait until that process is completed.


References:
SV LRM

following solvenet articles
https://solvnet.synopsys.com/retrieve/025657.html
https://solvnet.synopsys.com/retrieve/025656.html?otSearchResultSrc=advSearch&otSearchResultNumber=2&otPageNum=1

No comments:

Post a Comment