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

`define Macro: SystemVerilog `define

SystemVerilog Advanced Features

Runnable example from the SystemVerilog `define Macro tutorial (SystemVerilog `define)

Open in IDE
testbench.sv
// Note (`) before (")
`define show_txn(addr, data) \
$display(`"addr=0x%0h data=0x%0h`", addr, data);

module tb;
  initial begin
    `show_txn(8'hf0, 8'h1d)
  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.