diff options
Diffstat (limited to 'examples/icestick/checker_tb.v')
-rw-r--r-- | examples/icestick/checker_tb.v | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/examples/icestick/checker_tb.v b/examples/icestick/checker_tb.v new file mode 100644 index 0000000..241c89e --- /dev/null +++ b/examples/icestick/checker_tb.v @@ -0,0 +1,40 @@ +module testbench; + reg clk; + always #5 clk = (clk === 1'b0); + + wire ok; + + top uut ( + .clk(clk), + .LED5(ok) + ); + + reg [4095:0] vcdfile; + + initial begin + if ($value$plusargs("vcd=%s", vcdfile)) begin + $dumpfile(vcdfile); + $dumpvars(0, testbench); + end + end + + initial begin + @(posedge ok); + @(negedge ok); + $display("ERROR: detected falling edge on OK pin!"); + $stop; + end + + initial begin + repeat (3000) @(posedge clk); + + if (!ok) begin + $display("ERROR: OK pin not asserted after 3000 cycles!"); + $stop; + end + + repeat (10000) @(posedge clk); + $display("SUCCESS: OK pin still asserted after 10000 cycles."); + $finish; + end +endmodule |