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

Concatenation: Replication Operator

Verilog Examples

Runnable example from the Verilog Concatenation tutorial (Replication Operator)

Open in IDE
testbench.v
module des;
 reg [1:0] a;
 reg [2:0] b;
 
 initial begin
 a <= 2;
 b <= 4;
 
 #10;
 $display("a=%b b=%b res=%b", a, b, {{2{a}}, {3{b}}});
 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.