SV Event Scheduling Algorithm

While simulating System Verilog design and its test-bench including assertions, events has to be dynamically scheduled, executed, and removed as the simulator advances time. To have this feature, simulator has to maintain a data structure and usually would be a time ordered linked list. That means, at any point of time during simulation, event has one execution time which is current time or future time.

All scheduled events at a specific time define a time slot. A time slot is divided into a set of ordered regions, as Preponed, Pre-Active, Active, Inactive, Pre-NBA, NBA, Post-NBA, Pre-Observed, Observed, Post-Observed, Reactive, Re-Inactive, Pre-Re-NBA, Re-NBA, Post-Re-NBA, Pre-Postponed & Postponed.

Region groups

There are groups of event regions that are used to help define the scheduling of System Verilog activity.

Active region: Events scheduled in the Active, Inactive, Pre-NBA, NBA, and Post-NBA regions are active region set events.

Reactive region: Events scheduled in the Reactive, Re-Inactive, Pre- Re-NBA, Re-NBA, and Post-Re-NBA regions are reactive region set events.

Iterative regions: The Active, Inactive, Pre-NBA, NBA, Post-NBA, Pre-Observed, Observed, Post- Observed, Reactive, Re-Inactive, Pre-Re-NBA, Re-NBA, Post-Re-NBA, and Pre-Postponed regions are known as the iterative regions.

Simulation region: The simulation regions of a time slot are the Preponed, Active, Inactive, NBA, Observed, Reactive, Re-Inactive, Re-NBA and Postponed regions.

SV Event Scheduling

Simulator executes and removes all events in the current simulation time slot before moving to next time slot. In an even based simulator, a time slot is divided into a set of ordered regions to provide predictable interactions between the design and test-bench code.

Preponed

Sampling in the preponed region is same as the sampling in the previous postponed region. All nets and variables used in concurrent assertions are sampled here.

The #1step sampling delay provides the ability to sample data immediately before entering the current time slot. #1step sampling is identical to taking the data samples in the Preponed region of the current time slot.

Active region

Sampling of blocking assignments (out = in), continuous assignments (assign out=in) and RHS of non-blocking assignments (out <= in) are evaluated in this region. If intra-assignment delay exist for blocking assignment, it first computes RHS value and then suspend the executing process and schedule as future event. Delay 0 will be scheduled for inactive region.

Inactive region

The Inactive region holds the events to be evaluated after all the Active events are processed.

#0 delay statements are executed in this region.
out = #0 in

An explicit #0 delay control requires the process to be suspended and an event to be scheduled into the Inactive region of the current time slot so that the process can be resumed in the next Inactive to Active iteration.

NBA

RHS of non-blocking assignment are occurred in active region and update of LHS will happen in NBA region.

The NBA region holds the events to be evaluated after all the Inactive events are processed. If events are being executed in the active region set, a non-blocking assignment creates an event in the NBA region scheduled for the current or a later simulation time.

Observed region

The Observed region is for evaluation of property expressions when it is triggered. During property evaluation, pass/fail code shall be scheduled in the Reactive region of the current time slot. PLI callbacks are not allowed in the Observed region.

Re-Active region

The pass/fail code (code in action blocks of concurrent assertions) is scheduled in this region. The code specified by blocking assignments in program blocks is also scheduled in this region.

The Reactive region is the reactive region set dual of the Active region.

Re-Inactive region

#0 delay statements related to program block are scheduled in this region.The Re-Inactive region holds the events to be evaluated after all the Reactive events are processed.

The Re-Inactive region is the reactive region set dual of the Inactive region.

Re-NBA region

The Re-NBA region holds the events to be evaluated after all the Re-Inactive events are processed.

Update of LHS will happen in this region for the statements its RHS of non-blocking assignment occurred in re-active region.The Re-NBA region is the reactive region set dual of the NBA region.

Postponed

Write values to any net or variable or scheduling an event in any previous region within the current time slot are illegal in this region. $monitor, $strobe, and other similar events are scheduled here.

3 Comments

  1. Ishaanth

    Hi Sini,
    Appreciate the effort for explaining the things. Could you help me answering the following questions?
    How do we define a time slot, when this regions start executing and what is the reference period for this regions looping?
    ->is it based on the clock-to-clock edge?
    ->does this regions execute for every 1ns or any time period?.

Leave a Reply

Your email address will not be published. Required fields are marked *