-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathblink_tb.v
52 lines (41 loc) · 862 Bytes
/
blink_tb.v
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
41
42
43
44
45
46
47
48
49
50
51
module testbench;
reg clk;
reg rst;
always #2 clk = (clk === 1'b0);
wire led_r;
wire led_g;
wire led_b;
// Instanciate the module
blink uut (
.clk(clk),
.rst(rst),
.led_r(led_r),
.led_g(led_g),
.led_b(led_b)
);
reg [4095:0] vcdfile;
initial begin
rst = 1'b1;
// Clear reset after 20 time units
#10 rst = 1'b0;
end
initial begin
$timeformat(3, 2, " ns", 20);
if ($value$plusargs("vcd=%s", vcdfile)) begin
$dumpfile(vcdfile);
$dumpvars(0, testbench);
end
end
initial begin
repeat (1000) @(posedge clk);
if( uut.count0 == 0 ) begin
$display("%0t: %d", $time, uut.count0);
$stop;
end
end
initial begin
repeat (200000) @(posedge clk);
$display("SUCCESS: Simulation run for 200000 cycles/ %0t.", $time);
$finish;
end
endmodule