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

Initial Block with Delays

Verilog Procedural Blocks

initial block with delays #

Open in IDE
Related tutorial:
testbench.v
module tb;
    reg [1:0] a, b;

    initial begin
        a = 2'b10;              // Time 0: a assigned immediately
        #10 b = 2'b00;          // Time 10: b assigned after 10-unit delay
        #20 a = 2'b01;          // Time 30: a reassigned after additional 20 units
        #5 $display("Time=%0t a=%b b=%b", $time, a, b); // Time 35: display values
    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.