Systemverilog Event Regions: #1step - What It Really Means??
Systemverilog Event Regions: #1step - What It Really Means??
Systemverilog Event Regions: #1step - What It Really Means??
http://www.sunburst-design.com/papers/CummingsSNUG2006Boston_SystemVerilog_Events.pdf
That is, this is the smallest unit of time for which the simulator will schedule an event – there can be no activity in between #1step delays.
"The values of variables used in assertions are sampled in the Preponed region of a time slot, and
the assertions are evaluated during the Observed region. ..."
The active region set is used to schedule blocking assignments and nonblocking assignments included in
module code. Any task or function called from a module is also scheduled into the active region set. The intended
purpose of the active region set is to schedule RTL and behavioral code activity. Testbench code can also be written as module code and indeed
preexisting Verilog testbench code was written as module code, but SystemVerilog users are encouraged to place future
testbench code into pr
The Active Events Region, also commonly called the Active region, is part of the Active Region
Set.
The Inactive Events Region, also commonly called the Inactive region, is part of the Active
Region Set. This region is where #0 blocking assignments are scheduled.
Most engineers that continue to use #0 assignments are trying to defeat a race
condition that might exist in their code due to assignments made to the same variable (The variable is read in one always block and
updated the same variable in another always block at the same time)from more
than one always block, which is a violation of Sunburst Design Race Avoidance Guideline
The Nonblocking Assignment Events Region, also commonly called the NBA region, is part of
the Active Region Set. In this region, RHS of all the non-blocking assignments are updated with the LHS evaluated in active event region .
3. Observed region
Observed region is designed to evaluate concurrent assertions using the values sampled in the preponed region.
Clocking blocks are triggered.
This region just evaluate pass or fail conditions of concurrent assertions, it doesn't executes the code written inside pass or fail block.
A process associated with the pass and fail code is scheduled inside the Reactive regions. This is because
concurrent assertions are designed to behave strictly as monitors, thus, they are not allowed to modify the state of the design
The reactive region set is used to schedule blocking assignments, #0 blocking assignments and nonblocking assignments included in program
code. Any task or function called from a program is also scheduled into the reactive set event regions. The intended purpose of the reactive
region set is to schedule testbench stimulus drivers and testbench verification checking in the same time slot after RTL code has settled to a
semi-steady state.
As it is explained above all the test bench related code is executed in reactive regions if it is written inside the program block, this way we can
isolate RTL and the test bench code and avoid race conditions between RTL and test bench.
The Reactive region is the reactive region set dual of the corresponding Active region in the same time slot
The reactive region events are scheduled towards the end of the time slot to ensure the followings.
The signals monitored/sampled by the test bench code is stable before it samples. Since all the signals which are driven by DUT are
evaluated in the active regions, so they can be monitored in the reactive regions by program block without any race .
It also ensures, the signals driven by the test bench to the DUT are stable enough before it is actually read by the DUT
5. Postponed Region
This region is designed to execute the $strobe and $monitor commands that will show the final updated values for the current time slot. This
region is also used to collect functional coverage for items that use strobe sampling.
Let's consider a simple example to understand how the events are scheduled in the different regions.
The Sunburst Design Verilog testbench methodology typically assigned stimulus on the inactive
clock edge (The clock edge which is not used by the DUT), typically far away from setup and hold times for the gate-level devices. This permitted the
use of efficient blocking assignments and the only activity after application of
stimulus on the inactive clock edge would be input combinational logic activity.
There are two ways to drive stimulus if the test bench is coded in system verilog.
a. Drive stimulus on inactive clock edge similar to verilog (This method is not highly recommended over clocking block)
b. Use the clocking blocks supported by system verilog to have configurable skew values for input and output ports of the testbench.
In the above example, input and output skews are defined such that, inputs are sampled by test bench 1ns before the active clock edge and all
the outputs (stimulus) from test bench are driven 1 ns after the clock edge.