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

Interview Questions Set 3: What is $time in Verilog?

Verilog Examples

Runnable example from the Verilog Interview Questions Set 3 tutorial (What is $time in Verilog?)

Open in IDE
testbench.v
module testbench;
  reg clk;

  initial begin
    clk = 1'b0;
    #10;
    while(1) begin
      #5;
      clk = ~clk;
      $display("Sim time is %d", $time);
    end
  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.