uvm barrier

uvm_barrier

The uvm barrier class enables synchronization control between the processes.

  • uvm_barrier allows a set of processes to be blocked until the desired number of processes get to the
  • synchronization point
  • Processes get released Once after all the process reaching synchronization point

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

The uvm_barrier class has below built-in methods,

  • new
  • set_auto_reset
  • set_threshold
  • get_threshold
  • get_num_waiters
  • wait_for
  • reset
  • cancel

uvm_barrier methods

new

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

Creates a new barrier object.

wait_for

virtual task wait_for()

This method call, Waits for enough processes to reach the barrier before continuing.

set_threshold

virtual function void set_threshold (
  int threshold
)

The number of processes to wait for is set by the set_threshold method.
This determines how many processes must be waiting on the barrier before the processes may proceed.

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.

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 wake-up 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.

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.

uvm_barrier usage

Using uvm_barrier involves below methods,

  1. Declare and create the uvm_barrier
  2. Set the process to be waiting
  3. Calling wait_for() method inside the process

refer to next page for uvm_barrier examples
❮ Previous Next ❯