# uvm_barrier

The uvm_barrier class provides a multiprocess 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.

Summary

uvm_barrier
The uvm_barrier class provides a multiprocess synchronization mechanism.
Class Hierarchy
uvm_void
uvm_object
uvm_barrier
Class Declaration
> class uvm_barrier extends uvm_object
Methods |
new | Creates a new barrier object.
wait_for | Waits for enough processes to reach the barrier before continuing.
reset | Resets the barrier.
set_auto_reset | Determines if the barrier should reset itself after the threshold is reached.
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.

### Methods

### new

> function new (
> | string | name | = | "",
> | int | threshold | = | 0
> )

Creates a new barrier object.

### wait_for

> virtual task wait_for()

Waits for enough processes to reach the barrier before continuing.

The number of processes to wait for is set by the set_threshold method.

### reset

> virtual function void reset (
> | bit | wakeup | = | 1
> )

Resets the barrier. This sets the waiter count back to zero.

The threshold is unchanged. After reset, the barrier will force processes to wait for the threshold again.

If the wakeup bit is set, any currently waiting processes will be activated.

### set_auto_reset

> virtual function void set_auto_reset (
> | bit | value | = | 1
> )

Determines if the barrier should reset itself after the threshold is reached.

The default is on, so when a barrier hits its threshold it will reset, and new processes will block until the threshold is reached again.

If auto reset is off, then once the threshold is achieved, new processes pass through without being blocked until the barrier is reset.

### set_threshold

> virtual function void set_threshold (
> | int | threshold
> )

Sets the process threshold.

This determines how many processes must be waiting on the barrier before the processes may proceed.

Once the threshold is reached, all waiting processes are activated.

If threshold is set to a value less than the number of currently waiting processes, then the barrier is reset and waiting processes are activated.

### get_threshold

> virtual function int get_threshold ()

Gets the current threshold setting for the barrier.

### get_num_waiters

> virtual function int get_num_waiters ()

Returns the number of processes currently waiting at the barrier.

### cancel

> virtual function void 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.

> virtual class uvm_void

The uvm_void class is the base class for all UVM classes.

> virtual class uvm_object extends uvm_void

The uvm_object class is the base class for all UVM data and hierarchical classes.

> class uvm_barrier extends uvm_object

The uvm_barrier class provides a multiprocess synchronization mechanism.

> function new (
> | string | name | = | "",
> | int | threshold | = | 0
> )

Creates a new barrier object.

> virtual task wait_for()

Waits for enough processes to reach the barrier before continuing.

> virtual function void reset (
> | bit | wakeup | = | 1
> )

Resets the barrier.

> virtual function void set_auto_reset (
> | bit | value | = | 1
> )

Determines if the barrier should reset itself after the threshold is reached.

> virtual function void set_threshold (
> | int | threshold
> )

Sets the process threshold.

> virtual function int get_threshold ()

Gets the current threshold setting for the barrier.

> virtual function int get_num_waiters ()

Returns the number of processes currently waiting at the barrier.

> virtual function void cancel ()

Decrements the waiter count by one.