Download Control/Counter/ring_counter/testbench.v from chipagents/RTLLM-verified: direct link, hf CLI and curl.
- Browser
- Download file 1.41 kB
-
https://huggingface.co/datasets/chipagents/RTLLM-verified/resolve/main/Control/Counter/ring_counter/testbench.v
- Command line
-
hf download hf://datasets/chipagents/RTLLM-verified/Control/Counter/ring_counter/testbench.v
-
curl -L -o testbench.v https://huggingface.co/datasets/chipagents/RTLLM-verified/resolve/main/Control/Counter/ring_counter/testbench.v
1.41 kB
| module testbench; | |
| reg clk; | |
| reg reset; | |
| wire [7:0] out; | |
| ring_counter ring_counter_inst ( | |
| .clk(clk), | |
| .reset(reset), | |
| .out(out) | |
| ); | |
| always begin | |
| #5 clk <= ~clk; | |
| end | |
| reg [3:0] i; | |
| reg [7:0] data [0:9]; // ICARUS PORT: was a declaration initializer {8'b00000001, ..., 8'b00000001} | |
| initial begin | |
| data[0] = 8'b00000001; data[1] = 8'b00000001; data[2] = 8'b00000010; data[3] = 8'b00000100; data[4] = 8'b00001000; | |
| data[5] = 8'b00010000; data[6] = 8'b00100000; data[7] = 8'b01000000; data[8] = 8'b10000000; data[9] = 8'b00000001; | |
| end | |
| initial begin | |
| clk = 0; | |
| reset = 1; | |
| i=0; | |
| #10 reset = 0; | |
| end | |
| // Monitor for displaying output | |
| always @(posedge clk) begin | |
| if (out !== data[i]) begin | |
| $display("Failed at i=%d, out=%b, expected=%b", i, out, data[i]); | |
| // $finish; | |
| end | |
| i = i + 1; | |
| end | |
| // Stop simulation after checking all values | |
| always @(posedge clk) begin | |
| #0; // ICARUS PORT: run after the checker block's `i = i + 1` in the same time step (same-timestep race) | |
| if (i == 9) begin | |
| $display("=========== Your Design Passed ==========="); | |
| $finish; | |
| end | |
| end | |
| // Stop simulation after 100 clock cycles | |
| initial begin | |
| #100 $finish; | |
| end | |
| endmodule | |