aboutsummaryrefslogtreecommitdiffstats
path: root/examples/icestick/checker_tb.v
blob: 241c89efb72c243c98208b4d42f0dc7df729089b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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