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

Timescale: Multiple Timescales in One Design

Verilog Examples

Runnable example from the Verilog Timescale tutorial (Multiple Timescales in One Design)

Open in IDE
testbench.v
`timescale 10ns/1ns
module slow;
  initial #1 $display ("slow: T=%0t", $realtime);    // 1 unit = 10 ns
endmodule

`timescale 1ns/1ps
module tb;
  slow u0 ();
  initial #1 $display ("tb:   T=%0t", $realtime);    // 1 unit = 1 ns
endmodule
Admin mode — edit and delete controls are visible on each row. Use the IDE to add new snippets via File → Save as Snippet.