-
Notifications
You must be signed in to change notification settings - Fork 0
/
controller_tb.v
85 lines (74 loc) · 1.69 KB
/
controller_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
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
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11.07.2024 16:38:52
// Design Name:
// Module Name: controller_tb
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module controller_tb();
reg clk, reset;
reg wr, rd;
wire full, empty;
wire [2:0] w_addr, r_addr;
wire w_en;
// Instantiate Unit Under Test
fifo_controller uut(
.clk(clk),
.reset(reset),
.wr(wr),
.rd(rd),
.full(full),
.empty(empty),
.w_addr(w_addr),
.r_addr(r_addr),
.w_en(w_en)
);
// Create a clock
localparam T = 10;
always begin
clk = 1'b1;
#(T/2);
clk = 1'b0;
#(T/2);
end
// Generate stimuli using initial
initial begin
reset = 1'b1; wr = 0; rd = 0;
#20; // Ensure reset pulse width
reset = 1'b0;
#10;
// Write to FIFO
wr = 1; rd = 0; #10;
wr = 1; rd = 0; #10;
wr = 1; rd = 0; #10;
wr = 1; rd = 0; #10;
wr = 1; rd = 0; #10;
wr = 1; rd = 0; #10;
wr = 1; rd = 0; #10;
wr = 1; rd = 0; #10;
// Stop writing and start reading from FIFO
wr = 0; rd = 1; #10;
rd = 1; #10;
rd = 1; #10;
rd = 1; #10;
rd = 1; #10;
rd = 1; #10;
rd = 1; #10;
rd = 1; #10;
rd = 1; #10;
$stop;
end
endmodule