-
Notifications
You must be signed in to change notification settings - Fork 1
/
tb_fifo.v
86 lines (79 loc) · 1.29 KB
/
tb_fifo.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
`include "fifo.v"
module top(
);
reg clk = 0;
reg clk_o = 0;
reg [3:0] data;
wire [3:0] data_o;
wire [3:0] status;
initial
begin
data <= 4;
clk <= 0;
clk_o <= 0;
#1 $display("clk: %d, data: %d, data_o: %d, clk_o: %b, status: %b", clk, data, data_o, clk_o, status);
#5 clk <= 1;
#5 clk <= 0;
data <= 2;
#5 clk <= 1;
#5 clk <= 0;
data <= 0;
#5 clk <= 1;
#5 clk <= 0;
data <= 6;
#5 clk <= 1;
#5 clk <= 0;
data <= 9;
#5 clk <= 1;
#5 clk <= 0;
data <= 1;
#5 clk <= 1;
#5 clk <= 0;
data <= 3;
#5 clk <= 1;
#5 clk <= 0;
data <= 3;
#5 clk <= 1;
#5 clk <= 0;
data <= 7;
#5 clk <= 1;
#5 clk <= 0;
#5 clk_o <= 1;
#5 clk_o <= 0;
#5 clk_o <= 1;
#5 clk_o <= 0;
#5 clk_o <= 1;
#5 clk_o <= 0;
#5 clk_o <= 1;
#5 clk_o <= 0;
#5 clk_o <= 1;
#5 clk_o <= 0;
#5 clk_o <= 1;
#5 clk_o <= 0;
#5 clk_o <= 1;
#5 clk_o <= 0;
#5 clk_o <= 1;
#5 clk_o <= 0;
#5 clk_o <= 1;
#5 clk_o <= 0;
#5 clk_o <= 1;
#5 clk_o <= 0;
#5 clk_o <= 1;
#5 clk_o <= 0;
#5 clk_o <= 1;
#5 clk_o <= 0;
$finish;
end
always @ (posedge clk, negedge clk, posedge clk_o, negedge clk_o) begin
#1 $display("clk: %d, data: %d, data_o: %d, clk_o: %b, status: %b", clk, data, data_o, clk_o, status);
end
fifo #(
.m(8),
.n(4))
MUT (
.clk(clk),
.data(data),
.data_o(data_o),
.clk_o(clk_o),
.status(status));
endmodule