Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: dmu_rmu_lrm.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_rmu_lrm ( | |
36 | clk, | |
37 | rst_l, | |
38 | ||
39 | // Inputs from TMU - DIM Record - Ingress Pipeline | |
40 | tm2rm_rcd, | |
41 | tm2rm_rcd_enq, | |
42 | ||
43 | // Output to TMU - DIM Record Queue Full | |
44 | rm2tm_rcd_full, | |
45 | ||
46 | // Outputs to IMU - Interrupt In Record for IMU Servicing | |
47 | rm2im_rcd, | |
48 | rm2im_rcd_enq, | |
49 | ||
50 | // Inputs from IMU - Interrupt Out Record for Ingress Pipeline | |
51 | im2rm_rcd, | |
52 | im2rm_rcd_enq, | |
53 | ||
54 | // Inputs from IMU (cont) - Mondo ReQuest Record | |
55 | im2rm_mdo, | |
56 | im2rm_mdo_enq, | |
57 | ||
58 | // TSB Interface - Ingress Pipeline | |
59 | rm2ts_i_cmd_type, | |
60 | rm2ts_i_wr_data, | |
61 | rm2ts_i_req, | |
62 | ||
63 | ts2rm_i_gnt, | |
64 | ts2rm_i_full, | |
65 | ts2rm_i_n_trn, | |
66 | ||
67 | // MMU Interface | |
68 | rm2mm_rcd, | |
69 | rm2mm_rcd_enq, | |
70 | mm2rm_rcd_full, | |
71 | ||
72 | // Output to RRM - PIO WR Release | |
73 | lrm2rrm_cpl, | |
74 | lrm2rrm_cpl_enq, | |
75 | ||
76 | // LRM Debug Ports - Inputs (Selects) | |
77 | dbg2lrm_dbg_sel_a, | |
78 | dbg2lrm_dbg_sel_b, | |
79 | ||
80 | // LRM Debug Ports - Onputs | |
81 | lrm2dbg_dbg_a, | |
82 | lrm2dbg_dbg_b | |
83 | ||
84 | ||
85 | ); | |
86 | ||
87 | // synopsys sync_set_reset "rst_l" | |
88 | ||
89 | ||
90 | //############################################################################ | |
91 | // PORT DECLARATIONS | |
92 | //############################################################################ | |
93 | ||
94 | //------------------------------------------------------------------------ | |
95 | // Clock and Reset Signals | |
96 | //------------------------------------------------------------------------ | |
97 | input clk; | |
98 | input rst_l; | |
99 | ||
100 | ||
101 | //------------------------------------------------------------------------ | |
102 | // TMU Interface | |
103 | //------------------------------------------------------------------------ | |
104 | ||
105 | // Ingress pipeline interface - DIM RECORD (DIM to LRM) | |
106 | input [`FIRE_DLC_DIM_REC_WDTH-1:0] tm2rm_rcd; | |
107 | input tm2rm_rcd_enq; | |
108 | output rm2tm_rcd_full; | |
109 | ||
110 | ||
111 | //------------------------------------------------------------------------ | |
112 | // IMU Interface | |
113 | //------------------------------------------------------------------------ | |
114 | ||
115 | // INTERRUPT IN Record for IMU servicing (LRM to IMU) | |
116 | output [`FIRE_DLC_IIN_REC_WDTH-1:0] rm2im_rcd; | |
117 | output rm2im_rcd_enq; | |
118 | ||
119 | // INTERRUPT OUT Record - record processed by IMU (IMU to LRM) | |
120 | input [`FIRE_DLC_IOT_REC_WDTH-1:0] im2rm_rcd; | |
121 | input im2rm_rcd_enq; | |
122 | ||
123 | // Mondo ReQuest Record (IMU to LRM) | |
124 | input [`FIRE_DLC_MQR_REC_WDTH-1:0] im2rm_mdo; | |
125 | input im2rm_mdo_enq; | |
126 | ||
127 | ||
128 | //------------------------------------------------------------------------ | |
129 | // TSB Interface | |
130 | //------------------------------------------------------------------------ | |
131 | ||
132 | // TSB interface (Ingress Pipeline) | |
133 | output [`FIRE_DLC_TSR_CMD_TYPE_WDTH-1:0] rm2ts_i_cmd_type; // 4 bit TSB Command | |
134 | output [`FIRE_DLC_TSR_WR_DATA_WDTH-1:0] rm2ts_i_wr_data; // 48 bit Write Data | |
135 | output rm2ts_i_req; | |
136 | ||
137 | input ts2rm_i_gnt; | |
138 | input ts2rm_i_full; | |
139 | input [`FIRE_DLC_TSR_TRN_WDTH-1:0] ts2rm_i_n_trn; // 5 bit TRN - Trans Scoreboard Tag | |
140 | ||
141 | ||
142 | //------------------------------------------------------------------------ | |
143 | // MMU Interface | |
144 | //------------------------------------------------------------------------ | |
145 | ||
146 | // Ingress pipeline interface - 116 bit SRM RECORD (LRM to MMU) | |
147 | output [`FIRE_DLC_SRM_WDTH-1:0] rm2mm_rcd; | |
148 | output rm2mm_rcd_enq; | |
149 | input mm2rm_rcd_full; | |
150 | ||
151 | ||
152 | //------------------------------------------------------------------------ | |
153 | // Sub-Block Interface to RRM | |
154 | //------------------------------------------------------------------------ | |
155 | ||
156 | // PIO Transaction Credit Recorda - 4 bits | |
157 | output [`FIRE_DLC_RMU_LRM_REL_WDTH-1:0] lrm2rrm_cpl; | |
158 | output lrm2rrm_cpl_enq; | |
159 | ||
160 | ||
161 | //------------------------------------------------------------------------ | |
162 | // Sub Block Level Selects and Output Ports | |
163 | //------------------------------------------------------------------------ | |
164 | ||
165 | input [2:0] dbg2lrm_dbg_sel_a; | |
166 | input [2:0] dbg2lrm_dbg_sel_b; | |
167 | ||
168 | output [`FIRE_DEBUG_WDTH-1:0] lrm2dbg_dbg_a; | |
169 | output [`FIRE_DEBUG_WDTH-1:0] lrm2dbg_dbg_b; | |
170 | ||
171 | ||
172 | //############################################################################ | |
173 | // PARAMETERS | |
174 | //############################################################################ | |
175 | ||
176 | ||
177 | //############################################################################ | |
178 | // SIGNAL DECLARATIONS | |
179 | //############################################################################ | |
180 | ||
181 | ||
182 | //************************************************** | |
183 | // Internal Sub-Block Wires | |
184 | //************************************************** | |
185 | ||
186 | wire [`FIRE_DLC_RMU_LRM_WDTH-1:0] std_rcd; // 131 bit Standard Rcd - from ictl to itsb_fsm | |
187 | wire std_rcd_enq; // STD rcd Enqueue signal | |
188 | wire std_rcd_deq; // STD Rcd Dequeue - credit manager signal | |
189 | ||
190 | wire [`FIRE_DLC_RMU_LRM_WDTH-1:0] lrm_rcd; // 131 bit LRM Rcd - from itsb_fsm to octl | |
191 | wire lrm_rcd_enq; // Enqueue signal from ictl to octl modules | |
192 | wire lrm_rcd_deq; // STD Rcd FIFO Dequeue - credit manager signal | |
193 | ||
194 | wire iot_rcd_deq; // LRM credit manager signal - balances IIN, IOT fifo's | |
195 | ||
196 | ||
197 | //------------------------------------------------------------------------ | |
198 | // Debug Port Wires | |
199 | //------------------------------------------------------------------------ | |
200 | ||
201 | // From ictl module | |
202 | wire [1:0] fork_type; // Ingress Trans Type Decoder | |
203 | wire sr_dim_deq; // Dequeue DIM record from SR FIFO | |
204 | wire sr_dim_empty; // Output from DIM SR FIFO | |
205 | wire iot_credit_ok; // LRM has credit for IOT Rcds | |
206 | wire ld_iin_mdo_reg; // Load IIN rcd from Mondo FIFO | |
207 | wire mdo_fifo_empty; // Output from Mondo ReQuest FIFO | |
208 | wire std_credit_ok; // Std Rcd FIFO has room | |
209 | ||
210 | // From itsb_fsm module | |
211 | wire [1:0] trans_type; // SR STD rcd trans type decoder | |
212 | wire sr_std_empty; // STD SR fifo is empty | |
213 | wire [4:0] itsb_state; // Ingress TSB 1-hot FSM | |
214 | wire lrm_credit_ok; // LRM Rcd FIFO has room | |
215 | wire [`FIRE_DLC_TSR_BYTECNT_WDTH:0] dma_rd_bcnt; // 13 bit bcnt calc [12:0] for dma_rd | |
216 | ||
217 | // From octl module | |
218 | wire sr_lrm_empty; // LRM Rcd FIFO empty signal | |
219 | wire sr_iot_empty; // LRM Rcd FIFO empty signal | |
220 | wire ttag_match_iot; // OK to forward IOT record to MMU | |
221 | wire ttag_match_lrm; // OK to forward LRM record to MMU | |
222 | ||
223 | // Internal LRM Idle check | |
224 | wire rmu_lrm_idle; // LRM sub-block is idle | |
225 | ||
226 | ||
227 | //************************************************** | |
228 | // Registers that Are Not Flops | |
229 | //************************************************** | |
230 | ||
231 | reg [`FIRE_DEBUG_WDTH-1:0] next_dbg_a; // 8 bit debug ports | |
232 | reg [`FIRE_DEBUG_WDTH-1:0] next_dbg_b; // 8 bit debup port | |
233 | ||
234 | ||
235 | //************************************************** | |
236 | // Registers that Are Flops | |
237 | //************************************************** | |
238 | ||
239 | reg [`FIRE_DEBUG_WDTH-1:0] dbg_a; // 8 bit debug reg | |
240 | reg [`FIRE_DEBUG_WDTH-1:0] dbg_b; // 8 bit debug reg | |
241 | ||
242 | ||
243 | //############################################################################ | |
244 | // ZERO IN CHECKERS | |
245 | //############################################################################ | |
246 | ||
247 | ||
248 | //############################################################################ | |
249 | // COMBINATIONAL LOGIC | |
250 | //############################################################################ | |
251 | ||
252 | //----------------------------------------------------- | |
253 | // Debug Ports | |
254 | //----------------------------------------------------- | |
255 | ||
256 | always @ (dbg2lrm_dbg_sel_a or fork_type or rm2tm_rcd_full or tm2rm_rcd_enq or sr_dim_deq or | |
257 | sr_dim_empty or iot_credit_ok or rm2im_rcd_enq or ld_iin_mdo_reg or im2rm_mdo_enq or | |
258 | lrm2rrm_cpl_enq or mdo_fifo_empty or std_credit_ok or std_rcd_enq or std_rcd_deq or | |
259 | trans_type or sr_std_empty or itsb_state or lrm_rcd_enq or lrm_credit_ok or rm2ts_i_req or | |
260 | ts2rm_i_gnt or ts2rm_i_full or ts2rm_i_n_trn or dma_rd_bcnt or im2rm_rcd_enq or sr_lrm_empty or | |
261 | ttag_match_lrm or sr_iot_empty or ttag_match_iot or rm2mm_rcd_enq or mm2rm_rcd_full or | |
262 | rmu_lrm_idle) | |
263 | ||
264 | begin | |
265 | case (dbg2lrm_dbg_sel_a) // synopsys infer_mux | |
266 | 3'b000: next_dbg_a = {1'b0, fork_type[1:0], rm2tm_rcd_full, tm2rm_rcd_enq, sr_dim_deq, sr_dim_empty, rmu_lrm_idle}; | |
267 | 3'b001: next_dbg_a = {2'b0, iot_credit_ok, rm2im_rcd_enq, ld_iin_mdo_reg, im2rm_mdo_enq, lrm2rrm_cpl_enq, mdo_fifo_empty}; | |
268 | 3'b010: next_dbg_a = {2'b0, std_credit_ok, std_rcd_enq, std_rcd_deq, trans_type[1:0], sr_std_empty} ; | |
269 | 3'b011: next_dbg_a = {1'b0, itsb_state[4:0], lrm_rcd_enq, lrm_credit_ok}; | |
270 | 3'b100: next_dbg_a = {rm2ts_i_req, ts2rm_i_gnt, ts2rm_i_full, ts2rm_i_n_trn[4:0]}; | |
271 | 3'b101: next_dbg_a = {rm2ts_i_req, dma_rd_bcnt[12:6]}; | |
272 | 3'b110: next_dbg_a = {rm2ts_i_req, ts2rm_i_gnt, dma_rd_bcnt[5:0]}; | |
273 | 3'b111: next_dbg_a = {lrm_rcd_enq, im2rm_rcd_enq, sr_lrm_empty, ttag_match_lrm, sr_iot_empty, ttag_match_iot, rm2mm_rcd_enq, mm2rm_rcd_full}; | |
274 | endcase | |
275 | end | |
276 | ||
277 | always @ (dbg2lrm_dbg_sel_b or fork_type or rm2tm_rcd_full or tm2rm_rcd_enq or sr_dim_deq or | |
278 | sr_dim_empty or iot_credit_ok or rm2im_rcd_enq or ld_iin_mdo_reg or im2rm_mdo_enq or | |
279 | lrm2rrm_cpl_enq or mdo_fifo_empty or std_credit_ok or std_rcd_enq or std_rcd_deq or | |
280 | trans_type or sr_std_empty or itsb_state or lrm_rcd_enq or lrm_credit_ok or rm2ts_i_req or | |
281 | ts2rm_i_gnt or ts2rm_i_full or ts2rm_i_n_trn or dma_rd_bcnt or im2rm_rcd_enq or sr_lrm_empty or | |
282 | ttag_match_lrm or sr_iot_empty or ttag_match_iot or rm2mm_rcd_enq or mm2rm_rcd_full or | |
283 | rmu_lrm_idle) | |
284 | begin | |
285 | case (dbg2lrm_dbg_sel_b) // synopsys infer_mux | |
286 | 3'b000: next_dbg_b = {1'b0, fork_type[1:0], rm2tm_rcd_full, tm2rm_rcd_enq, sr_dim_deq, sr_dim_empty, rmu_lrm_idle}; | |
287 | 3'b001: next_dbg_b = {2'b0, iot_credit_ok, rm2im_rcd_enq, ld_iin_mdo_reg, im2rm_mdo_enq, lrm2rrm_cpl_enq, mdo_fifo_empty}; | |
288 | 3'b010: next_dbg_b = {2'b0, std_credit_ok, std_rcd_enq, std_rcd_deq, trans_type[1:0], sr_std_empty} ; | |
289 | 3'b011: next_dbg_b = {1'b0, itsb_state[4:0], lrm_rcd_enq, lrm_credit_ok}; | |
290 | 3'b100: next_dbg_b = {rm2ts_i_req, ts2rm_i_gnt, ts2rm_i_full, ts2rm_i_n_trn[4:0]}; | |
291 | 3'b101: next_dbg_b = {rm2ts_i_req, dma_rd_bcnt[12:6]}; | |
292 | 3'b110: next_dbg_b = {rm2ts_i_req, ts2rm_i_gnt, dma_rd_bcnt[5:0]}; | |
293 | 3'b111: next_dbg_b = {lrm_rcd_enq, im2rm_rcd_enq, sr_lrm_empty, ttag_match_lrm, sr_iot_empty, ttag_match_iot, rm2mm_rcd_enq, mm2rm_rcd_full}; | |
294 | endcase | |
295 | end | |
296 | ||
297 | ||
298 | // LRM Debug Outputs | |
299 | assign lrm2dbg_dbg_a = dbg_a; | |
300 | assign lrm2dbg_dbg_b = dbg_b; | |
301 | ||
302 | ||
303 | //----------------------------------------------------- | |
304 | // IDLE Check Logic | |
305 | //----------------------------------------------------- | |
306 | ||
307 | assign rmu_lrm_idle = (sr_dim_empty & mdo_fifo_empty & sr_std_empty & sr_lrm_empty & sr_iot_empty) & | |
308 | (~|itsb_state[4:1] & itsb_state[0]); | |
309 | ||
310 | ||
311 | //############################################################################ | |
312 | // SEQUENTIAL LOGIC | |
313 | //############################################################################ | |
314 | ||
315 | // LRM debug registered outputs | |
316 | always @ (posedge clk) | |
317 | if(~rst_l) begin | |
318 | dbg_a <= {`FIRE_DEBUG_WDTH{1'b0}}; | |
319 | dbg_b <= {`FIRE_DEBUG_WDTH{1'b0}}; | |
320 | end | |
321 | else begin | |
322 | dbg_a <= next_dbg_a; | |
323 | dbg_b <= next_dbg_b; | |
324 | end | |
325 | ||
326 | ||
327 | //############################################################################ | |
328 | // MODULE INSTANTIATIONS | |
329 | //############################################################################ | |
330 | ||
331 | dmu_rmu_lrm_ictl lrm_ictl( | |
332 | ||
333 | .clk (clk), | |
334 | .rst_l (rst_l), | |
335 | ||
336 | // TMU Interface (DIM) - DIM Record | |
337 | .tm2rm_rcd (tm2rm_rcd), | |
338 | .tm2rm_rcd_enq (tm2rm_rcd_enq), | |
339 | .rm2tm_rcd_full (rm2tm_rcd_full), | |
340 | ||
341 | // Inputs from IMU - Mondo Request Record | |
342 | .im2rm_mdo (im2rm_mdo), | |
343 | .im2rm_mdo_enq (im2rm_mdo_enq), | |
344 | ||
345 | // Outputs to IMU - Interrupt In Record (RRM to IMU) | |
346 | .rm2im_rcd (rm2im_rcd), | |
347 | .rm2im_rcd_enq (rm2im_rcd_enq), | |
348 | ||
349 | // LRM Sub-block Interface to Ingress TSB FSM - STD rcd | |
350 | .std_rcd (std_rcd), | |
351 | .std_rcd_enq (std_rcd_enq), | |
352 | .std_rcd_deq (std_rcd_deq), | |
353 | ||
354 | // Input from IMU - used to flow control IIN rcds | |
355 | .iot_rcd_deq (iot_rcd_deq), | |
356 | ||
357 | // Output to RMU - PIO WR Release | |
358 | .lrm2rrm_cpl (lrm2rrm_cpl), | |
359 | .lrm2rrm_cpl_enq (lrm2rrm_cpl_enq), | |
360 | ||
361 | // Outputs (local) for Debug Visibility | |
362 | .fork_type (fork_type), | |
363 | .sr_dim_deq (sr_dim_deq), | |
364 | .sr_dim_empty (sr_dim_empty), | |
365 | .iot_credit_ok (iot_credit_ok), | |
366 | .ld_iin_mdo_reg (ld_iin_mdo_reg), | |
367 | .mdo_fifo_empty (mdo_fifo_empty), | |
368 | .std_credit_ok (std_credit_ok) | |
369 | ||
370 | ||
371 | ); | |
372 | ||
373 | ||
374 | dmu_rmu_lrm_itsb_fsm lrm_itsb_fsm( | |
375 | ||
376 | .clk (clk), | |
377 | .rst_l (rst_l), | |
378 | ||
379 | // TSB Interface - Ingress Pipeline | |
380 | .rm2ts_i_cmd_type (rm2ts_i_cmd_type), | |
381 | .rm2ts_i_wr_data (rm2ts_i_wr_data), | |
382 | .rm2ts_i_req (rm2ts_i_req), | |
383 | ||
384 | .ts2rm_i_gnt (ts2rm_i_gnt), | |
385 | .ts2rm_i_n_trn (ts2rm_i_n_trn), | |
386 | ||
387 | // Internal LRM Output Control Interface - lrm_octl - Outgoing LRM rcd | |
388 | .lrm_rcd (lrm_rcd), | |
389 | .lrm_rcd_enq (lrm_rcd_enq), | |
390 | .lrm_rcd_deq (lrm_rcd_deq), | |
391 | ||
392 | // Internal LRM Input Control Interface - lrm_ictl - Incoming STD rcd | |
393 | .std_rcd (std_rcd), | |
394 | .std_rcd_enq (std_rcd_enq), | |
395 | .std_rcd_deq (std_rcd_deq), | |
396 | ||
397 | // Outputs (local) for Debug Visibility | |
398 | .trans_type (trans_type), | |
399 | .sr_std_empty (sr_std_empty), | |
400 | .itsb_state (itsb_state), | |
401 | .lrm_credit_ok (lrm_credit_ok), | |
402 | .dma_rd_bcnt (dma_rd_bcnt) | |
403 | ||
404 | ); | |
405 | ||
406 | ||
407 | dmu_rmu_lrm_octl lrm_octl( | |
408 | ||
409 | .clk (clk), | |
410 | .rst_l (rst_l), | |
411 | ||
412 | // MMU Interface | |
413 | .rm2mm_rcd (rm2mm_rcd), | |
414 | .rm2mm_rcd_enq (rm2mm_rcd_enq), | |
415 | .mm2rm_rcd_full (mm2rm_rcd_full), | |
416 | ||
417 | // IMU interface - Interrupt Out Record (IOT) | |
418 | .im2rm_rcd (im2rm_rcd), | |
419 | .im2rm_rcd_enq (im2rm_rcd_enq), | |
420 | ||
421 | // Internal LRM Interface with lrm_itsb_fsm module | |
422 | .lrm_rcd (lrm_rcd), | |
423 | .lrm_rcd_enq (lrm_rcd_enq), | |
424 | .lrm_rcd_deq (lrm_rcd_deq), | |
425 | ||
426 | // Internal LRM Interface with lrm_ictl module | |
427 | .iot_rcd_deq (iot_rcd_deq), | |
428 | ||
429 | // Outputs (local) for Debug Visibility | |
430 | .sr_lrm_empty (sr_lrm_empty), | |
431 | .sr_iot_empty (sr_iot_empty), | |
432 | .ttag_match_iot (ttag_match_iot), | |
433 | .ttag_match_lrm (ttag_match_lrm) | |
434 | ||
435 | ); | |
436 | ||
437 | ||
438 | endmodule |