-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdlatch8bit_test.v
93 lines (69 loc) · 1.32 KB
/
dlatch8bit_test.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
`include "dlatch8bit.v"
module DLatch8Bit_Test;
logic[0:7] d, q;
logic clk, rst;
DLatch8Bit UUT (.d(d), .clk(clk), .q(q), .rst(rst));
initial begin
$monitor($time," D=%x, CLK=%x, Q=%x, RST=%x", d, clk, q, rst);
clk = 0; d=8'h00; rst = 1;
#5
assert (q == 8'h00);
clk = 0; d=8'hFF; rst = 0;
#5
assert (q == 8'h00);
clk = 1; d=8'hAA;
#5
assert (q == 8'h00);
clk = 1; d=8'h6D;
#5
assert (q == 8'h00);
clk = 0; d=8'h25;
#5
assert (q == 8'h6D);
clk = 0; d=8'h52;
#5
assert (q == 8'h6D);
clk = 1; d=8'hBA;
#5
assert (q == 8'h6D);
clk = 1; d=8'hC5;
#5
assert (q == 8'h6D);
clk = 0; d=8'h80;
#5
assert (q == 8'hC5);
clk = 0; d=8'h99;
#5
assert (q == 8'hC5);
rst = 1;
#5
assert (q == 8'h00);
rst = 0;
#5
assert (q == 8'h00);
clk = 0; d=8'h25;
#5
assert (q == 8'h00);
clk = 0; d=8'h52;
#5
assert (q == 8'h00);
clk = 1; d=8'hBA; rst = 1;
#5
assert (q == 8'h00);
clk = 1; d=8'hC5; rst = 0;
#5
assert (q == 8'h00);
clk = 0; d=8'h80;
#5
assert (q == 8'hC5);
clk = 0; d=8'h99;
#5
assert (q == 8'hC5);
rst = 1;
#5
assert (q == 8'h00);
rst = 0;
#5
assert (q == 8'h00);
end
endmodule