Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: fflp_fcram_cntl.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 | /**********************************************************************/ | |
36 | /*project name: N2 */ | |
37 | /*module name: fflp_fcram_cntl */ | |
38 | /*description: FCRAM access protocol */ | |
39 | /* */ | |
40 | /*parent module in: fflp_fcram_top */ | |
41 | /*child modules in: fflp_fcram_cntl_sm */ | |
42 | /*interface modules: */ | |
43 | /*author name: Jeanne Cai */ | |
44 | /*date created: 04-08-04 */ | |
45 | /* */ | |
46 | /* Copyright (c) 2004, Sun Microsystems, Inc. */ | |
47 | /* Sun Proprietary and Confidential */ | |
48 | /* */ | |
49 | /*modifications: */ | |
50 | /* */ | |
51 | /* */ | |
52 | ||
53 | ||
54 | module fflp_fcram_cntl ( | |
55 | cclk, | |
56 | reset, | |
57 | disable_chksum, | |
58 | pio_fio_latency, | |
59 | fflp_init_done, | |
60 | fcram_refresh_timer_reg_dout, | |
61 | flow_part_sel_reg0_dout, | |
62 | flow_part_sel_reg1_dout, | |
63 | flow_part_sel_reg2_dout, | |
64 | flow_part_sel_reg3_dout, | |
65 | flow_part_sel_reg4_dout, | |
66 | flow_part_sel_reg5_dout, | |
67 | flow_part_sel_reg6_dout, | |
68 | flow_part_sel_reg7_dout, | |
69 | hash_tbl_addr_reg0_dout, | |
70 | hash_tbl_addr_reg1_dout, | |
71 | hash_tbl_addr_reg2_dout, | |
72 | hash_tbl_addr_reg3_dout, | |
73 | hash_tbl_addr_reg4_dout, | |
74 | hash_tbl_addr_reg5_dout, | |
75 | hash_tbl_addr_reg6_dout, | |
76 | hash_tbl_addr_reg7_dout, | |
77 | hash_tbl_data_reg0_dout, | |
78 | hash_tbl_data_reg1_dout, | |
79 | hash_tbl_data_reg2_dout, | |
80 | hash_tbl_data_reg3_dout, | |
81 | hash_tbl_data_reg4_dout, | |
82 | hash_tbl_data_reg5_dout, | |
83 | hash_tbl_data_reg6_dout, | |
84 | hash_tbl_data_reg7_dout, | |
85 | fcram_err_test_reg_dout, | |
86 | cpu_req_part0_sel, | |
87 | cpu_req_part1_sel, | |
88 | cpu_req_part2_sel, | |
89 | cpu_req_part3_sel, | |
90 | cpu_req_part4_sel, | |
91 | cpu_req_part5_sel, | |
92 | cpu_req_part6_sel, | |
93 | cpu_req_part7_sel, | |
94 | pio_rd, | |
95 | pio_wr_data, | |
96 | pio_fio_cfg_reset, | |
97 | fio_cfg_addr_reg_dout, | |
98 | cpu_fio_req_sync, | |
99 | fcram_driver_imp_ctrl, | |
100 | fcram_qs_mode, | |
101 | srch_no_fc_done, | |
102 | do_srch_cycle, | |
103 | do_cpu_cycle, | |
104 | merg_bus_0_hash_v1, | |
105 | merg_bus_0_rdc_tbl_num, | |
106 | merg_bus_1_fc_lookup, | |
107 | fcram_fflp_mstrready, | |
108 | fcram_fflp_fatal_err, | |
109 | fcram_fflp_data_ready, | |
110 | fcram_fflp_even_din, | |
111 | fcram_fflp_odd_din, | |
112 | fcram_fflp_cfg_datrd, | |
113 | fcram_fflp_cfg_done, | |
114 | fcram_fflp_cfg_err, | |
115 | ||
116 | fflp_fcram_cfg_rst, | |
117 | fflp_fcram_cfg_sel, | |
118 | fflp_fcram_cfg_rd, | |
119 | fflp_fcram_cfg_addr, | |
120 | fflp_fcram_cfg_datwr, | |
121 | fflp_fcram_slv_update, | |
122 | fflp_fcram_rd_en, | |
123 | fflp_fcram_cs_l, | |
124 | fflp_fcram_fn, | |
125 | fflp_fcram_pd_l, | |
126 | fflp_fcram_ba0, | |
127 | fflp_fcram_ba1, | |
128 | fflp_fcram_addr, | |
129 | fflp_fcram_ds, | |
130 | fflp_fcram_triz_en_l, | |
131 | fflp_fcram_even_dout, | |
132 | fflp_fcram_odd_dout, | |
133 | fc_din_reg_dout_r, | |
134 | ecc_check_err_r, | |
135 | ecc_corr_err_r, | |
136 | fio_no_fatal_err, | |
137 | srch_burst_done, | |
138 | cpu_burst_done_sm, | |
139 | fcram_sm_state, | |
140 | srch_burst_done_2, //second pipe | |
141 | srch_fio_wait_6, //third pipe | |
142 | srch_fio_rd_en_4, //4th pipe | |
143 | cpu_fc_req_done, | |
144 | fc_rd_data_reg_dout, | |
145 | fc_rd_ecc_err, | |
146 | cpu_fio_req_done, //fio pio req done | |
147 | cpu_fio_rd_data, | |
148 | fio_cal_rd_latency | |
149 | ||
150 | ); | |
151 | ||
152 | input cclk; | |
153 | input reset; | |
154 | input[1:0] pio_fio_latency; | |
155 | input disable_chksum; | |
156 | input fflp_init_done; | |
157 | input[31:0] fcram_refresh_timer_reg_dout; | |
158 | input[9:0] flow_part_sel_reg0_dout; | |
159 | input[9:0] flow_part_sel_reg1_dout; | |
160 | input[9:0] flow_part_sel_reg2_dout; | |
161 | input[9:0] flow_part_sel_reg3_dout; | |
162 | input[9:0] flow_part_sel_reg4_dout; | |
163 | input[9:0] flow_part_sel_reg5_dout; | |
164 | input[9:0] flow_part_sel_reg6_dout; | |
165 | input[9:0] flow_part_sel_reg7_dout; | |
166 | input[23:0] hash_tbl_addr_reg0_dout; | |
167 | input[23:0] hash_tbl_addr_reg1_dout; | |
168 | input[23:0] hash_tbl_addr_reg2_dout; | |
169 | input[23:0] hash_tbl_addr_reg3_dout; | |
170 | input[23:0] hash_tbl_addr_reg4_dout; | |
171 | input[23:0] hash_tbl_addr_reg5_dout; | |
172 | input[23:0] hash_tbl_addr_reg6_dout; | |
173 | input[23:0] hash_tbl_addr_reg7_dout; | |
174 | input[63:0] hash_tbl_data_reg0_dout; | |
175 | input[63:0] hash_tbl_data_reg1_dout; | |
176 | input[63:0] hash_tbl_data_reg2_dout; | |
177 | input[63:0] hash_tbl_data_reg3_dout; | |
178 | input[63:0] hash_tbl_data_reg4_dout; | |
179 | input[63:0] hash_tbl_data_reg5_dout; | |
180 | input[63:0] hash_tbl_data_reg6_dout; | |
181 | input[63:0] hash_tbl_data_reg7_dout; | |
182 | input[71:0] fcram_err_test_reg_dout; | |
183 | input cpu_req_part0_sel; | |
184 | input cpu_req_part1_sel; | |
185 | input cpu_req_part2_sel; | |
186 | input cpu_req_part3_sel; | |
187 | input cpu_req_part4_sel; | |
188 | input cpu_req_part5_sel; | |
189 | input cpu_req_part6_sel; | |
190 | input cpu_req_part7_sel; | |
191 | input pio_rd; | |
192 | input[15:0] pio_wr_data; | |
193 | input pio_fio_cfg_reset; | |
194 | input[7:0] fio_cfg_addr_reg_dout; | |
195 | input cpu_fio_req_sync; | |
196 | input[3:0] fcram_driver_imp_ctrl; | |
197 | input fcram_qs_mode; | |
198 | input srch_no_fc_done; | |
199 | input do_srch_cycle; | |
200 | input do_cpu_cycle; | |
201 | input[19:0] merg_bus_0_hash_v1; | |
202 | input[2:0] merg_bus_0_rdc_tbl_num; | |
203 | input merg_bus_1_fc_lookup; | |
204 | input fcram_fflp_mstrready; | |
205 | input fcram_fflp_fatal_err; | |
206 | input[3:0] fcram_fflp_data_ready; | |
207 | input[35:0] fcram_fflp_even_din; | |
208 | input[35:0] fcram_fflp_odd_din; | |
209 | input[15:0] fcram_fflp_cfg_datrd; | |
210 | input fcram_fflp_cfg_done; | |
211 | input fcram_fflp_cfg_err; | |
212 | ||
213 | output fflp_fcram_cfg_rst; | |
214 | output fflp_fcram_cfg_sel; | |
215 | output fflp_fcram_cfg_rd; | |
216 | output[7:0] fflp_fcram_cfg_addr; | |
217 | output[15:0] fflp_fcram_cfg_datwr; | |
218 | output fflp_fcram_slv_update; | |
219 | output[1:0] fflp_fcram_rd_en; | |
220 | output fflp_fcram_cs_l; | |
221 | output fflp_fcram_fn; | |
222 | output fflp_fcram_pd_l; | |
223 | output fflp_fcram_ba0; | |
224 | output fflp_fcram_ba1; | |
225 | output[14:0] fflp_fcram_addr; | |
226 | output[1:0] fflp_fcram_ds; | |
227 | output[1:0] fflp_fcram_triz_en_l; | |
228 | output[35:0] fflp_fcram_even_dout; | |
229 | output[35:0] fflp_fcram_odd_dout; | |
230 | output[71:0] fc_din_reg_dout_r; | |
231 | output ecc_check_err_r; | |
232 | output ecc_corr_err_r; | |
233 | output fio_no_fatal_err; | |
234 | output srch_burst_done; | |
235 | output cpu_burst_done_sm; | |
236 | output[4:0] fcram_sm_state; | |
237 | output srch_burst_done_2; | |
238 | output srch_fio_wait_6; | |
239 | output srch_fio_rd_en_4; | |
240 | output cpu_fc_req_done; | |
241 | output[71:0] fc_rd_data_reg_dout; | |
242 | output fc_rd_ecc_err; | |
243 | output cpu_fio_req_done; | |
244 | output[31:0] cpu_fio_rd_data; | |
245 | output[7:0] fio_cal_rd_latency; | |
246 | ||
247 | wire cpu_cmd; | |
248 | /* | |
249 | wire ext_valid0; | |
250 | wire ext_valid1; | |
251 | wire ext_valid2; | |
252 | wire ext_valid3; | |
253 | wire ext_valid4; | |
254 | wire ext_valid5; | |
255 | wire ext_valid6; | |
256 | wire ext_valid7; | |
257 | */ | |
258 | wire[4:0] addr_mask0; | |
259 | wire[4:0] addr_mask1; | |
260 | wire[4:0] addr_mask2; | |
261 | wire[4:0] addr_mask3; | |
262 | wire[4:0] addr_mask4; | |
263 | wire[4:0] addr_mask5; | |
264 | wire[4:0] addr_mask6; | |
265 | wire[4:0] addr_mask7; | |
266 | wire[4:0] addr_base0; | |
267 | wire[4:0] addr_base1; | |
268 | wire[4:0] addr_base2; | |
269 | wire[4:0] addr_base3; | |
270 | wire[4:0] addr_base4; | |
271 | wire[4:0] addr_base5; | |
272 | wire[4:0] addr_base6; | |
273 | wire[4:0] addr_base7; | |
274 | ||
275 | wire[22:0] cpu_fc_loc; | |
276 | wire[1:0] cpu_fc_bk; | |
277 | wire cpu_bk0; | |
278 | wire cpu_bk1; | |
279 | wire[21:0] cpu_fc_addr; | |
280 | wire[4:0] cpu_addr_mask; | |
281 | wire[4:0] cpu_addr_base; | |
282 | wire[4:0] cpu_fc_masked_addr_h; | |
283 | wire[21:0] cpu_fc_masked_addr; | |
284 | wire[63:0] cpu_fc_data; | |
285 | wire[63:0] cpu_fc_data_r; | |
286 | wire[71:0] ecc_check_cpu_fc_data; | |
287 | wire[71:0] cpu_fc_data_in; | |
288 | wire[71:0] ecc_check_cpu_fc_data_r; | |
289 | ||
290 | reg[4:0] srch_addr_mask; | |
291 | reg[4:0] srch_addr_base; | |
292 | ||
293 | wire[4:0] srch_fc_masked_addr_h; | |
294 | wire[21:0] srch_fc_masked_addr; | |
295 | ||
296 | wire[14:0] mode_reg_data; | |
297 | wire[14:0] ext_mode_reg_data; | |
298 | wire[14:0] srch_fc_addr_mux_dout; | |
299 | wire[14:0] conf_fc_addr_mux_dout; | |
300 | wire[14:0] fc_addr_mux_dout; | |
301 | ||
302 | wire[14:0] fflp_fcram_addr; | |
303 | wire[35:0] fflp_fcram_even_dout; | |
304 | wire[35:0] fflp_fcram_odd_dout; | |
305 | wire[35:0] fc_even_din_reg_dout; | |
306 | wire[35:0] fc_odd_din_reg_dout; | |
307 | wire[71:0] fc_din_reg_dout; | |
308 | wire fio_mstr_ready; | |
309 | wire fio_no_fatal_err; | |
310 | wire[3:0] fio_data_ready; | |
311 | //wire fflp_fcram_cs_l; | |
312 | //wire fflp_fcram_fn; | |
313 | wire fflp_fcram_pd_l; | |
314 | wire fflp_fcram_ba0; | |
315 | wire fflp_fcram_ba1; | |
316 | wire[1:0] fflp_fcram_ds; | |
317 | wire[1:0] fflp_fcram_triz_en_l; //write data enable | |
318 | ||
319 | reg fflp_fcram_cs_l; | |
320 | reg fflp_fcram_fn; | |
321 | ||
322 | wire[71:0] fc_din_reg_dout_tmp; | |
323 | wire[71:0] fc_din_reg_dout_r; | |
324 | wire ecc_check_err; | |
325 | wire ecc_check_err_r; | |
326 | ||
327 | wire ecc_corr_err_r; | |
328 | wire ecc_check_err_all; | |
329 | wire ecc_no_error; | |
330 | wire ecc_corr_error; | |
331 | wire ecc_error; | |
332 | ||
333 | wire cpu_burst_done; | |
334 | wire cpu_burst_done_1; | |
335 | wire cpu_burst_done_2; | |
336 | wire cpu_burst_done_3; | |
337 | wire cpu_burst_done_4; | |
338 | wire cpu_burst_done_5; | |
339 | wire cpu_burst_done_6; | |
340 | wire cpu_burst_done_7; | |
341 | wire cpu_burst_done_8; | |
342 | wire cpu_burst_done_9; | |
343 | wire cpu_burst_done_10; | |
344 | wire cpu_burst_done_11; | |
345 | wire cpu_burst_done_12; | |
346 | wire cpu_burst_done_13; | |
347 | wire cpu_burst_done_14; | |
348 | wire cpu_burst_done_15; | |
349 | ||
350 | wire cpu_burst_done_16; | |
351 | wire cpu_burst_done_17; | |
352 | wire cpu_burst_done_18; | |
353 | wire cpu_burst_done_19; | |
354 | ||
355 | wire pio_fio_acc_en; | |
356 | wire pio_fio_acc_en_1; | |
357 | wire pio_fio_acc_en_2; | |
358 | wire pio_fio_acc_en_3; | |
359 | wire pio_fio_acc_en_4; | |
360 | wire pio_fio_acc_en_5; | |
361 | wire pio_fio_acc_en_6; | |
362 | ||
363 | wire pio_fio_rd_en; | |
364 | wire pio_fio_rd_en_1; | |
365 | wire pio_fio_rd_en_4; | |
366 | ||
367 | wire cpu_fc_req_done; | |
368 | wire cpu_fc_req_done_p; | |
369 | wire[71:0] fc_rd_data_reg_dout; | |
370 | wire fc_rd_ecc_err; | |
371 | ||
372 | wire srch_burst_done; | |
373 | wire srch_burst_done_all; | |
374 | wire srch_burst_done_1; | |
375 | wire srch_burst_done_2; | |
376 | wire srch_burst_done_3; | |
377 | ||
378 | wire srch_fio_wait; | |
379 | wire srch_fio_wait_1; | |
380 | wire srch_fio_wait_2; | |
381 | wire srch_fio_wait_3; | |
382 | wire srch_fio_wait_4; | |
383 | wire srch_fio_wait_5; | |
384 | wire srch_fio_wait_6; | |
385 | ||
386 | wire srch_fio_rd_en; | |
387 | wire srch_fio_rd_en_1; | |
388 | wire srch_fio_rd_en_2; | |
389 | wire srch_fio_rd_en_3; | |
390 | wire srch_fio_rd_en_4; | |
391 | wire srch_fio_rd_en_5; | |
392 | wire srch_fio_rd_en_6; | |
393 | wire srch_fio_rd_en_7; | |
394 | wire srch_fio_rd_en_8; | |
395 | wire srch_fio_rd_en_tmp; | |
396 | wire srch_fio_rd_en_p; | |
397 | wire srch_fio_rd_en_valid; | |
398 | ||
399 | wire fcram_ds; | |
400 | wire fcram_ds_1; | |
401 | wire fcram_ds_2; | |
402 | wire fcram_ds_3; | |
403 | wire fcram_ds_4; | |
404 | wire fcram_ds_5; | |
405 | ||
406 | wire[1:0] fcram_cmd_sm; | |
407 | wire fcram_ba0_sm; | |
408 | wire fcram_ba1_sm; | |
409 | wire[2:0] fcram_addr_sel; | |
410 | wire fcram_addr_en; | |
411 | wire fcram_ds_sm; | |
412 | wire fflp_fcram_slv_update; | |
413 | wire srch_burst_done_sm; | |
414 | wire cpu_burst_done_sm; | |
415 | wire power_on_wait_cnt_done_r; | |
416 | wire[4:0] fcram_sm_state; | |
417 | ||
418 | wire cpu_fio_req_sync_p; | |
419 | wire cpu_fio_req_sync_r; | |
420 | wire fcram_cfg_done_p; | |
421 | wire fcram_cfg_done; | |
422 | wire fcram_cfg_done_r; | |
423 | wire fcram_cfg_done_r1; | |
424 | wire fcram_cfg_err; | |
425 | wire fcram_cfg_sel_in; | |
426 | wire cpu_fio_req_done; | |
427 | wire[15:0] fcram_cfg_datrd; | |
428 | wire[31:0] cpu_fio_rd_data_tmp; | |
429 | wire[31:0] cpu_fio_rd_data; | |
430 | wire fflp_fcram_cfg_rst; | |
431 | wire[7:0] fflp_fcram_cfg_addr; | |
432 | wire[15:0] fflp_fcram_cfg_datwr; | |
433 | wire fflp_fcram_cfg_rd; | |
434 | wire fflp_fcram_cfg_sel; | |
435 | wire fflp_fcram_rd_en_p; | |
436 | wire[1:0] fflp_fcram_rd_en; | |
437 | ||
438 | wire fflp_data_ready_p; | |
439 | wire fflp_data_ready; | |
440 | wire cpu_rd_latency0; | |
441 | wire cpu_rd_latency1; | |
442 | wire cpu_rd_latency2; | |
443 | wire cpu_rd_latency3; | |
444 | wire cpu_rd_latency4; | |
445 | wire cpu_rd_latency5; | |
446 | wire cpu_rd_latency6; | |
447 | wire cpu_rd_latency7; | |
448 | wire[7:0] cpu_rd_latency_array; | |
449 | wire[7:0] fio_cal_rd_latency; | |
450 | ||
451 | /***********************/ | |
452 | //CPU Request | |
453 | /***********************/ | |
454 | assign cpu_cmd = !pio_rd; | |
455 | ||
456 | //assign ext_valid0 = flow_part_sel_reg0_dout[16]; | |
457 | assign addr_mask0 = flow_part_sel_reg0_dout[9:5]; | |
458 | assign addr_base0 = flow_part_sel_reg0_dout[4:0]; | |
459 | ||
460 | //assign ext_valid1 = flow_part_sel_reg1_dout[16]; | |
461 | assign addr_mask1 = flow_part_sel_reg1_dout[9:5]; | |
462 | assign addr_base1 = flow_part_sel_reg1_dout[4:0]; | |
463 | ||
464 | //assign ext_valid2 = flow_part_sel_reg2_dout[16]; | |
465 | assign addr_mask2 = flow_part_sel_reg2_dout[9:5]; | |
466 | assign addr_base2 = flow_part_sel_reg2_dout[4:0]; | |
467 | ||
468 | //assign ext_valid3 = flow_part_sel_reg3_dout[16]; | |
469 | assign addr_mask3 = flow_part_sel_reg3_dout[9:5]; | |
470 | assign addr_base3 = flow_part_sel_reg3_dout[4:0]; | |
471 | ||
472 | //assign ext_valid4 = flow_part_sel_reg4_dout[16]; | |
473 | assign addr_mask4 = flow_part_sel_reg4_dout[9:5]; | |
474 | assign addr_base4 = flow_part_sel_reg4_dout[4:0]; | |
475 | ||
476 | //assign ext_valid5 = flow_part_sel_reg5_dout[16]; | |
477 | assign addr_mask5 = flow_part_sel_reg5_dout[9:5]; | |
478 | assign addr_base5 = flow_part_sel_reg5_dout[4:0]; | |
479 | ||
480 | //assign ext_valid6 = flow_part_sel_reg6_dout[16]; | |
481 | assign addr_mask6 = flow_part_sel_reg6_dout[9:5]; | |
482 | assign addr_base6 = flow_part_sel_reg6_dout[4:0]; | |
483 | ||
484 | //assign ext_valid7 = flow_part_sel_reg7_dout[16]; | |
485 | assign addr_mask7 = flow_part_sel_reg7_dout[9:5]; | |
486 | assign addr_base7 = flow_part_sel_reg7_dout[4:0]; | |
487 | ||
488 | assign cpu_addr_mask = ({5{cpu_req_part0_sel}} & addr_mask0) | | |
489 | ({5{cpu_req_part1_sel}} & addr_mask1) | | |
490 | ({5{cpu_req_part2_sel}} & addr_mask2) | | |
491 | ({5{cpu_req_part3_sel}} & addr_mask3) | | |
492 | ({5{cpu_req_part4_sel}} & addr_mask4) | | |
493 | ({5{cpu_req_part5_sel}} & addr_mask5) | | |
494 | ({5{cpu_req_part6_sel}} & addr_mask6) | | |
495 | ({5{cpu_req_part7_sel}} & addr_mask7); | |
496 | ||
497 | assign cpu_addr_base = ({5{cpu_req_part0_sel}} & addr_base0) | | |
498 | ({5{cpu_req_part1_sel}} & addr_base1) | | |
499 | ({5{cpu_req_part2_sel}} & addr_base2) | | |
500 | ({5{cpu_req_part3_sel}} & addr_base3) | | |
501 | ({5{cpu_req_part4_sel}} & addr_base4) | | |
502 | ({5{cpu_req_part5_sel}} & addr_base5) | | |
503 | ({5{cpu_req_part6_sel}} & addr_base6) | | |
504 | ({5{cpu_req_part7_sel}} & addr_base7); | |
505 | ||
506 | assign cpu_fc_data = (({64{cpu_req_part0_sel}} & hash_tbl_data_reg0_dout) | | |
507 | ({64{cpu_req_part1_sel}} & hash_tbl_data_reg1_dout) | | |
508 | ({64{cpu_req_part2_sel}} & hash_tbl_data_reg2_dout) | | |
509 | ({64{cpu_req_part3_sel}} & hash_tbl_data_reg3_dout) | | |
510 | ({64{cpu_req_part4_sel}} & hash_tbl_data_reg4_dout) | | |
511 | ({64{cpu_req_part5_sel}} & hash_tbl_data_reg5_dout) | | |
512 | ({64{cpu_req_part6_sel}} & hash_tbl_data_reg6_dout) | | |
513 | ({64{cpu_req_part7_sel}} & hash_tbl_data_reg7_dout)); | |
514 | ||
515 | assign cpu_fc_loc = ({23{cpu_req_part0_sel}} & hash_tbl_addr_reg0_dout[22:0]) | | |
516 | ({23{cpu_req_part1_sel}} & hash_tbl_addr_reg1_dout[22:0]) | | |
517 | ({23{cpu_req_part2_sel}} & hash_tbl_addr_reg2_dout[22:0]) | | |
518 | ({23{cpu_req_part3_sel}} & hash_tbl_addr_reg3_dout[22:0]) | | |
519 | ({23{cpu_req_part4_sel}} & hash_tbl_addr_reg4_dout[22:0]) | | |
520 | ({23{cpu_req_part5_sel}} & hash_tbl_addr_reg5_dout[22:0]) | | |
521 | ({23{cpu_req_part6_sel}} & hash_tbl_addr_reg6_dout[22:0]) | | |
522 | ({23{cpu_req_part7_sel}} & hash_tbl_addr_reg7_dout[22:0]); | |
523 | ||
524 | assign cpu_fc_bk = cpu_fc_loc[2:1]; | |
525 | assign cpu_bk0 = cpu_fc_bk[0]; | |
526 | assign cpu_bk1 = cpu_fc_bk[1]; | |
527 | assign cpu_fc_addr = {cpu_fc_loc[22:3], cpu_fc_loc[0], 1'b0}; //22bits | |
528 | ||
529 | assign cpu_fc_masked_addr_h = (cpu_addr_mask & cpu_addr_base) | (~cpu_addr_mask & cpu_fc_addr[21:17]); | |
530 | assign cpu_fc_masked_addr = {cpu_fc_masked_addr_h, cpu_fc_addr[16:0]}; | |
531 | ||
532 | ||
533 | /**********************************/ | |
534 | //Packet Lookup Addr | |
535 | /**********************************/ | |
536 | always @(merg_bus_0_rdc_tbl_num or | |
537 | addr_mask0 or addr_base0 or | |
538 | addr_mask1 or addr_base1 or | |
539 | addr_mask2 or addr_base2 or | |
540 | addr_mask3 or addr_base3 or | |
541 | addr_mask4 or addr_base4 or | |
542 | addr_mask5 or addr_base5 or | |
543 | addr_mask6 or addr_base6 or | |
544 | addr_mask7 or addr_base7) | |
545 | begin | |
546 | case (merg_bus_0_rdc_tbl_num) | |
547 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_fcram_cntl" | |
548 | ||
549 | 3'b000: | |
550 | begin | |
551 | srch_addr_mask = addr_mask0; | |
552 | srch_addr_base = addr_base0; | |
553 | end | |
554 | 3'b001: | |
555 | begin | |
556 | srch_addr_mask = addr_mask1; | |
557 | srch_addr_base = addr_base1; | |
558 | end | |
559 | 3'b010: | |
560 | begin | |
561 | srch_addr_mask = addr_mask2; | |
562 | srch_addr_base = addr_base2; | |
563 | end | |
564 | 3'b011: | |
565 | begin | |
566 | srch_addr_mask = addr_mask3; | |
567 | srch_addr_base = addr_base3; | |
568 | end | |
569 | 3'b100: | |
570 | begin | |
571 | srch_addr_mask = addr_mask4; | |
572 | srch_addr_base = addr_base4; | |
573 | end | |
574 | 3'b101: | |
575 | begin | |
576 | srch_addr_mask = addr_mask5; | |
577 | srch_addr_base = addr_base5; | |
578 | end | |
579 | 3'b110: | |
580 | begin | |
581 | srch_addr_mask = addr_mask6; | |
582 | srch_addr_base = addr_base6; | |
583 | end | |
584 | 3'b111: | |
585 | begin | |
586 | srch_addr_mask = addr_mask7; | |
587 | srch_addr_base = addr_base7; | |
588 | end | |
589 | default: | |
590 | begin | |
591 | srch_addr_mask = 5'b0; | |
592 | srch_addr_base = 5'b0; | |
593 | end | |
594 | endcase | |
595 | end | |
596 | ||
597 | assign srch_fc_masked_addr_h = (srch_addr_mask & srch_addr_base) | (~srch_addr_mask & merg_bus_0_hash_v1[19:15]); | |
598 | assign srch_fc_masked_addr = {srch_fc_masked_addr_h, merg_bus_0_hash_v1[14:0], 2'b00}; | |
599 | ||
600 | ||
601 | /*******************************/ | |
602 | //FCRAM Interface signal | |
603 | /*******************************/ | |
604 | assign mode_reg_data = {8'b0, 3'b110, 1'b0, 3'b010}; //{resed(8), cas_latency, burst_type, burst_len} | |
605 | assign ext_mode_reg_data = {8'b0, 1'b1, fcram_qs_mode, fcram_driver_imp_ctrl[3:0], 1'b0}; | |
606 | ||
607 | assign srch_fc_addr_mux_dout = (fcram_addr_sel[1:0] == 2'b00) ? srch_fc_masked_addr[21:7] : | |
608 | (fcram_addr_sel[1:0] == 2'b01) ? {8'b0, srch_fc_masked_addr[6:0]} : | |
609 | (fcram_addr_sel[1:0] == 2'b10) ? cpu_fc_masked_addr[21:7] : | |
610 | {2'b01, 6'b0, cpu_fc_masked_addr[6:0]}; | |
611 | assign conf_fc_addr_mux_dout = fcram_addr_sel[0] ? ext_mode_reg_data : mode_reg_data; | |
612 | assign fc_addr_mux_dout = fcram_addr_sel[2] ? srch_fc_addr_mux_dout : conf_fc_addr_mux_dout; | |
613 | ||
614 | dffre #(15) fflp_fcram_addr_reg (cclk, reset, fcram_addr_en, fc_addr_mux_dout, fflp_fcram_addr); | |
615 | dffre #(36) fcram_even_dout_reg (cclk, reset, fcram_ds, cpu_fc_data_in[35:0], fflp_fcram_even_dout); | |
616 | dffre #(36) fcram_odd_dout_reg (cclk, reset, fcram_ds, cpu_fc_data_in[71:36], fflp_fcram_odd_dout); | |
617 | ||
618 | dffr #(1) fcram_mstr_ready_reg(cclk, reset, fcram_fflp_mstrready, fio_mstr_ready); | |
619 | dffr #(1) fcram_fatal_err_reg (cclk, reset, !fcram_fflp_fatal_err, fio_no_fatal_err); | |
620 | dffr #(4) fcram_data_ready_reg(cclk, reset, fcram_fflp_data_ready, fio_data_ready); | |
621 | dffr #(36) fcram_even_din_reg (cclk, reset, fcram_fflp_even_din, fc_even_din_reg_dout); | |
622 | dffr #(36) fcram_odd_din_reg (cclk, reset, fcram_fflp_odd_din, fc_odd_din_reg_dout); | |
623 | ||
624 | //dffr #(1) fflp_fcram_cs_reg (cclk, reset, fcram_cmd_sm[1], fflp_fcram_cs_l); | |
625 | //dffr #(1) fflp_fcram_fn_reg (cclk, reset, fcram_cmd_sm[0], fflp_fcram_fn); | |
626 | ||
627 | dffr #(1) fflp_fcram_pd_reg (cclk, reset, power_on_wait_cnt_done_r, fflp_fcram_pd_l); | |
628 | dffr #(1) fflp_fcram_ba0_reg (cclk, reset, fcram_ba0_sm, fflp_fcram_ba0); | |
629 | dffr #(1) fflp_fcram_ba1_reg (cclk, reset, fcram_ba1_sm, fflp_fcram_ba1); | |
630 | dffr #(2) fflp_fcram_rd_en_reg(cclk, reset, {2{fflp_fcram_rd_en_p}}, fflp_fcram_rd_en); | |
631 | ||
632 | always @ (posedge cclk) | |
633 | if (reset) | |
634 | fflp_fcram_cs_l <= 1'b1; | |
635 | else | |
636 | fflp_fcram_cs_l <= fcram_cmd_sm[1]; | |
637 | ||
638 | always @ (posedge cclk) | |
639 | if (reset) | |
640 | fflp_fcram_fn <= 1'b0; | |
641 | else | |
642 | fflp_fcram_fn <= fcram_cmd_sm[0]; | |
643 | ||
644 | ||
645 | /*******************************/ | |
646 | //Pipeline Control | |
647 | /*******************************/ | |
648 | assign pio_fio_acc_en = (pio_fio_latency == 2'b00) ? cpu_burst_done_12 : | |
649 | (pio_fio_latency == 2'b01) ? cpu_burst_done_13 : | |
650 | (pio_fio_latency == 2'b10) ? cpu_burst_done_14 : | |
651 | cpu_burst_done_15 ; | |
652 | ||
653 | assign cpu_fc_req_done_p = pio_fio_acc_en_4 | pio_fio_acc_en_5 | pio_fio_acc_en_6; | |
654 | ||
655 | assign fc_din_reg_dout = {fc_odd_din_reg_dout, fc_even_din_reg_dout}; | |
656 | assign srch_burst_done_all = srch_no_fc_done | srch_burst_done; | |
657 | assign srch_fio_rd_en = (pio_fio_latency == 2'b00) ? srch_fio_wait_3 : | |
658 | (pio_fio_latency == 2'b01) ? srch_fio_wait_4 : | |
659 | (pio_fio_latency == 2'b10) ? srch_fio_wait_5 : | |
660 | srch_fio_wait_6; | |
661 | ||
662 | assign srch_fio_rd_en_valid = (srch_fio_rd_en & merg_bus_1_fc_lookup & fio_no_fatal_err); | |
663 | assign srch_fio_rd_en_tmp = srch_fio_rd_en_valid ? 1'b1 : | |
664 | srch_fio_rd_en_8 ? 1'b0 : srch_fio_rd_en_p; | |
665 | ||
666 | assign pio_fio_rd_en = pio_fio_acc_en & pio_rd; | |
667 | assign pio_fio_rd_en_1 = pio_fio_acc_en_1 & pio_rd; | |
668 | assign pio_fio_rd_en_4 = pio_fio_acc_en_4 & pio_rd; | |
669 | ||
670 | assign fflp_fcram_rd_en_p = srch_fio_rd_en_p | pio_fio_rd_en | pio_fio_rd_en_1; | |
671 | ||
672 | dffre #(72) fc_rd_data_reg (cclk, reset, pio_fio_rd_en_4, fc_din_reg_dout_r, fc_rd_data_reg_dout); | |
673 | dffre #(1) fc_rd_ecc_err_reg (cclk, reset, pio_fio_rd_en_4, ecc_check_err_all, fc_rd_ecc_err); | |
674 | ||
675 | dffr #(1) cpu_burst_done_reg (cclk, reset, cpu_burst_done_sm, cpu_burst_done); | |
676 | dffr #(1) cpu_burst_done_1_reg (cclk, reset, cpu_burst_done, cpu_burst_done_1); | |
677 | dffr #(1) cpu_burst_done_2_reg (cclk, reset, cpu_burst_done_1, cpu_burst_done_2); | |
678 | dffr #(1) cpu_burst_done_3_reg (cclk, reset, cpu_burst_done_2, cpu_burst_done_3); | |
679 | dffr #(1) cpu_burst_done_4_reg (cclk, reset, cpu_burst_done_3, cpu_burst_done_4); | |
680 | dffr #(1) cpu_burst_done_5_reg (cclk, reset, cpu_burst_done_4, cpu_burst_done_5); | |
681 | dffr #(1) cpu_burst_done_6_reg (cclk, reset, cpu_burst_done_5, cpu_burst_done_6); | |
682 | dffr #(1) cpu_burst_done_7_reg (cclk, reset, cpu_burst_done_6, cpu_burst_done_7); | |
683 | dffr #(1) cpu_burst_done_8_reg (cclk, reset, cpu_burst_done_7, cpu_burst_done_8); | |
684 | dffr #(1) cpu_burst_done_9_reg (cclk, reset, cpu_burst_done_8, cpu_burst_done_9); | |
685 | dffr #(1) cpu_burst_done_10_reg (cclk, reset, cpu_burst_done_9, cpu_burst_done_10); | |
686 | dffr #(1) cpu_burst_done_11_reg (cclk, reset, cpu_burst_done_10, cpu_burst_done_11); | |
687 | dffr #(1) cpu_burst_done_12_reg (cclk, reset, cpu_burst_done_11, cpu_burst_done_12); | |
688 | dffr #(1) cpu_burst_done_13_reg (cclk, reset, cpu_burst_done_12, cpu_burst_done_13); | |
689 | dffr #(1) cpu_burst_done_14_reg (cclk, reset, cpu_burst_done_13, cpu_burst_done_14); | |
690 | dffr #(1) cpu_burst_done_15_reg (cclk, reset, cpu_burst_done_14, cpu_burst_done_15); | |
691 | ||
692 | //for calculating fio read latency | |
693 | dffr #(1) cpu_burst_done_16_reg (cclk, reset, cpu_burst_done_15, cpu_burst_done_16); | |
694 | dffr #(1) cpu_burst_done_17_reg (cclk, reset, cpu_burst_done_16, cpu_burst_done_17); | |
695 | dffr #(1) cpu_burst_done_18_reg (cclk, reset, cpu_burst_done_17, cpu_burst_done_18); | |
696 | dffr #(1) cpu_burst_done_19_reg (cclk, reset, cpu_burst_done_18, cpu_burst_done_19); | |
697 | ||
698 | dffr #(1) pio_fio_acc_en_1_reg (cclk, reset, pio_fio_acc_en, pio_fio_acc_en_1); | |
699 | dffr #(1) pio_fio_acc_en_2_reg (cclk, reset, pio_fio_acc_en_1, pio_fio_acc_en_2); | |
700 | dffr #(1) pio_fio_acc_en_3_reg (cclk, reset, pio_fio_acc_en_2, pio_fio_acc_en_3); | |
701 | dffr #(1) pio_fio_acc_en_4_reg (cclk, reset, pio_fio_acc_en_3, pio_fio_acc_en_4); | |
702 | dffr #(1) pio_fio_acc_en_5_reg (cclk, reset, pio_fio_acc_en_4, pio_fio_acc_en_5); | |
703 | dffr #(1) pio_fio_acc_en_6_reg (cclk, reset, pio_fio_acc_en_5, pio_fio_acc_en_6); | |
704 | ||
705 | dffr #(1) cpu_fc_req_done_reg (cclk, reset, cpu_fc_req_done_p, cpu_fc_req_done); | |
706 | ||
707 | dffr #(1) srch_burst_done_reg (cclk, reset, srch_burst_done_sm, srch_burst_done); | |
708 | dffr #(1) srch_burst_done_1_reg (cclk, reset, srch_burst_done_all, srch_burst_done_1); | |
709 | dffr #(1) srch_burst_done_2_reg (cclk, reset, srch_burst_done_1, srch_burst_done_2); | |
710 | dffr #(1) srch_burst_done_3_reg (cclk, reset, srch_burst_done_2, srch_burst_done_3); | |
711 | ||
712 | dffr #(1) srch_fio_wait_reg (cclk, reset, srch_burst_done_3, srch_fio_wait); | |
713 | dffr #(1) srch_fio_wait_1_reg (cclk, reset, srch_fio_wait, srch_fio_wait_1); | |
714 | dffr #(1) srch_fio_wait_2_reg (cclk, reset, srch_fio_wait_1, srch_fio_wait_2); | |
715 | dffr #(1) srch_fio_wait_3_reg (cclk, reset, srch_fio_wait_2, srch_fio_wait_3); | |
716 | dffr #(1) srch_fio_wait_4_reg (cclk, reset, srch_fio_wait_3, srch_fio_wait_4); | |
717 | dffr #(1) srch_fio_wait_5_reg (cclk, reset, srch_fio_wait_4, srch_fio_wait_5); | |
718 | dffr #(1) srch_fio_wait_6_reg (cclk, reset, srch_fio_wait_5, srch_fio_wait_6); | |
719 | ||
720 | dffr #(1) srch_fio_rd_en_1_reg (cclk, reset, srch_fio_rd_en, srch_fio_rd_en_1); | |
721 | dffr #(1) srch_fio_rd_en_2_reg (cclk, reset, srch_fio_rd_en_1, srch_fio_rd_en_2); | |
722 | dffr #(1) srch_fio_rd_en_3_reg (cclk, reset, srch_fio_rd_en_2, srch_fio_rd_en_3); | |
723 | dffr #(1) srch_fio_rd_en_4_reg (cclk, reset, srch_fio_rd_en_3, srch_fio_rd_en_4); | |
724 | dffr #(1) srch_fio_rd_en_5_reg (cclk, reset, srch_fio_rd_en_4, srch_fio_rd_en_5); | |
725 | dffr #(1) srch_fio_rd_en_6_reg (cclk, reset, srch_fio_rd_en_5, srch_fio_rd_en_6); | |
726 | dffr #(1) srch_fio_rd_en_7_reg (cclk, reset, srch_fio_rd_en_6, srch_fio_rd_en_7); | |
727 | dffr #(1) srch_fio_rd_en_8_reg (cclk, reset, srch_fio_rd_en_7, srch_fio_rd_en_8); | |
728 | dffr #(1) srch_fio_rd_en_p_reg (cclk, reset, srch_fio_rd_en_tmp, srch_fio_rd_en_p); | |
729 | ||
730 | dffr #(1) fcram_ds_reg (cclk, reset, fcram_ds_sm, fcram_ds); | |
731 | dffr #(1) fcram_ds_1_reg (cclk, reset, fcram_ds, fcram_ds_1); | |
732 | dffr #(1) fcram_ds_2_reg (cclk, reset, fcram_ds_1, fcram_ds_2); | |
733 | dffr #(1) fcram_ds_3_reg (cclk, reset, fcram_ds_2, fcram_ds_3); | |
734 | dffr #(1) fcram_ds_4_reg (cclk, reset, fcram_ds_3, fcram_ds_4); | |
735 | dffr #(1) fcram_ds_5_reg (cclk, reset, fcram_ds_4, fcram_ds_5); | |
736 | dffr #(2) fcram_ds_6_reg (cclk, reset, {2{fcram_ds_5}}, fflp_fcram_ds); | |
737 | ||
738 | assign fflp_fcram_triz_en_l = ~fflp_fcram_ds; | |
739 | ||
740 | fflp_fcram_cntl_sm fflp_fcram_cntl_sm_inst ( | |
741 | .cclk (cclk), | |
742 | .reset (reset), | |
743 | .fflp_init_done (fflp_init_done), | |
744 | .fio_mstr_ready (fio_mstr_ready), | |
745 | .fcram_refresh_timer_reg_dout (fcram_refresh_timer_reg_dout), | |
746 | .do_srch_cycle (do_srch_cycle), | |
747 | .do_cpu_cycle (do_cpu_cycle), | |
748 | .cpu_cmd (cpu_cmd), | |
749 | .cpu_bk0 (cpu_bk0), | |
750 | .cpu_bk1 (cpu_bk1), | |
751 | ||
752 | .fcram_cmd_sm (fcram_cmd_sm), | |
753 | .fcram_ba0_sm (fcram_ba0_sm), | |
754 | .fcram_ba1_sm (fcram_ba1_sm), | |
755 | .fcram_addr_sel (fcram_addr_sel), | |
756 | .fcram_addr_en (fcram_addr_en), | |
757 | .fcram_ds_sm (fcram_ds_sm), | |
758 | .fflp_fcram_slv_update (fflp_fcram_slv_update), | |
759 | .srch_burst_done_sm (srch_burst_done_sm), | |
760 | .cpu_burst_done_sm (cpu_burst_done_sm), | |
761 | .power_on_wait_cnt_done_r (power_on_wait_cnt_done_r), | |
762 | .fcram_sm_state (fcram_sm_state) | |
763 | ||
764 | ); | |
765 | ||
766 | ||
767 | dffr #(64) cpu_fc_data_r_reg (cclk, reset, cpu_fc_data, cpu_fc_data_r); | |
768 | dffr #(72) ecc_chk_cpu_fc_data_reg (cclk, reset, ecc_check_cpu_fc_data, ecc_check_cpu_fc_data_r); | |
769 | assign cpu_fc_data_in = {ecc_check_cpu_fc_data_r[7:0], ecc_check_cpu_fc_data_r[71:8]} ^ fcram_err_test_reg_dout[71:0]; | |
770 | ||
771 | niu_64data_ecc_generate niu_64data_ecc_generate_inst0 ( | |
772 | .din (cpu_fc_data_r), | |
773 | .dout (ecc_check_cpu_fc_data) | |
774 | ||
775 | ); | |
776 | ||
777 | niu_64data_ecc_check niu_64data_ecc_check_inst0 ( | |
778 | .din ({fc_din_reg_dout[63:0], fc_din_reg_dout[71:64]}), | |
779 | .dout (fc_din_reg_dout_tmp), | |
780 | .no_error (ecc_no_error), | |
781 | .error (ecc_error), | |
782 | .corr_error (ecc_corr_error), | |
783 | .uncorr_error (ecc_check_err) | |
784 | ||
785 | ); | |
786 | ||
787 | wire ecc_check_err_in = ecc_check_err & !disable_chksum; //din_en_12 | |
788 | wire ecc_corr_err_in = ecc_corr_error & !disable_chksum; | |
789 | wire[71:0] fc_din_reg_dout_tmp1 = {fc_din_reg_dout[71:64], fc_din_reg_dout_tmp[71:8]}; | |
790 | ||
791 | dffr #(72) fc_din_reg_dout_r_reg (cclk, reset, fc_din_reg_dout_tmp1, fc_din_reg_dout_r); //enable by din_en_12 | |
792 | dffr #(1) ecc_err_reg (cclk, reset, ecc_check_err_in, ecc_check_err_r); | |
793 | dffr #(1) ecc_corr_err_reg (cclk, reset, ecc_corr_err_in, ecc_corr_err_r); | |
794 | ||
795 | assign ecc_check_err_all = ecc_check_err_r | ecc_corr_err_r; | |
796 | ||
797 | ||
798 | /*************************/ | |
799 | //FIO Parallel Interface | |
800 | /*************************/ | |
801 | assign cpu_fio_req_sync_p = cpu_fio_req_sync & !cpu_fio_req_sync_r; | |
802 | assign fcram_cfg_sel_in = cpu_fio_req_sync_p ? 1'b1 : | |
803 | fcram_cfg_done ? 1'b0 : fflp_fcram_cfg_sel; | |
804 | ||
805 | assign fcram_cfg_done_p = fcram_cfg_done | fcram_cfg_done_r | fcram_cfg_done_r1; | |
806 | assign fflp_fcram_cfg_addr = fio_cfg_addr_reg_dout[7:0]; | |
807 | assign fflp_fcram_cfg_datwr = pio_wr_data[15:0]; | |
808 | assign fflp_fcram_cfg_rd = pio_rd; | |
809 | assign fflp_fcram_cfg_rst = pio_fio_cfg_reset; | |
810 | ||
811 | ||
812 | dffr #(1) cpu_fio_req_sync_r_reg (cclk, reset, cpu_fio_req_sync, cpu_fio_req_sync_r); | |
813 | dffr #(1) fflp_fcram_cfg_sel_reg (cclk, reset, fcram_cfg_sel_in, fflp_fcram_cfg_sel); | |
814 | dffr #(1) fcram_cfg_done_reg (cclk, reset, fcram_fflp_cfg_done, fcram_cfg_done); | |
815 | dffr #(1) fcram_cfg_err_reg (cclk, reset, fcram_fflp_cfg_err, fcram_cfg_err); | |
816 | dffr #(1) fcram_cfg_done_r_reg (cclk, reset, fcram_cfg_done, fcram_cfg_done_r); | |
817 | dffr #(1) fcram_cfg_done_r1_reg (cclk, reset, fcram_cfg_done_r, fcram_cfg_done_r1); | |
818 | dffr #(1) cpu_fio_req_done_reg (cclk, reset, fcram_cfg_done_p, cpu_fio_req_done); | |
819 | dffr #(16) fcram_cfg_datrd_reg (cclk, reset, fcram_fflp_cfg_datrd, fcram_cfg_datrd); | |
820 | ||
821 | assign cpu_fio_rd_data_tmp = fcram_cfg_err ? 32'hdeadbeef : {16'b0, fcram_cfg_datrd[15:0]}; | |
822 | ||
823 | dffre #(32) cpu_fio_rd_data_reg (cclk, reset, fcram_cfg_done, cpu_fio_rd_data_tmp, cpu_fio_rd_data); | |
824 | ||
825 | /***********************/ | |
826 | //Calculate fio latecy | |
827 | /***********************/ | |
828 | assign fflp_data_ready_p = (&fio_data_ready) & !fflp_data_ready; | |
829 | ||
830 | dffr #(1) fflp_data_ready_reg (cclk, reset, (&fio_data_ready), fflp_data_ready); | |
831 | ||
832 | assign cpu_rd_latency0 = fflp_data_ready_p & cpu_burst_done_12; //00 | |
833 | assign cpu_rd_latency1 = fflp_data_ready_p & cpu_burst_done_13; | |
834 | assign cpu_rd_latency2 = fflp_data_ready_p & cpu_burst_done_14; | |
835 | assign cpu_rd_latency3 = fflp_data_ready_p & cpu_burst_done_15; | |
836 | assign cpu_rd_latency4 = fflp_data_ready_p & cpu_burst_done_16; | |
837 | assign cpu_rd_latency5 = fflp_data_ready_p & cpu_burst_done_17; //01 | |
838 | assign cpu_rd_latency6 = fflp_data_ready_p & cpu_burst_done_18; //10 | |
839 | assign cpu_rd_latency7 = fflp_data_ready_p & cpu_burst_done_19; //11 | |
840 | ||
841 | assign cpu_rd_latency_array = {cpu_rd_latency7, cpu_rd_latency6, cpu_rd_latency5, cpu_rd_latency4, | |
842 | cpu_rd_latency3, cpu_rd_latency2, cpu_rd_latency1, cpu_rd_latency0}; | |
843 | ||
844 | dffre #(8) cpu_rd_latency_reg (cclk, reset, fflp_data_ready_p, cpu_rd_latency_array, fio_cal_rd_latency); | |
845 | ||
846 | endmodule |