BankAddr.v
5.73 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
// BankAddr.v v1 Doug Solomon
module BankAddr (
memclk,
Reset,
NextAddr,
NextI,
NextM,
NextD,
NextDevice,
NextRead,
NextLength,
NextM36,
Pr0StB0,
Bk0RAS,
Bk1RAS,
Bk0Addr,
Bk0MAddr,
Bk0I,
Bk0M,
Bk0D,
Bk0Device,
Bk0Read,
Bk0Length,
Bk0M36,
Bk1Addr,
Bk1MAddr,
Bk1I,
Bk1M,
Bk1D,
Bk1Device,
Bk1Read,
Bk1Length,
Bk1M36,
Pr0I,
Pr0D,
Pr0Device,
Pr0Addr,
Pr0Length,
Pr0M36
);
input memclk;
input Reset;
input [27:0] NextAddr;
input NextI;
input NextM;
input NextD;
input [3:0] NextDevice;
input NextRead;
input [6:0] NextLength;
input NextM36;
input [3:0] Pr0StB0;
input Bk0RAS;
input Bk1RAS;
output [27:0] Bk0Addr;
output [3:0] Bk0MAddr;
output Bk0I;
output Bk0M;
output Bk0D;
output [3:0] Bk0Device;
output Bk0Read;
output [6:0] Bk0Length;
output Bk0M36;
output [27:0] Bk1Addr;
output [3:0] Bk1MAddr;
output Bk1I;
output Bk1M;
output Bk1D;
output [3:0] Bk1Device;
output Bk1Read;
output [6:0] Bk1Length;
output Bk1M36;
output Pr0I;
output Pr0D;
output [3:0] Pr0Device;
output [6:3] Pr0Addr;
output [6:0] Pr0Length;
output Pr0M36;
reg Bk0RAS_del;
always @(posedge memclk)
Bk0RAS_del <= Bk0RAS;
reg Bk1RAS_del;
always @(posedge memclk)
Bk1RAS_del <= Bk1RAS;
// Bank0 Address Register
reg [27:0] hld_Bk0Addr;
reg [27:0] hld_Bk1Addr;
wire [21:7] inc_Bk1Addr_L = Pr0D ? (hld_Bk1Addr[20:7] - 14'h1)
: (hld_Bk1Addr[20:7] + 14'h1);
wire [27:0] inc_Bk1Addr = {hld_Bk1Addr[27:21],
inc_Bk1Addr_L[20:7],
hld_Bk1Addr[6:0]};
wire [27:0] adv_Bk0Addr = Pr0StB0[0] ? NextAddr
: inc_Bk1Addr;
wire [27:0] Bk0Addr = Bk0RAS ? adv_Bk0Addr
: hld_Bk0Addr;
wire [3:0] Bk0MAddr = Bk0RAS_del ? adv_Bk0Addr[3:0]
: hld_Bk0Addr[3:0];
always @(posedge memclk)
hld_Bk0Addr <= Bk0Addr;
// Bank0 Length Register
reg hld_Bk0I;
reg hld_Bk0M;
reg hld_Bk0D;
reg [3:0] hld_Bk0Device;
reg hld_Bk0Read;
reg [6:0] hld_Bk0Length;
reg hld_Bk0M36;
reg hld_Bk1I;
reg hld_Bk1M;
reg hld_Bk1D;
reg [3:0] hld_Bk1Device;
reg hld_Bk1Read;
reg [6:0] hld_Bk1Length;
reg hld_Bk1M36;
// Capture and present relevant signals contained in the length
// cycle one clock later that the address (RAS_del)
wire Bk0D = Bk0RAS_del ? (Pr0StB0[1] ? NextD : hld_Bk1D)
: hld_Bk0D;
wire [3:0] Bk0Device = Bk0RAS_del ? (Pr0StB0[1] ? NextDevice
: hld_Bk1Device)
: hld_Bk0Device;
wire Bk0Read = Bk0RAS_del ? (Pr0StB0[1] ? NextRead
: hld_Bk1Read)
: hld_Bk0Read;
wire Bk0I = Bk0RAS_del ? (Pr0StB0[1] ? NextI : hld_Bk1I)
: hld_Bk0I;
wire Bk0M = Bk0RAS_del ? (Pr0StB0[1] ? NextM : hld_Bk1M)
: hld_Bk0M;
wire [6:0] Bk0Length = Bk0RAS_del ? (Pr0StB0[1] ? NextLength
: hld_Bk1Length)
: hld_Bk0Length;
wire Bk0M36 = Bk0RAS_del ? (Pr0StB0[1] ? NextM36
: hld_Bk1M36)
: hld_Bk0M36;
always @(posedge memclk)
if (Reset)
begin
hld_Bk0I <= 1'b0;
hld_Bk0M <= 1'b0;
hld_Bk0D <= 1'b0;
hld_Bk0Device <= 4'b0;
hld_Bk0Read <= 1'b0;
hld_Bk0Length <= 7'b0;
hld_Bk0M36 <= 1'b0;
end
else begin
hld_Bk0I <= Bk0I;
hld_Bk0M <= Bk0M;
hld_Bk0D <= Bk0D;
hld_Bk0Device <= Bk0Device;
hld_Bk0Read <= Bk0Read;
hld_Bk0Length <= Bk0Length;
hld_Bk0M36 <= Bk0M36;
end
// Bank1 Address Register
wire [21:7] inc_Bk0Addr_L = Pr0D ? (hld_Bk0Addr[20:7] - 14'h1)
: (hld_Bk0Addr[20:7] + 14'h1);
wire [27:0] inc_Bk0Addr = {hld_Bk0Addr[27:21],
inc_Bk0Addr_L[20:7],
hld_Bk0Addr[6:0]};
wire [27:0] adv_Bk1Addr = Pr0StB0[2] ? NextAddr
: inc_Bk0Addr;
wire [27:0] Bk1Addr = Bk1RAS ? adv_Bk1Addr
: hld_Bk1Addr;
wire [3:0] Bk1MAddr = Bk1RAS_del ? adv_Bk1Addr[3:0]
: hld_Bk1Addr[3:0];
always @(posedge memclk)
hld_Bk1Addr <= Bk1Addr;
// Bank1 Length Register
wire Bk1D = Bk1RAS_del ? (Pr0StB0[3] ? NextD : hld_Bk0D)
: hld_Bk1D;
wire [3:0] Bk1Device = Bk1RAS_del ? (Pr0StB0[3] ? NextDevice
: hld_Bk0Device)
: hld_Bk1Device;
wire Bk1Read = Bk1RAS_del ? (Pr0StB0[3] ? NextRead
: hld_Bk0Read)
: hld_Bk1Read;
wire Bk1I = Bk1RAS_del ? (Pr0StB0[3] ? NextI : hld_Bk0I)
: hld_Bk1I;
wire Bk1M = Bk1RAS_del ? (Pr0StB0[3] ? NextM : hld_Bk0M)
: hld_Bk1M;
wire [6:0] Bk1Length = Bk1RAS_del ? (Pr0StB0[3] ? NextLength
: hld_Bk0Length)
: hld_Bk1Length;
wire Bk1M36 = Bk1RAS_del ? (Pr0StB0[3] ? NextM36
: hld_Bk0M36)
: hld_Bk1M36;
always @(posedge memclk)
if (Reset)
begin
hld_Bk1I <= 1'b0;
hld_Bk1M <= 1'b0;
hld_Bk1D <= 1'b0;
hld_Bk1Device <= 4'b0;
hld_Bk1Read <= 1'b0;
hld_Bk1Length <= 7'b0;
hld_Bk1M36 <= 1'b0;
end
else begin
hld_Bk1I <= Bk1I;
hld_Bk1M <= Bk1M;
hld_Bk1D <= Bk1D;
hld_Bk1Device <= Bk1Device;
hld_Bk1Read <= Bk1Read;
hld_Bk1Length <= Bk1Length;
hld_Bk1M36 <= Bk1M36;
end
// Bank Pair 0 1 Multi-Bank Operation register
wire Pr0En = Pr0StB0[3] & (Bk0RAS_del | Bk1RAS_del);
reg hld_Pr0I;
wire Pr0I = Pr0En ? NextI : hld_Pr0I;
reg hld_Pr0D;
wire Pr0D = Pr0En ? NextD : hld_Pr0D;
reg [3:0] hld_Pr0Device;
wire [3:0] Pr0Device = Pr0En ? NextDevice : hld_Pr0Device;
reg [6:3] hld_Pr0Addr;
wire [6:3] Pr0Addr = Pr0En ? NextAddr[6:3] : hld_Pr0Addr;
reg [6:0] hld_Pr0Length;
wire [6:0] Pr0Length = Pr0En ? NextLength : hld_Pr0Length;
reg hld_Pr0M36;
wire Pr0M36 = Pr0En ? NextM36 : hld_Pr0M36;
always @(posedge memclk) begin
hld_Pr0I <= Pr0I;
hld_Pr0D <= Pr0D;
hld_Pr0Device <= Pr0Device;
hld_Pr0Addr <= Pr0Addr;
hld_Pr0Length <= Pr0Length;
hld_Pr0M36 <= Pr0M36;
end
endmodule