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 counter(input clk,
 output reg [15:0] counter);

 always @(posedge clk) begin
 counter <= counter + 1;
 end
 
 // Initialize counter to 0 at the start of the simulation
 initial begin
 counter <= {16{1'b0}};
 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.