Design
// VLSI Hub authored example, CC0-1.0.
module counter4(input logic clk, rst, output logic [3:0] count);
always_ff @(posedge clk) begin
if (rst) count <= 4'b0;
else count <= count + 1'b1;
end
endmodule
Download design.svREPRODUCIBILITY LAB
Inspect real local test results, read the testbench, and reproduce a small design with Icarus Verilog.
Browser and remote execution are unavailable. These are retained local runs of trusted, authored examples. No HDL is uploaded or executed by the web server. An isolated, licensed execution runtime is required before editable browser execution can be enabled.
Icarus Verilog version 13.0 (stable) (v13_0) · CC0-1.0 (authored example source)
// VLSI Hub authored example, CC0-1.0.
module counter4(input logic clk, rst, output logic [3:0] count);
always_ff @(posedge clk) begin
if (rst) count <= 4'b0;
else count <= count + 1'b1;
end
endmodule
Download design.sv// VLSI Hub authored example, CC0-1.0.
`timescale 1ns/1ps
module tb;
logic clk = 0, rst = 1;
logic [3:0] count;
counter4 dut(.*);
always #5 clk = ~clk;
initial begin
$dumpfile("wave.vcd"); $dumpvars(0, tb);
@(posedge clk); #1;
if (count !== 0) $fatal(1, "Reset assertion failed");
@(negedge clk); rst = 0;
for (int i = 1; i <= 18; i++) begin
@(posedge clk); #1;
if (count !== (i % 16)) $fatal(1, "Counter assertion failed at step %0d", i);
end
@(negedge clk); rst = 1;
@(posedge clk); #1;
if (count !== 0) $fatal(1, "Second reset assertion failed");
if ($test$plusargs("negative_control")) $fatal(1, "Expected negative-control failure");
$display("PASS: counter checked reset, 18 cycles, wraparound and second reset"); $finish;
end
endmodule
Download tb.svVCD info: dumpfile wave.vcd opened for output. PASS: counter checked reset, 18 cycles, wraparound and second reset tb.sv:21: $finish called at 196000 (1ps)
Simulation exit: 0. The intentional assertion failure returned exit 1; invalid compilation returned exit 1.
Full run logNegative-control evidencesha256:5fdab5cd83e36754a12e238a07b305afea6a96a1ca598e5c47de7b9c55056fe8Download both source files into the same directory, then use the recorded command with the displayed tool version.
iverilog -g2012 -s tb -o sim design.sv tb.sv && vvp sim
Local darwin arm64 · trusted authored examples · no network dependencies
Each process: 5-second deadline, 1 MB console cap. No PDK or physical implementation.
Recorded: . Example execution does not validate any catalog resource, PDK or silicon implementation.