Ready-to-run snippets

Code Examples

Ready-to-run Verilog, SystemVerilog, and UVM examples. Click any to open it live in the IDE.

← All examples

Testbench Simulation: Regions in event queue

Verilog Examples

Runnable example from the Verilog Testbench Simulation tutorial (Regions in event queue)

Open in IDE
testbench.v
module regions;
  reg [3:0] a;

  initial begin
    a = 1;
    $display ("display : a=%0d", a);    // Active: a is 1
    $strobe  ("strobe  : a=%0d", a);    // Monitor: prints at the end of the time step
    a <= 2;                             // Nonblocking: a becomes 2 later in this time step
    #0 $display ("after #0: a=%0d", a); // Inactive: still before the nonblocking update
  end
endmodule
Admin mode — edit and delete controls are visible on each row. Use the IDE to add new snippets via File → Save as Snippet.