-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmodified_fifo_tb.sv
112 lines (72 loc) · 1.51 KB
/
modified_fifo_tb.sv
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
module modified_fifo_tb import types_def::*; ();
logic clk,rst;
opt_request request_in ;
//logic [data_width + address_width :0]request_in; //////////// concatenated input works
logic [read_entries_log -1:0] index_i;
logic valid_in , grant_in;
request request_o ;
logic [read_entries_log -1:0] index_o;
modified_fifo m (clk,rst,request_in,index_i,valid_in,grant_o ,request_o,index_o,valid_o, grant_in);
// Clock generator
always
begin
#1 clk = 1;
#1 clk = 0;
end
initial begin
rst = 0;
# 10 rst = 1;
#11
grant_in =0;
/*
@(posedge clk)
valid_in =1;
request_in[data_width + address_width] = 1; // write
request_in[address_width -1:0] = 19; // address
index_i = 5;
request_in[data_width + address_width -1:address_width] = 2; //data
@(posedge clk)
valid_in =0;
*/
@(posedge clk)
valid_in =1;
request_in.req_type = read;
request_in.address = 2;
index_i = 5;
request_in.data = 2;
@(posedge clk)
valid_in =0;
#100
@(posedge clk)
valid_in =1;
request_in.req_type = write;
request_in.address = 1;
index_i = 7;
request_in.data = 4;
@(posedge clk)
valid_in =0;
#100
@(posedge clk) // pop read
grant_in =1;
@(posedge clk)
grant_in =0;
#100
@(posedge clk) // pop write
grant_in =1;
@(posedge clk)
grant_in =0;
for (int i = 0; i < 5; i++) begin
#100
@(posedge clk)
valid_in =1;
request_in.req_type = write;
request_in.address = 1;
index_i = 7;
request_in.data = 4;
@(posedge clk)
valid_in =0;
end
#100
$stop;
end
endmodule