diff options
| author | Clifford Wolf <clifford@clifford.at> | 2017-07-31 14:57:24 +0200 |
|---|---|---|
| committer | Clifford Wolf <clifford@clifford.at> | 2017-07-31 14:57:24 +0200 |
| commit | 872e333cf75c6fc1bdf985f09565c70d16567434 (patch) | |
| tree | 11a7b2336faaf12e84d8890c1674c04b0c8093a6 /examples/icestick/checker_tb.v | |
| parent | f704149b7298c7c6b56520d104dc4b20abf455b2 (diff) | |
| parent | 81e943e050dad652da795d21375bb700064116f4 (diff) | |
Merge branch 'master' into ice5k
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 |
