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: Concatenate Macros

SystemVerilog Advanced Features

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

Open in IDE
testbench.sv
`define MODULE 	tb
`define SIGNAL 	a

`define CONCAT(mod, sig)     assign ``mod.``sig = 1;

module tb;
  
  wire a;
  
  `CONCAT(`MODULE, `SIGNAL)
    
  initial begin
    $strobe("a=0x%0h", a);
  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.