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: Macro Example

Verilog Examples

Runnable example from the Verilog `define Macro tutorial (Macro Example)

Open in IDE
testbench.v
`define ADD(a, b) ((a) + (b))

module example;
    initial begin
        $display("Sum: %d", `ADD(5, 3)); // Expands to ((5) + (3))
    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.