-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfifo_tb.v
56 lines (50 loc) · 1.09 KB
/
fifo_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
52
53
54
module fifo_tb(
);
parameter DWIDTH=16; // Data width
parameter AWIDTH=4; // Address width
parameter DEPTH=2**AWIDTH; // FIFO depth
reg clk, reset;
reg [DWIDTH-1:0] in;
reg push;
reg pop;
wire empty, almostempty, full, almostfull;
wire [DWIDTH-1:0] out;
wire [AWIDTH:0] num;
integer i;
// Create DUT
synchronous_fifo # (.DWIDTH(DWIDTH), .AWIDTH(AWIDTH), .DEPTH(DEPTH)) dut(
.clk(clk),
.reset(reset),
.in(in),
.push(push),
.pop(pop),
.empty(empty),
.almostempty(almostempty),
.full(full),
.almostfull(almostfull),
.out(out),
.num(num)
);
initial begin
clk = 0;
forever begin
#10 clk = ~clk;
end
end
initial begin
reset = 1'b1;
pop = 1'b0;
#15
push = 1'b1;
#5;
reset = 1'b0;
for (i=0; i<2*DEPTH; i=i+1) begin
in= i;
#20;
if (i==3*DEPTH/2) begin
pop = 1'b1;
end
end
push = 1'b0;
end
endmodule