Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: dmu_rmu_rrm_erel.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_rrm_erel ( | |
36 | clk, | |
37 | rst_l, | |
38 | ||
39 | // Outputs to JBC Block - PIO credit release | |
40 | d2j_p_wrack_tag, | |
41 | d2j_p_wrack_vld, | |
42 | ||
43 | // Inputs from ILU (EIL) Block - Release Record for PIO Cpl/DMA Rd | |
44 | y2k_rel_rcd, | |
45 | y2k_rel_enq, | |
46 | ||
47 | // Outputs to CLU | |
48 | rm2cl_bufrel, | |
49 | rm2cl_bufrel_enq, | |
50 | ||
51 | // Internal sub-block Inputs - PIO Transaction Credit Record | |
52 | lrm2rrm_cpl, | |
53 | lrm2rrm_cpl_enq, | |
54 | ||
55 | // Outputs for idle port | |
56 | i_pio_rel_empty, | |
57 | e_pio_rel_empty, | |
58 | ||
59 | // Outputs for debug port visibility | |
60 | rel_state, | |
61 | ||
62 | // npwr wrack to crm | |
63 | rm2crm_npwr_wrack | |
64 | ); | |
65 | ||
66 | // synopsys sync_set_reset "rst_l" | |
67 | ||
68 | ||
69 | //############################################################################ | |
70 | // PORT DECLARATIONS | |
71 | //############################################################################ | |
72 | ||
73 | //------------------------------------------------------------------------ | |
74 | // Clock and Reset Signals | |
75 | //------------------------------------------------------------------------ | |
76 | input clk; | |
77 | input rst_l; | |
78 | ||
79 | ||
80 | //------------------------------------------------------------------------ | |
81 | // JBC Interface | |
82 | //------------------------------------------------------------------------ | |
83 | ||
84 | // Copy of original JBC PIO request tag - and corresponding valid signal | |
85 | // PIO credit release mechanism - 4 bit tag | |
86 | output [`FIRE_D2J_P_WRACK_WDTH-1:0] d2j_p_wrack_tag; | |
87 | output d2j_p_wrack_vld; | |
88 | ||
89 | ||
90 | //------------------------------------------------------------------------ | |
91 | // ILU Interface | |
92 | //------------------------------------------------------------------------ | |
93 | ||
94 | // 9 bit Downbound Release Rcd from EIL - (PIO Cpl and DMA Rd buffer release) | |
95 | input [`FIRE_DLC_DRR_REC_WDTH-1:0] y2k_rel_rcd; | |
96 | input y2k_rel_enq; | |
97 | ||
98 | ||
99 | //------------------------------------------------------------------------ | |
100 | // CLU Interface | |
101 | //------------------------------------------------------------------------ | |
102 | ||
103 | // DMA Rd Buffer Release Record - 5 bit DOU Buffer Release | |
104 | output [`FIRE_DLC_DOU_REL_WDTH-1:0] rm2cl_bufrel; | |
105 | output rm2cl_bufrel_enq; | |
106 | ||
107 | //------------------------------------------------------------------------ | |
108 | // Sub-block Interface to SRM | |
109 | //------------------------------------------------------------------------ | |
110 | ||
111 | // 4 bit (non-posted) PIO Transaction Credit Record | |
112 | input [`FIRE_DLC_RMU_LRM_REL_WDTH-1:0] lrm2rrm_cpl; | |
113 | input lrm2rrm_cpl_enq; | |
114 | ||
115 | ||
116 | //------------------------------------------------------------------------ | |
117 | // Outputs (local) for Idle check Debug Port Visibility | |
118 | //------------------------------------------------------------------------ | |
119 | ||
120 | output e_pio_rel_empty; | |
121 | output i_pio_rel_empty; | |
122 | ||
123 | output [1:0] rel_state; // Simple Dequeue-Priority FSM | |
124 | ||
125 | output rm2crm_npwr_wrack; | |
126 | ||
127 | //############################################################################ | |
128 | // PARAMETERS | |
129 | //############################################################################ | |
130 | ||
131 | // Simple State Machine for DeQueuing Ingress or Egress Release FIFO's | |
132 | parameter | |
133 | NUM_STATES = 2; | |
134 | ||
135 | parameter | |
136 | E_PRIORITY = 0, // State Machine Parameter | |
137 | I_PRIORITY = 1; // Dequeue/Priority FSM | |
138 | ||
139 | ||
140 | // PIO Release Rcd FIFO paramaters | |
141 | parameter | |
142 | REL_WDTH = `FIRE_D2J_P_WRACK_WDTH, // 4 bit tag | |
143 | REL_DPTH = 4'd15, // Max Cr - 1 | |
144 | REL_PTR_WDTH = 4, // 3'b000-3'b111 | |
145 | REL_DPTH_MINUSONE = 4'd14; // Depth - 1 | |
146 | ||
147 | ||
148 | //############################################################################ | |
149 | // SIGNAL DECLARATIONS | |
150 | //############################################################################ | |
151 | ||
152 | ||
153 | //************************************************** | |
154 | // Internal Sub-Block Wires | |
155 | //************************************************** | |
156 | ||
157 | wire [`FIRE_DLC_DOU_REL_WDTH-1:0] next_rm2cl_bufrel; // 5 bit DMA Rd Buf Release | |
158 | wire next_rm2cl_bufrel_enq; | |
159 | ||
160 | wire [3:0] e_pio_rel; // Posted PIOW Release In | |
161 | wire e_pio_rel_enq; // Write FIFO | |
162 | wire e_pio_rel_empty; // FIFO Empty | |
163 | ||
164 | wire [3:0] e_pio_rel_dout; // Posted PIOW Release Out | |
165 | ||
166 | // wire [3:0] i_pio_rel; // Non Posted PIO Release In | |
167 | // wire i_pio_rel_enq; | |
168 | // | |
169 | // Note: Above (2) signals come directly from SRM sub block - lrm2rrm_cpl, lrm2rrm_cpl_enq | |
170 | // - and although they are inputs to the i_pio_rel fifo - I'm not remaning inputs | |
171 | ||
172 | wire i_pio_rel_empty; // FIFO Empty | |
173 | wire [3:0] i_pio_rel_dout; // Non Posted PIO Rel Out | |
174 | ||
175 | ||
176 | wire [`FIRE_D2J_P_WRACK_WDTH-1:0] next_d2j_p_wrack_tag; // 4 bit PIO Credit Release | |
177 | wire next_d2j_p_wrack_vld; // Valid bit for Credit Release | |
178 | ||
179 | //************************************************** | |
180 | // Registers that Are Not Flops | |
181 | //************************************************** | |
182 | ||
183 | reg ld_e_pio_rel; // Dequeue Posted PIO Wr Rel | |
184 | // - from Egress Rel path fifo | |
185 | reg ld_i_pio_rel; // Dequeue Non Posted Wr Rel | |
186 | // - Ingress Rel path fifo | |
187 | ||
188 | ||
189 | //************************************************** | |
190 | // Registers that Are Flops | |
191 | //************************************************** | |
192 | ||
193 | reg [4:0] rm2cl_bufrel; // DMA Rd Buffer Release | |
194 | reg rm2cl_bufrel_enq; // - registered outputs | |
195 | ||
196 | reg [`FIRE_D2J_P_WRACK_WDTH-1:0] d2j_p_wrack_tag; // 4 bit PIO Credit Release | |
197 | reg d2j_p_wrack_vld; // Valid bit for Credit Release | |
198 | ||
199 | reg [NUM_STATES-1:0] rel_state, // Simple Dequeue-Priority FSM | |
200 | next_rel_state; | |
201 | ||
202 | ||
203 | //############################################################################ | |
204 | // ZERO IN CHECKERS | |
205 | //############################################################################ | |
206 | ||
207 | // NOTE1: Need to closely watch the FIFO overflow, underflow flags - | |
208 | // built into simple_fifo module | |
209 | ||
210 | // 0in one_hot -var rel_state | |
211 | ||
212 | ||
213 | //############################################################################ | |
214 | // COMBINATIONAL LOGIC | |
215 | //############################################################################ | |
216 | ||
217 | ||
218 | //-------------------------------------------------------------------------- | |
219 | // Posted PIO write Buffer Release Inputs - PIO Credit Release from EIL | |
220 | //-------------------------------------------------------------------------- | |
221 | ||
222 | // y2k_rel[8] = Type field -> 0 = Posted PIO MWr | |
223 | assign e_pio_rel_enq = (~y2k_rel_rcd[8] & y2k_rel_enq) ? 1'b1 : 1'b0; | |
224 | ||
225 | // 4 bit Posted PIO Wr tag lower 4 bits of 9 bit field | |
226 | assign e_pio_rel = y2k_rel_rcd[3:0]; | |
227 | ||
228 | ||
229 | //-------------------------------------------------------------------------- | |
230 | // DMA Rd buffer Release Combinatorial Logic - Feeds Registered Outputs | |
231 | //-------------------------------------------------------------------------- | |
232 | ||
233 | // y2k_rel[8] = Type field -> 1 = DMA Rd Buf Release | |
234 | assign next_rm2cl_bufrel_enq = (y2k_rel_rcd[8] & y2k_rel_enq) ? 1'b1 : 1'b0; | |
235 | ||
236 | // 5 bit DMA buffer d_ptr to be released - when Type 1 (DMA Read) | |
237 | assign next_rm2cl_bufrel = y2k_rel_rcd[4:0]; | |
238 | ||
239 | ||
240 | //-------------------------------------------------------------------------- | |
241 | // PIO Credit Release Logic - (E-Posted PIO Wr or I-Non Posted PIO Wr) | |
242 | //-------------------------------------------------------------------------- | |
243 | ||
244 | assign next_d2j_p_wrack_vld = (ld_e_pio_rel | ld_i_pio_rel); | |
245 | ||
246 | assign rm2crm_npwr_wrack = ld_i_pio_rel; //BP 12-02-05 wrack to crm for npwr | |
247 | ||
248 | ||
249 | //-------------------------------------------------------------------------- | |
250 | // PIO Credit Release Tag to JBC - simple MUX select at Input of Register | |
251 | //-------------------------------------------------------------------------- | |
252 | ||
253 | assign next_d2j_p_wrack_tag = ld_e_pio_rel ? e_pio_rel_dout : i_pio_rel_dout; | |
254 | ||
255 | ||
256 | //############################################################################ | |
257 | // SEQUENTIAL LOGIC | |
258 | //############################################################################ | |
259 | ||
260 | //----------------------------------------------------------------------------------- | |
261 | // rm2cm_bufel - DMA Credit Release - DMA Rd Data Buffer Release to CLU - 5 bit d_ptr | |
262 | //----------------------------------------------------------------------------------- | |
263 | ||
264 | always @ (posedge clk) | |
265 | if (~rst_l) | |
266 | begin | |
267 | rm2cl_bufrel <= `FIRE_DLC_DOU_REL_WDTH'b0; // 5 bit Buf Rel Rcd | |
268 | rm2cl_bufrel_enq <= 1'b0; // Buffer Release Enqueue | |
269 | end | |
270 | else | |
271 | begin | |
272 | rm2cl_bufrel <= next_rm2cl_bufrel; | |
273 | rm2cl_bufrel_enq <= next_rm2cl_bufrel_enq; | |
274 | end | |
275 | ||
276 | ||
277 | //------------------------------------------------------------------------------- | |
278 | // d2j_p_wrack_tag - PIO Credit Release Registered Outputs to JBC - 4 bit pio tag | |
279 | //------------------------------------------------------------------------------- | |
280 | ||
281 | always @ (posedge clk) | |
282 | if (~rst_l) | |
283 | begin | |
284 | d2j_p_wrack_tag <= `FIRE_D2J_P_WRACK_WDTH'b0; // 4 bit PIO Release | |
285 | d2j_p_wrack_vld <= 1'b0; // Release Valid bit | |
286 | end | |
287 | else | |
288 | begin | |
289 | d2j_p_wrack_tag <= next_d2j_p_wrack_tag; | |
290 | d2j_p_wrack_vld <= next_d2j_p_wrack_vld; | |
291 | end | |
292 | ||
293 | ||
294 | //-------------------------------------------------------------------------- | |
295 | // Simple PIO Credit Release Round Robin Priority Encoder FSM | |
296 | //-------------------------------------------------------------------------- | |
297 | ||
298 | ||
299 | //----------------------------------------------------- | |
300 | // PIO Release Priority State Machine Sequential Logic | |
301 | //----------------------------------------------------- | |
302 | ||
303 | always @ (posedge clk) | |
304 | if (~rst_l) | |
305 | begin | |
306 | rel_state[NUM_STATES-1:0] <= {NUM_STATES{1'b0}}; | |
307 | rel_state[E_PRIORITY] <= 1'b1; | |
308 | end | |
309 | else | |
310 | begin | |
311 | rel_state <= next_rel_state; | |
312 | end | |
313 | ||
314 | //------------------------------------------------------------------- | |
315 | // PIO Release Dequeue and Priority State Machine Combinatorial Logic | |
316 | //------------------------------------------------------------------- | |
317 | ||
318 | ||
319 | always @ ( rel_state or e_pio_rel_empty or i_pio_rel_empty ) | |
320 | begin | |
321 | next_rel_state = {NUM_STATES{1'b0}}; | |
322 | ld_e_pio_rel = 1'b0; // Posted WR PIO Rel - from Egress | |
323 | ld_i_pio_rel = 1'b0; // Non Posted PIO Rel - from Ingress | |
324 | ||
325 | ||
326 | case(1'b1) // synopsys parallel_case | |
327 | ||
328 | rel_state[E_PRIORITY] : // Posted PIOW given initial Priority | |
329 | ||
330 | if (~e_pio_rel_empty) // Posted PIOW Release needs service | |
331 | begin | |
332 | ld_e_pio_rel = 1'b1; | |
333 | ld_i_pio_rel = 1'b0; | |
334 | next_rel_state[I_PRIORITY] = 1'b1; // Change Priority to Ingress Path | |
335 | end | |
336 | ||
337 | else if (~i_pio_rel_empty) // OK - do a Non Posted PIO Release | |
338 | begin | |
339 | ld_e_pio_rel = 1'b0; | |
340 | ld_i_pio_rel = 1'b1; | |
341 | next_rel_state[E_PRIORITY] = 1'b1; // BUT keep priority on Posted PIO | |
342 | end | |
343 | ||
344 | else | |
345 | begin | |
346 | ld_e_pio_rel = 1'b0; | |
347 | ld_i_pio_rel = 1'b0; | |
348 | next_rel_state[E_PRIORITY] = 1'b1; // Nothing Happening Stay Here! | |
349 | end | |
350 | ||
351 | ||
352 | rel_state[I_PRIORITY] : // Non Posted PIOW has Priority | |
353 | ||
354 | if (~i_pio_rel_empty) // Posted PIOW Release needs service | |
355 | begin | |
356 | ld_e_pio_rel = 1'b0; | |
357 | ld_i_pio_rel = 1'b1; | |
358 | next_rel_state[E_PRIORITY] = 1'b1; // Change Priority to Egress Path | |
359 | end | |
360 | ||
361 | else if (~e_pio_rel_empty) // OK - do a Posted PIO Release | |
362 | begin | |
363 | ld_e_pio_rel = 1'b1; | |
364 | ld_i_pio_rel = 1'b0; | |
365 | next_rel_state[I_PRIORITY] = 1'b1; // BUT keep priority on Non Posted PIO | |
366 | end | |
367 | ||
368 | else | |
369 | begin | |
370 | ld_e_pio_rel = 1'b0; | |
371 | ld_i_pio_rel = 1'b0; | |
372 | next_rel_state[I_PRIORITY] = 1'b1; // Nothing Happening Stay Here! | |
373 | end | |
374 | endcase | |
375 | end | |
376 | ||
377 | ||
378 | ||
379 | //############################################################################ | |
380 | // MODULE INSTANTIATIONS | |
381 | //############################################################################ | |
382 | ||
383 | //-------------------------------------------------------------------------- | |
384 | // PIO Release FIFO's in RRM - E = Egress or Posted Wr Release FIFO | |
385 | // I = Ingress or Non Posted Wr Release FIFO | |
386 | // | |
387 | // Parameters to be passed into Common Simple FIFO | |
388 | // REL_WDTH = `FIRE_D2J_P_WRACK_WDTH = 4 bit tag | |
389 | // REL_DPTH = 4'd15 = (Max Cr Size-1) | |
390 | // REL_PTR_WDTH = 4 = 3'b000-3'b111 | |
391 | // REL_DPTH_MINUSONE = 4'd14 = Depth-1 | |
392 | // | |
393 | // | |
394 | // Release FIFO registers = 4 * 15 = 60 registers each | |
395 | // | |
396 | //-------------------------------------------------------------------------- | |
397 | ||
398 | ||
399 | dmu_common_simple_fifo #(REL_WDTH,REL_DPTH,REL_PTR_WDTH,REL_DPTH_MINUSONE) e_pio_rel_fifo( | |
400 | .clk (clk), | |
401 | .rst_l (rst_l), | |
402 | ||
403 | .data_in (e_pio_rel), | |
404 | .write (e_pio_rel_enq), | |
405 | ||
406 | .data_out (e_pio_rel_dout), | |
407 | .read (ld_e_pio_rel), | |
408 | ||
409 | .fifo_full (), | |
410 | .fifo_almost_full (), | |
411 | .fifo_empty (e_pio_rel_empty) | |
412 | ||
413 | ); | |
414 | ||
415 | dmu_common_simple_fifo #(REL_WDTH,REL_DPTH,REL_PTR_WDTH,REL_DPTH_MINUSONE) i_pio_rel_fifo( | |
416 | .clk (clk), | |
417 | .rst_l (rst_l), | |
418 | ||
419 | .data_in (lrm2rrm_cpl), | |
420 | .write (lrm2rrm_cpl_enq), | |
421 | ||
422 | .data_out (i_pio_rel_dout), | |
423 | .read (ld_i_pio_rel), | |
424 | ||
425 | .fifo_full (), | |
426 | .fifo_almost_full (), | |
427 | .fifo_empty (i_pio_rel_empty) | |
428 | ||
429 | ); | |
430 | ||
431 | endmodule |