Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: dmu_ilu_iil.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_ilu_iil ( | |
36 | clk, | |
37 | rst_l, | |
38 | ||
39 | p2d_ihb_wptr, | |
40 | d2p_ihb_addr, | |
41 | p2d_ihb_data, | |
42 | p2d_ihb_dpar, | |
43 | d2p_ihb_rd, | |
44 | ||
45 | d2p_ibc_req, | |
46 | d2p_ibc_nhc, | |
47 | d2p_ibc_phc, | |
48 | d2p_ibc_pdc, | |
49 | p2d_ibc_ack, | |
50 | ||
51 | d2p_idb_addr, | |
52 | p2d_idb_data, | |
53 | p2d_idb_dpar, | |
54 | ||
55 | p2d_cto_req, | |
56 | p2d_cto_tag, | |
57 | d2p_cto_ack, | |
58 | ||
59 | y2k_rcd, | |
60 | y2k_rcd_enq, | |
61 | k2y_rcd_deq, | |
62 | ||
63 | k2y_rel_rcd, | |
64 | k2y_rel_enq, | |
65 | ||
66 | k2y_buf_addr, | |
67 | y2k_buf_data, | |
68 | y2k_buf_dpar, | |
69 | ||
70 | cib2iil_ihb_pe_drain, // caused by iil2cib_ihb_pe | |
71 | cib2iil_pec_drain, // caused by p2d_drain | |
72 | iil2cib_ihb_pe, | |
73 | iil2isb_clr, | |
74 | iil2isb_tag, | |
75 | isb2iil_vld, | |
76 | isb2iil_low_addr, | |
77 | ||
78 | // debug | |
79 | low_dbg_sel_a, | |
80 | low_dbg_sel_b, | |
81 | iil_dbg_a, | |
82 | iil_dbg_b, | |
83 | ||
84 | // idle check | |
85 | iil_is_idle, | |
86 | ilu_is_idle ); | |
87 | ||
88 | //synopsys sync_set_reset "rst_l" | |
89 | ||
90 | // >>>>>>>>>>>>>>>>>>>>>>>>> Port Declarations <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |
91 | ||
92 | //--------------------------------------------------------------------- | |
93 | // Clock and Reset Signals | |
94 | //--------------------------------------------------------------------- | |
95 | input clk; // input clock | |
96 | input rst_l; // input reset | |
97 | ||
98 | //--------------------------------------------------------------------- | |
99 | // IHB and IHB management interface | |
100 | //--------------------------------------------------------------------- | |
101 | input [6:0] p2d_ihb_wptr; // grey-coded IHB write pointer | |
102 | input [`FIRE_IHB_REC_WDTH-1:0] p2d_ihb_data; // TLP header record | |
103 | output [5:0] d2p_ihb_addr; // binary read pointer to IHB | |
104 | input [3:0] p2d_ihb_dpar; // TLP header record parity | |
105 | output d2p_ihb_rd; // read enable to peu ihb ram, requested | |
106 | // by n2 ram designers | |
107 | //--------------------------------------------------------------------- | |
108 | // IDB interface | |
109 | //--------------------------------------------------------------------- | |
110 | output [7:0] d2p_idb_addr; // binary read pointer to IDB | |
111 | input [127:0] p2d_idb_data; // 16-byte data | |
112 | input [3:0] p2d_idb_dpar; // data parity | |
113 | ||
114 | //--------------------------------------------------------------------- | |
115 | // PCIE FC credits interface to TLU | |
116 | //--------------------------------------------------------------------- | |
117 | output d2p_ibc_req; // request for ingress buffer credits | |
118 | input p2d_ibc_ack; // ack for ingress buffer credits | |
119 | output [7:0] d2p_ibc_nhc; // PCIE FC NPH credits | |
120 | output [7:0] d2p_ibc_phc; // PCIE FC PH credits | |
121 | output [11:0] d2p_ibc_pdc; // PCIE FC PD credits | |
122 | ||
123 | //--------------------------------------------------------------------- | |
124 | // cto interface - PIO completion time out | |
125 | //--------------------------------------------------------------------- | |
126 | input p2d_cto_req; // cto request from TLU | |
127 | input [4:0] p2d_cto_tag; // cto tag | |
128 | output d2p_cto_ack; // cto ack back | |
129 | ||
130 | //--------------------------------------------------------------------- | |
131 | // data path interface to TMU | |
132 | //--------------------------------------------------------------------- | |
133 | input [7:0] k2y_buf_addr; // read pointer to IDB | |
134 | output [127:0] y2k_buf_data; // 16-byte data | |
135 | output [3:0] y2k_buf_dpar; // data parity | |
136 | ||
137 | //--------------------------------------------------------------------- | |
138 | // record interface to TMU | |
139 | //--------------------------------------------------------------------- | |
140 | input k2y_rcd_deq; // record fifo dequeue | |
141 | output [`FIRE_DLC_IPE_REC_WDTH-1:0] y2k_rcd; // ingress PEC record | |
142 | output y2k_rcd_enq; // ingress PEC record enqueue | |
143 | ||
144 | //--------------------------------------------------------------------- | |
145 | // DMA MWr buffer release interface from TMU | |
146 | //--------------------------------------------------------------------- | |
147 | input [8:0] k2y_rel_rcd; // release rcd | |
148 | input k2y_rel_enq; // enqueue for release record | |
149 | ||
150 | //--------------------------------------------------------------------- | |
151 | // sub-block to sub-block interface | |
152 | //--------------------------------------------------------------------- | |
153 | input cib2iil_ihb_pe_drain; // caused by iil2cib_ihb_pe | |
154 | input cib2iil_pec_drain; // caused by p2d_drain | |
155 | // input cib2iil_drain; // drain signal from sub-block CIB | |
156 | output iil2cib_ihb_pe; // ingress header parity error | |
157 | output iil2isb_clr; | |
158 | output [4:0] iil2isb_tag; | |
159 | input isb2iil_vld; | |
160 | input [3:2] isb2iil_low_addr; | |
161 | ||
162 | //------------------------------------------------------------------------ | |
163 | // clocks to IHB, IDB | |
164 | //------------------------------------------------------------------------ | |
165 | ||
166 | //------------------------------------------------------------------------ | |
167 | // debug | |
168 | //------------------------------------------------------------------------ | |
169 | input [2:0] low_dbg_sel_a; | |
170 | input [2:0] low_dbg_sel_b; | |
171 | output [`FIRE_DBG_DATA_BITS] iil_dbg_a; | |
172 | output [`FIRE_DBG_DATA_BITS] iil_dbg_b; | |
173 | ||
174 | //------------------------------------------------------------------------ | |
175 | // idle check | |
176 | //------------------------------------------------------------------------ | |
177 | output iil_is_idle; | |
178 | input ilu_is_idle; | |
179 | ||
180 | // >>>>>>>>>>>>>>>>>>>>>>>>> Data Type Declarations <<<<<<<<<<<<<<<<<<<<<<<<< | |
181 | ||
182 | // ~~~~~~~~~~~~~~~~~~~~~~~~~ REGISTER - FLOPS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
183 | reg [`FIRE_DBG_DATA_BITS] dbg_bus [0:1]; | |
184 | ||
185 | // ~~~~~~~~~~~~~~~~~~~~~~~~~ REGISTER - NON-FLOPS ~~~~~~~~~~~~~~~~~~~~~~~~ | |
186 | ||
187 | reg [`FIRE_DBG_DATA_BITS] nxt_dbg_bus [0:1]; | |
188 | reg [2:0] dbg_sel [0:1]; | |
189 | ||
190 | integer j; | |
191 | ||
192 | // ~~~~~~~~~~~~~~~~~~~~~~~~~ NETS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
193 | ||
194 | //--------------------------------------------------------------------- | |
195 | // outputs from *_bufmgr.v | |
196 | // -------------------------------------------------------------------- | |
197 | wire ihb_empty; | |
198 | wire [6:0] ihb_rptr; // for debug port only | |
199 | wire [6:0] ihb_wptr; // for debug port only | |
200 | ||
201 | //--------------------------------------------------------------------- | |
202 | // outputs from *_parchk.v | |
203 | // -------------------------------------------------------------------- | |
204 | wire iil2cib_ihb_pe; | |
205 | ||
206 | //--------------------------------------------------------------------- | |
207 | // outputs from *_rcdbldr.v | |
208 | // -------------------------------------------------------------------- | |
209 | wire ihb_rcd_is_cpl; | |
210 | wire [1:0] credit_type; | |
211 | wire [`FIRE_IHB_REC_WDTH-1:0] in_ihb_rcd; | |
212 | ||
213 | //--------------------------------------------------------------------- | |
214 | // outputs from *_xfrfsm.v | |
215 | // -------------------------------------------------------------------- | |
216 | wire ihb_rptr_inc; | |
217 | wire is_ihb_rcd; | |
218 | wire is_cto_rcd; | |
219 | wire [4:0] pio_tag_gen; | |
220 | wire [4:0] state; // for debug port only | |
221 | wire is_fifo_space; // for debug port only | |
222 | wire drop_inserted_rcd; // for debug port only | |
223 | wire n_cto_req_reg; // for debug port only, sync version of p2d_cto_req | |
224 | ||
225 | // >>>>>>>>>>>>>>>>>>>>>>>>> Zero In Checkers <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |
226 | ||
227 | // 0in custom -fire ihb_rptr_inc -active cib2iil_ihb_pe_drain | |
228 | ||
229 | // 0in constant -var d2p_ihb_addr -active cib2iil_ihb_pe_drain | |
230 | ||
231 | // >>>>>>>>>>>>>>>>>>>>>>>>> RTL/Behavioral Model <<<<<<<<<<<<<<<<<<<<<<<<<<< | |
232 | ||
233 | //--------------------------------------------------------------------- | |
234 | // debug | |
235 | //--------------------------------------------------------------------- | |
236 | ||
237 | always @ (low_dbg_sel_a or low_dbg_sel_b) begin | |
238 | dbg_sel[0] = low_dbg_sel_a; | |
239 | dbg_sel[1] = low_dbg_sel_b; | |
240 | end | |
241 | ||
242 | always @ (dbg_sel[0] or dbg_sel[1] or | |
243 | n_cto_req_reg or // synchronized version of p2d_cto_req | |
244 | d2p_cto_ack or | |
245 | d2p_ihb_addr or | |
246 | d2p_ibc_nhc or | |
247 | d2p_ibc_phc or | |
248 | y2k_rcd_enq or | |
249 | k2y_rcd_deq or | |
250 | k2y_rel_enq or | |
251 | k2y_rel_rcd[8] or | |
252 | cib2iil_ihb_pe_drain or | |
253 | cib2iil_pec_drain or | |
254 | iil2cib_ihb_pe or | |
255 | isb2iil_vld or | |
256 | iil2isb_clr or | |
257 | ilu_is_idle or | |
258 | ihb_empty or | |
259 | ihb_rcd_is_cpl or | |
260 | credit_type or | |
261 | ihb_rptr_inc or | |
262 | is_ihb_rcd or | |
263 | is_cto_rcd or | |
264 | state or | |
265 | is_fifo_space or | |
266 | drop_inserted_rcd or | |
267 | ihb_rptr or | |
268 | ihb_wptr ) begin : dbg_case | |
269 | integer i; | |
270 | for (i = 0; i < 2; i = i + 1) begin | |
271 | case (dbg_sel[i]) // synopsys infer_mux | |
272 | 3'b000: nxt_dbg_bus[i] = {state, is_fifo_space, cib2iil_ihb_pe_drain, cib2iil_pec_drain}; | |
273 | 3'b001: nxt_dbg_bus[i] = {n_cto_req_reg, d2p_cto_ack, ihb_empty, ihb_rptr_inc, | |
274 | credit_type, k2y_rel_enq, k2y_rel_rcd[8]}; | |
275 | 3'b010: nxt_dbg_bus[i] = {ilu_is_idle, ihb_rptr}; | |
276 | 3'b011: nxt_dbg_bus[i] = {1'b0, ihb_wptr}; | |
277 | 3'b100: nxt_dbg_bus[i] = {1'b0, is_ihb_rcd, is_cto_rcd, ihb_rcd_is_cpl, | |
278 | drop_inserted_rcd, iil2cib_ihb_pe, isb2iil_vld, iil2isb_clr}; | |
279 | 3'b101: nxt_dbg_bus[i] = {y2k_rcd_enq, k2y_rcd_deq, d2p_ihb_addr}; | |
280 | 3'b110: nxt_dbg_bus[i] = d2p_ibc_nhc; | |
281 | 3'b111: nxt_dbg_bus[i] = d2p_ibc_phc; | |
282 | endcase | |
283 | end | |
284 | end | |
285 | ||
286 | assign iil_dbg_a = dbg_bus[0]; | |
287 | assign iil_dbg_b = dbg_bus[1]; | |
288 | ||
289 | always @ (posedge clk) | |
290 | if(~rst_l) begin : dbg_rst | |
291 | integer i; | |
292 | for (i = 0; i < 2; i = i + 1) begin | |
293 | dbg_bus[i] <= {8{1'b0}}; | |
294 | end | |
295 | end | |
296 | else begin | |
297 | for (j = 0; j < 2; j = j + 1) begin | |
298 | dbg_bus[j] <= nxt_dbg_bus[j]; | |
299 | end | |
300 | end | |
301 | ||
302 | //--------------------------------------------------------------------- | |
303 | // clocks to IHB, IDB | |
304 | //--------------------------------------------------------------------- | |
305 | ||
306 | //--------------------------------------------------------------------- | |
307 | // data path feed through | |
308 | //--------------------------------------------------------------------- | |
309 | assign d2p_idb_addr = k2y_buf_addr; | |
310 | assign y2k_buf_data = p2d_idb_data; | |
311 | assign y2k_buf_dpar = p2d_idb_dpar; | |
312 | ||
313 | //BP 3-28-05 | |
314 | assign d2p_ihb_rd = ~ihb_empty & rst_l; | |
315 | ||
316 | // >>>>>>>>>>>>>>>>>>>>>>>>> Instantiations <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |
317 | ||
318 | //sun_buff_clk d2p_idb_clk_buf | |
319 | // ( .a (clk), | |
320 | // .z (d2p_idb_clk) ); | |
321 | ||
322 | //sun_buff_clk d2p_ihb_clk_buf | |
323 | // ( .a (clk), | |
324 | // .z (d2p_ihb_clk) ); | |
325 | ||
326 | dmu_ilu_iil_bufmgr bufmgr | |
327 | ( .clk (clk), | |
328 | .rst_l (rst_l), | |
329 | .p2d_ihb_wptr (p2d_ihb_wptr), | |
330 | .d2p_ihb_addr (d2p_ihb_addr), | |
331 | .ihb_rptr_inc (ihb_rptr_inc), | |
332 | .ihb_empty (ihb_empty), | |
333 | .ihb_rptr (ihb_rptr), | |
334 | .ihb_wptr (ihb_wptr) ); | |
335 | ||
336 | ||
337 | dmu_ilu_iil_crdtcnt crdtcnt | |
338 | ( .clk (clk), | |
339 | .rst_l (rst_l), | |
340 | .cib2iil_pec_drain (cib2iil_pec_drain), | |
341 | .k2y_rel_rcd (k2y_rel_rcd), | |
342 | .k2y_rel_enq (k2y_rel_enq), | |
343 | .d2p_ibc_req (d2p_ibc_req), | |
344 | .d2p_ibc_nhc (d2p_ibc_nhc), | |
345 | .d2p_ibc_phc (d2p_ibc_phc), | |
346 | .d2p_ibc_pdc (d2p_ibc_pdc), | |
347 | .p2d_ibc_ack (p2d_ibc_ack), | |
348 | .is_ihb_rcd (is_ihb_rcd), | |
349 | .credit_type (credit_type) ); | |
350 | ||
351 | dmu_ilu_iil_parchk parchk | |
352 | ( .clk (clk), | |
353 | .rst_l (rst_l), | |
354 | .p2d_ihb_dpar (p2d_ihb_dpar), | |
355 | .is_ihb_rcd (is_ihb_rcd), | |
356 | .iil2cib_ihb_pe (iil2cib_ihb_pe), | |
357 | .in_ihb_rcd (in_ihb_rcd)); | |
358 | ||
359 | dmu_ilu_iil_rcdbldr rcdbldr | |
360 | ( .clk (clk), | |
361 | .rst_l (rst_l), | |
362 | .p2d_ihb_data (p2d_ihb_data), | |
363 | .y2k_rcd (y2k_rcd), | |
364 | .iil2isb_tag (iil2isb_tag), | |
365 | .isb2iil_low_addr (isb2iil_low_addr), | |
366 | .ihb_rcd_is_cpl (ihb_rcd_is_cpl), | |
367 | .credit_type (credit_type), | |
368 | .is_ihb_rcd (is_ihb_rcd), | |
369 | .is_cto_rcd (is_cto_rcd), | |
370 | .pio_tag_gen (pio_tag_gen), | |
371 | .in_ihb_rcd (in_ihb_rcd)); | |
372 | ||
373 | dmu_ilu_iil_xfrfsm xfrfsm | |
374 | ( .clk (clk), | |
375 | .rst_l (rst_l), | |
376 | .p2d_cto_req (p2d_cto_req), | |
377 | .p2d_cto_tag (p2d_cto_tag), | |
378 | .d2p_cto_ack (d2p_cto_ack), | |
379 | .n_cto_req_reg (n_cto_req_reg), | |
380 | .cib2iil_ihb_pe_drain (cib2iil_ihb_pe_drain), | |
381 | .cib2iil_pec_drain (cib2iil_pec_drain), | |
382 | .iil2cib_ihb_pe (iil2cib_ihb_pe), | |
383 | .y2k_rcd_enq (y2k_rcd_enq), | |
384 | .k2y_rcd_deq (k2y_rcd_deq), | |
385 | .ihb_rcd_is_cpl (ihb_rcd_is_cpl), | |
386 | .iil2isb_clr (iil2isb_clr), | |
387 | .isb2iil_vld (isb2iil_vld), | |
388 | .is_ihb_rcd (is_ihb_rcd), | |
389 | .is_cto_rcd (is_cto_rcd), | |
390 | .pio_tag_gen (pio_tag_gen), | |
391 | .ihb_empty (ihb_empty), | |
392 | .ihb_rptr_inc (ihb_rptr_inc), | |
393 | .iil_is_idle (iil_is_idle), | |
394 | .state (state), | |
395 | .is_fifo_space (is_fifo_space), | |
396 | .drop_inserted_rcd (drop_inserted_rcd) ); | |
397 | ||
398 | endmodule // dmu_ilu_iil | |
399 |