-
Notifications
You must be signed in to change notification settings - Fork 1
/
blink_tb.v
48 lines (34 loc) · 805 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
// `include "blink.v"
`timescale 1ns/100ps
module blink_tb;
reg clk_tb, rst_tb;
wire [`LEDS_NR-1:0] leds_tb;
// Instance of the blink module
blink u1 (
.clk(clk_tb),
.rst(rst_tb),
.leds(leds_tb)
);
initial begin
$dumpfile("blink_tb.vcd");
$dumpvars(0, blink_tb);
$display("TEST BLINK!");
clk_tb = 0;
rst_tb = 0; // RESET
#5;
if (leds_tb != 0)
$error("Error: Expected LEDs to be 0, but got %b.", leds_tb);
rst_tb = 1;
clk_tb = 1;
#10;
if (leds_tb == 0)
$error("Error: Expected LEDs to be HIGH, but got %b.", leds_tb);
#4; clk_tb = 0;
#4; clk_tb = 1;
#10;
if (leds_tb != 0)
$error("Error: Expected LEDs to be LOW, but got %b.", leds_tb);
#20;
$finish;
end
endmodule