Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: dmu_clu_ctm_cmdctlfsm.v | |
4 | // Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved | |
5 | // 4150 Network Circle, Santa Clara, California 95054, U.S.A. | |
6 | // | |
7 | // * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
8 | // | |
9 | // This program is free software; you can redistribute it and/or modify | |
10 | // it under the terms of the GNU General Public License as published by | |
11 | // the Free Software Foundation; version 2 of the License. | |
12 | // | |
13 | // This program is distributed in the hope that it will be useful, | |
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | // GNU General Public License for more details. | |
17 | // | |
18 | // You should have received a copy of the GNU General Public License | |
19 | // along with this program; if not, write to the Free Software | |
20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 | // | |
22 | // For the avoidance of doubt, and except that if any non-GPL license | |
23 | // choice is available it will apply instead, Sun elects to use only | |
24 | // the General Public License version 2 (GPLv2) at this time for any | |
25 | // software where a choice of GPL license versions is made | |
26 | // available with the language indicating that GPLv2 or any later version | |
27 | // may be used, or where a choice of which version of the GPL is applied is | |
28 | // otherwise unspecified. | |
29 | // | |
30 | // Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
31 | // CA 95054 USA or visit www.sun.com if you need additional information or | |
32 | // have any questions. | |
33 | // | |
34 | // ========== Copyright Header End ============================================ | |
35 | module dmu_clu_ctm_cmdctlfsm | |
36 | ( | |
37 | // clock/reset | |
38 | clk, | |
39 | rst_l, | |
40 | ||
41 | // fsm inputs | |
42 | mm2cl_tcr_req, | |
43 | icr_fifo_empty, | |
44 | nxt_tag_avail, | |
45 | mrd_vld, | |
46 | mwr_vld, | |
47 | eqwr_vld, | |
48 | mdo_vld, | |
49 | pio16_vld, | |
50 | pio64_vld, | |
51 | uns_vld, | |
52 | null_vld, | |
53 | mwr_err, | |
54 | eqwr_err, | |
55 | pio_err, | |
56 | diu_dma_bufmgmt_bsy, | |
57 | diu_eqw_bufmgmt_bsy, | |
58 | diu_dma_empty, | |
59 | diu_pio_empty, | |
60 | icr_clsts, | |
61 | dou_space_avail, | |
62 | uns_req_crdt_avail, | |
63 | ds2cl_stall, | |
64 | ||
65 | // fsm outputs | |
66 | d2j_cmd_vld, | |
67 | d2j_data_vld, | |
68 | cl2mm_tcr_ack, | |
69 | ctm2crm_rcd_enq, | |
70 | cmd_req_sel, | |
71 | icr_fifo_rd, | |
72 | nxt_tag_req, | |
73 | dma_dptr_req, | |
74 | proc_uns, | |
75 | icr_grnt, | |
76 | proc_pio_err, // BP n2 4-28-05 | |
77 | cl2di_rd_en, // BP n2 5-12-05 | |
78 | ||
79 | // debug port | |
80 | cmdctlfsm_state, | |
81 | ||
82 | // idle checker port | |
83 | cmdctlfsm_idle | |
84 | ); | |
85 | ||
86 | // synopsys sync_set_reset "rst_l" | |
87 | ||
88 | // >>>>>>>>>>>>>>>>>>>>>>>>> Parameter Declarations <<<<<<<<<<<<<<<<<<<<<<<<< | |
89 | ||
90 | // -------------------------------------------------------- | |
91 | // State Number | |
92 | // -------------------------------------------------------- | |
93 | //BP n2 6-09-04 | |
94 | // parameter STATE_NUM = 10; | |
95 | parameter STATE_NUM = 13; | |
96 | ||
97 | // -------------------------------------------------------- | |
98 | // State Declarations | |
99 | // -------------------------------------------------------- | |
100 | ||
101 | parameter // summit enum cur_enum | |
102 | IDLE = 0, | |
103 | REQ_4DB_WAIT1 = 1, | |
104 | REQ_4DB_WAIT2 = 2, | |
105 | REQ_4DB_ENQ = 3, | |
106 | CPL_4DB_WAIT1 = 4, | |
107 | CPL_4DB_WAIT2 = 5, | |
108 | CPL_4DB_ENQ = 6, | |
109 | CPL_1DB_WAIT1 = 7, | |
110 | CPL_1DB_WAIT2 = 8, | |
111 | CPL_1DB_ENQ = 9, | |
112 | REQ_1DB_WAIT1 = 10, | |
113 | REQ_1DB_WAIT2 = 11, | |
114 | REQ_1DB_ENQ = 12; | |
115 | //BP n2 6-09-04 | |
116 | ||
117 | // -------------------------------------------------------- | |
118 | // ICR-TCR ARBITER PARAMETERS | |
119 | // -------------------------------------------------------- | |
120 | ||
121 | parameter N = 2; | |
122 | ||
123 | // >>>>>>>>>>>>>>>>>>>>>>>>> Port Declarations <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |
124 | ||
125 | // -------------------------------------------------------- | |
126 | // Clock/Reset Signals | |
127 | // -------------------------------------------------------- | |
128 | ||
129 | input clk; | |
130 | input rst_l; | |
131 | ||
132 | // -------------------------------------------------------- | |
133 | // FSM Inputs | |
134 | // -------------------------------------------------------- | |
135 | ||
136 | input mm2cl_tcr_req; | |
137 | input icr_fifo_empty; | |
138 | input nxt_tag_avail; | |
139 | input mrd_vld; | |
140 | input mwr_vld; | |
141 | input eqwr_vld; | |
142 | input mdo_vld; | |
143 | input pio16_vld; | |
144 | input pio64_vld; | |
145 | input uns_vld; | |
146 | input null_vld; | |
147 | input mwr_err; | |
148 | input eqwr_err; | |
149 | input pio_err; | |
150 | input diu_dma_bufmgmt_bsy; | |
151 | input diu_eqw_bufmgmt_bsy; | |
152 | input diu_dma_empty; | |
153 | input diu_pio_empty; | |
154 | input icr_clsts; | |
155 | input dou_space_avail; | |
156 | input uns_req_crdt_avail; | |
157 | input ds2cl_stall; // for N2 dmu quiescing | |
158 | ||
159 | // -------------------------------------------------------- | |
160 | // FSM Outputs | |
161 | // -------------------------------------------------------- | |
162 | ||
163 | // external | |
164 | output d2j_cmd_vld; | |
165 | output d2j_data_vld; | |
166 | output cl2mm_tcr_ack; | |
167 | output ctm2crm_rcd_enq; | |
168 | ||
169 | // internal | |
170 | output cmd_req_sel; | |
171 | output icr_fifo_rd; | |
172 | output nxt_tag_req; | |
173 | output dma_dptr_req; | |
174 | output proc_uns; | |
175 | output icr_grnt; | |
176 | output proc_pio_err; // BP n2 4-28-05, force 0 data on pio err cpl | |
177 | output cl2di_rd_en; // BP n2 5-12-05, rd enable to diu ram for power savings | |
178 | ||
179 | // debug port | |
180 | output [3:0] cmdctlfsm_state; | |
181 | ||
182 | // idle checker port | |
183 | output cmdctlfsm_idle; | |
184 | ||
185 | // >>>>>>>>>>>>>>>>>>>>>>>>> Data Type Declarations <<<<<<<<<<<<<<<<<<<<<<<<< | |
186 | ||
187 | // ~~~~~~~~~~~~~~~~~~~~~~~~~ REGISTERS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
188 | ||
189 | // ********** Flops ********** | |
190 | ||
191 | reg [(STATE_NUM - 1):0] cur_state; | |
192 | reg d2j_dvld_s0; | |
193 | reg d2j_dvld_s1; | |
194 | reg d2j_dvld_s2; | |
195 | reg d2j_dvld_s3; | |
196 | reg d2j_cmd_vld; | |
197 | reg ctm2crm_rcd_enq; | |
198 | reg cl2mm_tcr_ack; | |
199 | ||
200 | // ********** Non-Flops ****** | |
201 | ||
202 | reg [(STATE_NUM - 1):0] nxt_state; | |
203 | reg [3:0] enc_state; | |
204 | ||
205 | // ~~~~~~~~~~~~~~~~~~~~~~~~~ NETS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
206 | ||
207 | wire [(N-1):0] higher_pri_reqs; | |
208 | wire [(N-1):0] req; | |
209 | wire [(N-1):0] grant; | |
210 | wire icr_req; | |
211 | wire tcr_req; | |
212 | wire tcr_grnt; | |
213 | wire proc_mwr; | |
214 | wire proc_p16; | |
215 | wire proc_p64; | |
216 | wire proc_4db_req; | |
217 | wire drop_rcd; | |
218 | wire proc_pio_err; | |
219 | wire proc_tcr; | |
220 | wire proc_dma_rd; | |
221 | wire proc_dma_rd_1stcl; | |
222 | wire proc_dma_rd_clrmdr; | |
223 | ||
224 | wire proc_1db_req; | |
225 | // >>>>>>>>>>>>>>>>>>>>>>>>> 0-in Checkers <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |
226 | ||
227 | // ----- ARBITER CHECKER ------------------------------------------ | |
228 | ||
229 | /* 0in arb | |
230 | -req tcr_req icr_req | |
231 | -gnt tcr_grnt icr_grnt | |
232 | -priority | |
233 | -known_grant | |
234 | */ | |
235 | ||
236 | // ----- STATE-MACHINE CHECKERS ----------------------------------- | |
237 | ||
238 | // 0in one_hot -var cur_state | |
239 | ||
240 | /* 0in state | |
241 | -var cur_state | |
242 | -val (13'b1 << IDLE) | |
243 | -next (13'b1 << IDLE) | |
244 | (13'b1 << REQ_4DB_WAIT1) | |
245 | (13'b1 << CPL_4DB_WAIT1) | |
246 | (13'b1 << CPL_1DB_WAIT1) | |
247 | (13'b1 << REQ_1DB_WAIT1) | |
248 | -match_by_cycle | |
249 | */ | |
250 | ||
251 | /* 0in state | |
252 | -var cur_state | |
253 | -val (13'b1 << REQ_4DB_WAIT1) | |
254 | -next (13'b1 << REQ_4DB_WAIT2) | |
255 | -match_by_cycle | |
256 | */ | |
257 | ||
258 | /* 0in state | |
259 | -var cur_state | |
260 | -val (13'b1 << REQ_4DB_WAIT2) | |
261 | -next (13'b1 << REQ_4DB_WAIT2) | |
262 | (13'b1 << REQ_4DB_ENQ) | |
263 | -match_by_cycle | |
264 | */ | |
265 | ||
266 | /* 0in state | |
267 | -var cur_state | |
268 | -val (13'b1 << REQ_4DB_ENQ) | |
269 | -next (13'b1 << IDLE) | |
270 | -match_by_cycle | |
271 | */ | |
272 | //BP n2 6-09-04 | |
273 | /* 0in state | |
274 | -var cur_state | |
275 | -val (13'b1 << REQ_1DB_WAIT1) | |
276 | -next (13'b1 << REQ_1DB_WAIT2) | |
277 | -match_by_cycle | |
278 | */ | |
279 | ||
280 | /* 0in state | |
281 | -var cur_state | |
282 | -val (13'b1 << REQ_1DB_WAIT2) | |
283 | -next (13'b1 << REQ_1DB_WAIT2) | |
284 | (13'b1 << REQ_1DB_ENQ) | |
285 | -match_by_cycle | |
286 | */ | |
287 | ||
288 | /* 0in state | |
289 | -var cur_state | |
290 | -val (13'b1 << REQ_1DB_ENQ) | |
291 | -next (13'b1 << IDLE) | |
292 | -match_by_cycle | |
293 | */ | |
294 | //end BP n2 6-09-04 | |
295 | /* 0in state | |
296 | -var cur_state | |
297 | -val (13'b1 << CPL_4DB_WAIT1) | |
298 | -next (13'b1 << CPL_4DB_WAIT2) | |
299 | -match_by_cycle | |
300 | */ | |
301 | ||
302 | /* 0in state | |
303 | -var cur_state | |
304 | -val (13'b1 << CPL_4DB_WAIT2) | |
305 | -next (13'b1 << CPL_4DB_WAIT2) | |
306 | (13'b1 << CPL_4DB_ENQ) | |
307 | -match_by_cycle | |
308 | */ | |
309 | ||
310 | /* 0in state | |
311 | -var cur_state | |
312 | -val (13'b1 << CPL_4DB_ENQ) | |
313 | -next (13'b1 << IDLE) | |
314 | -match_by_cycle | |
315 | */ | |
316 | ||
317 | /* 0in state | |
318 | -var cur_state | |
319 | -val (13'b1 << CPL_1DB_WAIT1) | |
320 | -next (13'b1 << CPL_1DB_WAIT2) | |
321 | -match_by_cycle | |
322 | */ | |
323 | ||
324 | /* 0in state | |
325 | -var cur_state | |
326 | -val (13'b1 << CPL_1DB_WAIT2) | |
327 | -next (13'b1 << CPL_1DB_WAIT2) | |
328 | (13'b1 << CPL_1DB_ENQ) | |
329 | -match_by_cycle | |
330 | */ | |
331 | ||
332 | /* 0in state | |
333 | -var cur_state | |
334 | -val (13'b1 << CPL_1DB_ENQ) | |
335 | -next (13'b1 << IDLE) | |
336 | -match_by_cycle | |
337 | */ | |
338 | ||
339 | // >>>>>>>>>>>>>>>>>>>>>>>>> RTL Model <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |
340 | ||
341 | // -------------------------------------------------------- | |
342 | // IDLE Checker | |
343 | // -------------------------------------------------------- | |
344 | ||
345 | assign cmdctlfsm_idle = (cur_state[IDLE] & ~d2j_data_vld & | |
346 | (mm2cl_tcr_req ~^ cl2mm_tcr_ack)); | |
347 | ||
348 | // -------------------------------------------------------- | |
349 | // Debug Port Logic | |
350 | // -------------------------------------------------------- | |
351 | ||
352 | // encode one-hot current_state vector for debug port | |
353 | always @(cur_state[(STATE_NUM - 1):1]) | |
354 | begin | |
355 | enc_state[0] = (cur_state[1] | cur_state[3] | cur_state[5] | | |
356 | cur_state[7] | cur_state[9]); | |
357 | ||
358 | enc_state[1] = (cur_state[2] | cur_state[3] | cur_state[6] | | |
359 | cur_state[7]); | |
360 | ||
361 | enc_state[2] = (cur_state[4] | cur_state[5] | cur_state[6] | | |
362 | cur_state[7]); | |
363 | ||
364 | enc_state[3] = (cur_state[8] | cur_state[9] | cur_state[10] | | |
365 | cur_state[11] | cur_state[12]); | |
366 | end | |
367 | ||
368 | // output cmdctlfsm debug bus | |
369 | assign cmdctlfsm_state = enc_state; | |
370 | ||
371 | // -------------------------------------------------------- | |
372 | // ICR-TCR Priority Arbiter | |
373 | // -------------------------------------------------------- | |
374 | //BP n2 10-06-04 | |
375 | wire cur_state_no_grnt; | |
376 | reg proc_pio_err_d; | |
377 | // assign cur_state_no_grnt = ( d2j_dvld_s3 & ~d2j_dvld_s2); | |
378 | //BP n2 4-27-05 added in pio err because sio expects data for all pio cpl's | |
379 | assign cur_state_no_grnt = ( d2j_dvld_s3 & ~d2j_dvld_s2) | (proc_pio_err_d); | |
380 | // arb req generation | |
381 | // BP 2-14-05 for N2 dbg quiescing, added ds2cl_stall | |
382 | assign icr_req = (~icr_fifo_empty && ~ds2cl_stall) && ~cur_state_no_grnt; | |
383 | assign tcr_req = (mm2cl_tcr_req ^ cl2mm_tcr_ack) & nxt_tag_avail & ~ds2cl_stall; | |
384 | // assign icr_req = ~icr_fifo_empty && ~cur_state_no_grnt; | |
385 | // assign tcr_req = (mm2cl_tcr_req ^ cl2mm_tcr_ack) & nxt_tag_avail; | |
386 | ||
387 | // arb req assignment | |
388 | assign req = {icr_req, tcr_req}; | |
389 | ||
390 | // simple priority arbiter | |
391 | assign higher_pri_reqs[N-1:1] = higher_pri_reqs[N-2:0] | req[N-2:0]; | |
392 | assign higher_pri_reqs[0] = 1'b0; | |
393 | assign grant[N-1:0] = req[N-1:0] & ~higher_pri_reqs[N-1:0]; | |
394 | ||
395 | // arb grant assignment | |
396 | assign {icr_grnt, tcr_grnt} = grant; | |
397 | ||
398 | // -------------------------------------------------------- | |
399 | // FSM Control Decode | |
400 | // -------------------------------------------------------- | |
401 | ||
402 | assign proc_mwr = mwr_vld & ~diu_dma_empty; | |
403 | assign proc_p16 = pio16_vld & ~diu_pio_empty; | |
404 | assign proc_p64 = pio64_vld & ~diu_pio_empty; | |
405 | //BP n2 6-08-04 | |
406 | // assign proc_4db_req = proc_mwr | eqwr_vld | mdo_vld; | |
407 | assign proc_4db_req = proc_mwr | eqwr_vld ; | |
408 | assign proc_1db_req = mdo_vld ; | |
409 | ||
410 | // -------------------------------------------------------- | |
411 | // FSM Next State | |
412 | // -------------------------------------------------------- | |
413 | ||
414 | // next state assignment | |
415 | always @(cur_state or icr_grnt or icr_fifo_empty or proc_p16 or proc_p64 or | |
416 | proc_4db_req or nxt_tag_avail or proc_1db_req) | |
417 | begin | |
418 | ||
419 | // initialization | |
420 | nxt_state = {STATE_NUM{1'b0}}; | |
421 | ||
422 | case (1'b1) // synopsys parallel_case | |
423 | ||
424 | // 0in < case -full | |
425 | ||
426 | /////////////////////////////////////////////////////////////////////// | |
427 | ||
428 | // IDLE State | |
429 | cur_state[IDLE] : | |
430 | casez ({icr_fifo_empty, proc_p16, proc_p64, proc_4db_req,proc_1db_req}) | |
431 | ||
432 | // 0in < case -parallel -full | |
433 | ||
434 | 5'b1_zzzz, | |
435 | 5'b0_0000 : nxt_state[IDLE] = 1'b1; | |
436 | 5'b0_0010 : nxt_state[REQ_4DB_WAIT1] = 1'b1; | |
437 | 5'b0_0100 : nxt_state[CPL_4DB_WAIT1] = 1'b1; | |
438 | 5'b0_1000 : nxt_state[CPL_1DB_WAIT1] = 1'b1; | |
439 | 5'b0_0001 : nxt_state[REQ_1DB_WAIT1] = 1'b1; | |
440 | endcase | |
441 | ||
442 | /////////////////////////////////////////////////////////////////////// | |
443 | ||
444 | // ---------- 4 Data-Beat Request --------------------------- | |
445 | ||
446 | // REQ_4DB Wait-1 State | |
447 | cur_state[REQ_4DB_WAIT1] : | |
448 | nxt_state[REQ_4DB_WAIT2] = 1'b1; | |
449 | ||
450 | // REQ_4DB Wait-2 State | |
451 | cur_state[REQ_4DB_WAIT2] : | |
452 | casez ({icr_grnt, nxt_tag_avail}) | |
453 | ||
454 | // 0in < case -parallel -full | |
455 | ||
456 | 2'b0z, | |
457 | 2'b10 : nxt_state[REQ_4DB_WAIT2] = 1'b1; | |
458 | 2'b11 : nxt_state[REQ_4DB_ENQ] = 1'b1; | |
459 | endcase | |
460 | ||
461 | // REQ_4DB Enq State | |
462 | cur_state[REQ_4DB_ENQ] : | |
463 | nxt_state[IDLE] = 1'b1; | |
464 | ||
465 | /////////////////////////////////////////////////////////////////////// | |
466 | /////////////////////////////////////////////////////////////////////// | |
467 | ||
468 | // ---------- 1 Data-Beat Request --------------------------- | |
469 | ||
470 | // REQ_1DB Wait-1 State | |
471 | cur_state[REQ_1DB_WAIT1] : | |
472 | nxt_state[REQ_1DB_WAIT2] = 1'b1; | |
473 | ||
474 | // REQ_1DB Wait-2 State | |
475 | cur_state[REQ_1DB_WAIT2] : | |
476 | casez ({icr_grnt, nxt_tag_avail}) | |
477 | ||
478 | // 0in < case -parallel -full | |
479 | ||
480 | 2'b0z, | |
481 | 2'b10 : nxt_state[REQ_1DB_WAIT2] = 1'b1; | |
482 | 2'b11 : nxt_state[REQ_1DB_ENQ] = 1'b1; | |
483 | endcase | |
484 | ||
485 | // REQ_4DB Enq State | |
486 | cur_state[REQ_1DB_ENQ] : | |
487 | nxt_state[IDLE] = 1'b1; | |
488 | ||
489 | /////////////////////////////////////////////////////////////////////// | |
490 | // ---------- 4 Data-Beat Completion ------------------------ | |
491 | ||
492 | // CPL_4DB Wait-1 State | |
493 | cur_state[CPL_4DB_WAIT1] : | |
494 | nxt_state[CPL_4DB_WAIT2] = 1'b1; | |
495 | ||
496 | // CPL_4DB Wait-2 State | |
497 | cur_state[CPL_4DB_WAIT2] : | |
498 | if (icr_grnt) | |
499 | nxt_state[CPL_4DB_ENQ] = 1'b1; | |
500 | else | |
501 | nxt_state[CPL_4DB_WAIT2] = 1'b1; | |
502 | ||
503 | // CPL_4DB Enq State | |
504 | cur_state[CPL_4DB_ENQ] : | |
505 | nxt_state[IDLE] = 1'b1; | |
506 | ||
507 | /////////////////////////////////////////////////////////////////////// | |
508 | ||
509 | // ---------- 1 Data-Beat Completion ------------------------ | |
510 | ||
511 | // CPL_1DB Wait-1 State | |
512 | cur_state[CPL_1DB_WAIT1] : | |
513 | nxt_state[CPL_1DB_WAIT2] = 1'b1; | |
514 | ||
515 | // CPL_1DB Wait-2 State | |
516 | cur_state[CPL_1DB_WAIT2] : | |
517 | if (icr_grnt) | |
518 | nxt_state[CPL_1DB_ENQ] = 1'b1; | |
519 | else | |
520 | nxt_state[CPL_1DB_WAIT2] = 1'b1; | |
521 | ||
522 | // CPL_1DB Enq State | |
523 | cur_state[CPL_1DB_ENQ] : | |
524 | nxt_state[IDLE] = 1'b1; | |
525 | ||
526 | /////////////////////////////////////////////////////////////////////// | |
527 | ||
528 | endcase | |
529 | end | |
530 | ||
531 | // -------------------------------------------------------- | |
532 | // FSM Current State | |
533 | // -------------------------------------------------------- | |
534 | ||
535 | // summit state_vector cur_state enum cur_enum | |
536 | ||
537 | // current state assignment | |
538 | always @(posedge clk) | |
539 | if (~rst_l) | |
540 | begin | |
541 | cur_state <= {STATE_NUM{1'b0}}; | |
542 | cur_state[IDLE] <= 1'b1; | |
543 | end | |
544 | else | |
545 | cur_state <= nxt_state; | |
546 | ||
547 | // -------------------------------------------------------- | |
548 | // FSM Output Generation | |
549 | // -------------------------------------------------------- | |
550 | ||
551 | // ----- process tablewalk request ------------------------- | |
552 | ||
553 | // assign proc_tcr = (tcr_grnt & ~d2j_dvld_s2); | |
554 | //BP n2 10-06-04 | |
555 | assign proc_tcr = (tcr_grnt & ~d2j_dvld_s3); | |
556 | ||
557 | // ----- process unsupported request ----------------------- | |
558 | ||
559 | assign proc_uns = ~icr_fifo_empty & uns_vld & uns_req_crdt_avail; | |
560 | ||
561 | // ----- process dma mem read request ---------------------- | |
562 | ||
563 | // process a valid dma read command record | |
564 | // assign proc_dma_rd = (icr_grnt & mrd_vld & nxt_tag_avail & ~d2j_dvld_s2); | |
565 | //BP n2 10-06-04 | |
566 | assign proc_dma_rd = (icr_grnt & mrd_vld & nxt_tag_avail & ~d2j_dvld_s3); | |
567 | ||
568 | // current dma read is for the first CL of a packet | |
569 | assign proc_dma_rd_1stcl = (icr_clsts & proc_dma_rd & dou_space_avail); | |
570 | ||
571 | // current dma read is for a remaining CL of a packet | |
572 | assign proc_dma_rd_clrmdr = (~icr_clsts & proc_dma_rd); | |
573 | ||
574 | // process the dma read | |
575 | assign dma_dptr_req = (proc_dma_rd_1stcl | proc_dma_rd_clrmdr); | |
576 | ||
577 | // ----- process termination records ----------------------- | |
578 | ||
579 | assign drop_rcd = (~icr_fifo_empty & | |
580 | ((~diu_dma_bufmgmt_bsy & mwr_err) | | |
581 | (~diu_eqw_bufmgmt_bsy & (eqwr_err | null_vld)))); | |
582 | ||
583 | // ----- process pio cpl errors ---------------------------- | |
584 | ||
585 | // assign proc_pio_err = icr_grnt & pio_err & ~d2j_dvld_s2; | |
586 | //BP n2 10-06-04 | |
587 | assign proc_pio_err = icr_grnt & pio_err & ~d2j_dvld_s3; | |
588 | //BP 4-27-05 add an extra cycle after pio err cpl's because sii expects this | |
589 | always @(posedge clk) | |
590 | if (~rst_l) | |
591 | proc_pio_err_d <= 1'b0; | |
592 | else | |
593 | proc_pio_err_d <= proc_pio_err; | |
594 | ||
595 | // ----- generate icr fifo dequeue ------------------------- | |
596 | ||
597 | assign icr_fifo_rd = (nxt_state[REQ_4DB_ENQ] | nxt_state[CPL_4DB_ENQ] | | |
598 | nxt_state[CPL_1DB_ENQ] | proc_uns | dma_dptr_req | | |
599 | //BP 4-27-05 nxt_state[REQ_1DB_ENQ] | drop_rcd | proc_pio_err); | |
600 | nxt_state[REQ_1DB_ENQ] | drop_rcd | proc_pio_err_d); | |
601 | ||
602 | // ----- ctm control --------------------------------------- | |
603 | ||
604 | // fetch next tag - update request credits | |
605 | assign nxt_tag_req = nxt_state[REQ_4DB_ENQ] | nxt_state[REQ_1DB_ENQ] | proc_tcr | dma_dptr_req; | |
606 | ||
607 | // select for cmd/addr/ctag gen; icr = 1'b0, tcr = 1'b1 | |
608 | assign cmd_req_sel = proc_tcr; | |
609 | ||
610 | // unsupported request enq | |
611 | always @(posedge clk) | |
612 | if (~rst_l) | |
613 | ctm2crm_rcd_enq <= 1'b0; | |
614 | else | |
615 | ctm2crm_rcd_enq <= proc_uns; | |
616 | ||
617 | // ----- dmc-2-jbc interface control ----------------------- | |
618 | ||
619 | // d2j_cmd_vld : 1 cycle | |
620 | always @(posedge clk) | |
621 | if (~rst_l) | |
622 | d2j_cmd_vld <= 1'b0; | |
623 | else | |
624 | d2j_cmd_vld <= (nxt_state[REQ_4DB_ENQ] | nxt_state[CPL_4DB_ENQ] | | |
625 | nxt_state[CPL_1DB_ENQ] | proc_tcr | dma_dptr_req | | |
626 | nxt_state[REQ_1DB_ENQ] | proc_pio_err); | |
627 | ||
628 | // shift reg to generate d2j_data_vld : 1 or 4 cycles | |
629 | always @(posedge clk) | |
630 | if (~rst_l) | |
631 | begin | |
632 | d2j_dvld_s0 <= 1'b0; | |
633 | d2j_dvld_s1 <= 1'b0; | |
634 | d2j_dvld_s2 <= 1'b0; | |
635 | d2j_dvld_s3 <= 1'b0; | |
636 | end | |
637 | else if (nxt_state[REQ_4DB_ENQ] | nxt_state[CPL_4DB_ENQ]) | |
638 | begin // dmawr(full/part), eqwr, mdo, pio64_cpl - 4 cycles | |
639 | d2j_dvld_s0 <= 1'b1; | |
640 | d2j_dvld_s1 <= 1'b1; | |
641 | d2j_dvld_s2 <= 1'b1; | |
642 | d2j_dvld_s3 <= 1'b1; | |
643 | end | |
644 | else if (nxt_state[CPL_1DB_ENQ] | nxt_state[REQ_1DB_ENQ]) | |
645 | begin // pio16_cpl - 1 cycle, and new mondo int's | |
646 | d2j_dvld_s0 <= 1'b0; | |
647 | d2j_dvld_s1 <= 1'b0; | |
648 | d2j_dvld_s2 <= 1'b0; | |
649 | d2j_dvld_s3 <= 1'b1; | |
650 | end | |
651 | else | |
652 | begin | |
653 | d2j_dvld_s0 <= 1'b0; | |
654 | d2j_dvld_s1 <= d2j_dvld_s0; | |
655 | d2j_dvld_s2 <= d2j_dvld_s1; | |
656 | d2j_dvld_s3 <= d2j_dvld_s2; | |
657 | end | |
658 | ||
659 | // BP n2 5-13-05 create a rd enable for the diu ram for power savings | |
660 | assign cl2di_rd_en = ~cmdctlfsm_idle; // 0in assert_leader -leader cl2di_rd_en -follower d2j_data_vld -min 2 -max 2 | |
661 | ||
662 | // output d2j_vld to jbc | |
663 | assign d2j_data_vld = d2j_dvld_s3; | |
664 | ||
665 | // ----- clu-2-mmu interface control ----------------------- | |
666 | ||
667 | // generate tcr acknowledge | |
668 | always @(posedge clk) | |
669 | if (~rst_l) | |
670 | cl2mm_tcr_ack <= 1'b0; | |
671 | else if (proc_tcr) | |
672 | cl2mm_tcr_ack <= ~cl2mm_tcr_ack; | |
673 | ||
674 | endmodule // dmu_clu_ctm_cmdctlfsm |