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 tb;
  reg [3:0] a;
  reg [3:0] b;

  initial begin       // Statements are executed one after the other at appropriate simulation times
    a = 5;            // At time 0ns, a is assigned 5
    b = 2;            // In the same simulation step (time 0ns), b is assigned 2

    #10 a = 7;        // When simulation advances to 10ns, a is assigned 7
  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.