diff options
author | Clifford Wolf <clifford@clifford.at> | 2017-07-21 16:56:15 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2017-07-21 16:57:11 +0200 |
commit | 6124133269c7ff7bc550064e116c1bcfcbb412bf (patch) | |
tree | 543cb2f799f556074d82f073e3ad7ba586d685ad /examples/icestick/checker_tb.v | |
parent | cb0a0f7ef81555cb5c8e51cabb806a302c92b91a (diff) | |
download | icestorm-6124133269c7ff7bc550064e116c1bcfcbb412bf.tar.gz icestorm-6124133269c7ff7bc550064e116c1bcfcbb412bf.tar.bz2 icestorm-6124133269c7ff7bc550064e116c1bcfcbb412bf.zip |
Add icestick "checker" example
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 |