uvm_barrier can be used to force a set of independently executing processes (e.g. virtual sequences) to wait until they have all reached a particular point.
The barrier provides a flexible synchronization mechanism between the processes: its threshold can be programmed to set the number of processes that must reach the synchronization point before the barrier is 'lifted'.
A barrier is like a semaphore in reverse. It simply blocks until a threshold number of requests.
The uvm_barrier class provides a multi-process synchronization mechanism. It enables a set of processes to block until the desired number of processes get to the synchronization point, at which time all of the processes are released.
The barrier provides a flexible synchronization mechanism between the processes: its threshold can be programmed to set the number of processes that must reach the synchronization point before the barrier is 'lifted'.
A barrier is like a semaphore in reverse. It simply blocks until a threshold number of requests.
The uvm_barrier class provides a multi-process synchronization mechanism. It enables a set of processes to block until the desired number of processes get to the synchronization point, at which time all of the processes are released.
APIs of uvm_barrier class
- wait_for : Waits for enough processes to reach the barrier before continuing.
- reset : Resets the barrier. This sets the waiter count back to zero.
- set_auto_reset : Determines if the barrier should reset itself after the threshold is reached. Default is on
- set_threshold : Sets the process threshold.
- get_threshold : Gets the current threshold setting for the barrier.
- get_num_waiters : Returns the number of processes currently waiting at the barrier.
- cancel : Decrements the waiter count by one. This is used when a process that is waiting on the barrier is killed or activated by some other means.
Consider following examples,
Good one..
ReplyDelete