Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / dmu / rtl / dmu_rmu_lrm_octl.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: dmu_rmu_lrm_octl.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 ============================================
35module dmu_rmu_lrm_octl (
36
37 clk,
38 rst_l,
39
40 // MMU Interface
41 rm2mm_rcd,
42 rm2mm_rcd_enq,
43 mm2rm_rcd_full,
44
45 // IMU interface - Interrupt Out Record (IOT)
46 im2rm_rcd,
47 im2rm_rcd_enq,
48
49 // Internal LRM interface with lrm_itsb_fsm module
50 lrm_rcd,
51 lrm_rcd_enq,
52 lrm_rcd_deq,
53
54 // Internal LRM Interface with lrm_ictl module
55 iot_rcd_deq,
56
57 // Outputs (local) for Debug Port Visibility
58 sr_lrm_empty,
59 sr_iot_empty,
60 ttag_match_iot,
61 ttag_match_lrm
62
63 );
64
65// synopsys sync_set_reset "rst_l"
66
67//############################################################################
68// PORT DECLARATIONS
69//############################################################################
70
71 //------------------------------------------------------------------------
72 // Clock and Reset Signals
73 //------------------------------------------------------------------------
74 input clk;
75 input rst_l;
76
77
78 //------------------------------------------------------------------------
79 // MMU Interface
80 //------------------------------------------------------------------------
81
82 // Ingress pipeline interface - 116 bit SRM RECORD (LRM to MMU)
83 output [`FIRE_DLC_SRM_WDTH-1:0] rm2mm_rcd;
84 output rm2mm_rcd_enq;
85 input mm2rm_rcd_full;
86
87
88 //------------------------------------------------------------------------
89 // IMU Interface
90 //------------------------------------------------------------------------
91
92 // Interrupt Out Record - 131 bit IOT Record (IMU to LRM)
93 input [`FIRE_DLC_IOT_REC_WDTH-1:0] im2rm_rcd;
94 input im2rm_rcd_enq;
95
96
97 //------------------------------------------------------------------------
98 // Internal LRM Interface to LRM Ingress TSB FSM Module
99 //------------------------------------------------------------------------
100
101 // LRM Record - 131 bit LRM record from lrm_itsb_fsm module
102 input [`FIRE_DLC_RMU_LRM_WDTH-1:0] lrm_rcd;
103 input lrm_rcd_enq;
104 output lrm_rcd_deq;
105
106
107 //------------------------------------------------------------------------
108 // Internal LRM Interface to LRM Input Control Module
109 //------------------------------------------------------------------------
110
111 output iot_rcd_deq;
112
113
114 //------------------------------------------------------------------------
115 // Outputs for Debug Port Visibility
116 //------------------------------------------------------------------------
117
118 output sr_lrm_empty; // LRM Rcd FIFO empty signal
119 output sr_iot_empty; // LRM Rcd FIFO empty signal
120 output ttag_match_iot; // OK to forward IOT record to MMU
121 output ttag_match_lrm; // OK to forward LRM record to MMU
122
123
124
125//############################################################################
126// PARAMETERS
127//############################################################################
128
129 //-------------------------------------------------------------------------
130 // LRM Standard Record SR FIFO = (WIDTH) 131 * (DEPTH) 5 = 655 registers
131 // LRM Standard Record SR FIFO = (WIDTH) 131 * (DEPTH) 4 = 524 registers
132 //-------------------------------------------------------------------------
133
134 parameter
135 LRM_SR_WIDTH = `FIRE_DLC_RMU_LRM_WDTH,
136 LRM_SR_DEPTH = 4;
137
138
139 //----------------------------------------------------------------------------------
140 // LRM Interrupt Out Record (IOT) SR FIFO = (WIDTH) 131 * (DEPTH) 8 = 1048 registers
141 // Note: For comparison - (gate size and io timing) will use simple fifo for IOT Rcd
142 //
143 // Parameters to be passed into Common Simple FIFO
144 // IOT_WDTH = `FIRE_DLC_IOT_REC_WDTH = 131 bit IOT Record
145 // IOT_DPTH = 4'd8 = MAS2.0 = 8 entries
146 // IOT_PTR_WDTH = 3 = 3 bits
147 // IOT_DPTH_MINUSONE = 3'd7 = Depth-1
148 //-------------------------------------------------------------------------------------------
149
150 parameter
151 IOT_WDTH = `FIRE_DLC_IOT_REC_WDTH,
152 IOT_DPTH = 4'd8,
153 IOT_PTR_WDTH = 3,
154 IOT_DPTH_MINUSONE = 3'd7;
155
156
157 // Identifies MONDO type out from IOT Record Input - used for Mondo Tag Sterring Logic
158 parameter
159 MONDO = 7'b1111010;
160
161
162//############################################################################
163// DECLARE Module Wires and Registers
164//############################################################################
165
166 wire [`FIRE_DLC_SRM_WDTH-1:0] next_rm2mm_rcd; // SRM record to MMU
167
168 wire [`FIRE_DLC_RMU_LRM_WDTH-1:0] sr_lrm_dout; // Output of LRM FIFO
169 wire [`FIRE_DLC_IOT_REC_WDTH-1:0] sr_iot_dout; // Output of IOT FIFO
170
171
172 wire ttag_match_iot; // OK to forward IOT record to MMU
173 wire ttag_match_lrm; // OK to forward LRM record to MMU
174
175 wire [`FIRE_DLC_IIN_LRMTAG_WDTH-1:0] next_ttag; // Next Transmit Tag Value
176 wire [`FIRE_DLC_IIN_LRMTAG_WDTH-1:0] ttag_plusone; // Transmit Tag Incremented Value
177
178 wire [`FIRE_DLC_IOT_LRMTAG_WDTH-1:0] iot_rcd_lrmtag; // lrmtag field in IOT Rcd
179 wire [`FIRE_DLC_IOT_LRMTAG_WDTH-1:0] sr_lrm_lrmtag; // lrmtag field in LRM Rcd
180
181 wire lrm_rcd_deq; // LRM rcd dequeue IS also Load EN
182 wire iot_rcd_deq; // IOT rcd dequeue IS also Load EN
183
184 wire ld_srm_rcd; // ld_srm_lrm_rcd or ld_srm_iot_rcd
185 wire sr_iot_empty; // Output of IOT fifo
186
187 wire sr_lrm_empty; // Std Rcd FIFO empty signal
188
189 wire mondo_vld; // Record from IMU is of type MONDO
190
191
192 //--------------------------------------------------
193 // Registers that Are Not Flops
194 //--------------------------------------------------
195
196 // SRM Record formulation - otuput of 2 to 1 (IOT and LRM) Mux
197 reg [`FIRE_DLC_SRM_TYPE_WDTH-1:0] next_srm_type; // 7 bit type
198 reg [`FIRE_DLC_SRM_LEN_WDTH-1:0] next_srm_len; // 10 bit length
199 reg [`FIRE_DLC_SRM_REQID_WDTH-1:0] next_srm_reqid; // 16 bit reqid
200 reg [`FIRE_DLC_SRM_DWBE_WDTH-1:0] next_srm_dwbe; // 8 bit DWBE {ldwbe,fdwbe}
201 reg [`FIRE_DLC_SRM_ADDR_WDTH-1:0] next_srm_addr; // 62 bit address
202 reg [`FIRE_DLC_SRM_DPTR_WDTH-1:0] next_srm_dptr; // 7 bit dptr
203 reg [`FIRE_DLC_SRM_SBDTAG_WDTH-1:0] next_srm_sbdtag; // 5 bit TSB trn tag
204
205
206 reg ld_srm_lrm_rcd; // Load SRM rcd from LRM rcd
207 reg ld_srm_iot_rcd; // Load SRM rcd from IOT rcd
208 reg next_rm2mm_rcd_enq; // Enqueue to MMU AND increment ttag!
209
210
211 //--------------------------------------------------
212 // Registers that Are Flops
213 //--------------------------------------------------
214
215 reg [`FIRE_DLC_SRM_WDTH-1:0] rm2mm_rcd; // SRM record to MMU
216 reg rm2mm_rcd_enq; // Enqueue SRM rcd to MMU AND increment ttag!
217
218 reg [`FIRE_DLC_IOT_LRMTAG_WDTH-1:0] ttag; // Transmit Tag value used for Merging Rcd's
219
220
221//############################################################################
222// ZERO IN CHECKERS
223//############################################################################
224
225 // NOTE1: Need zero-in check for DUPLICATE TTAG
226 // ttag_match_iot and ttag_match_lrm should never be both asserted at the same time
227
228 // 0in custom -fire (ttag_match_iot & ttag_match_lrm) -active (~sr_lrm_empty & ~sr_iot_empty)
229
230
231//############################################################################
232// COMBINATORIAL LOGIC
233//############################################################################
234
235 //--------------------------------------------------------------
236 // LRM Record and IOT Record Dequeue Signals
237 //--------------------------------------------------------------
238
239 assign lrm_rcd_deq = ld_srm_lrm_rcd; // LRM rcd dequeue IS also Load EN
240 assign iot_rcd_deq = ld_srm_iot_rcd; // IOT rcd dequeue IS also Load EN
241
242
243 //---------------------------------------------------------------------------------------------
244 // SRM register Load Enable Signal - spelled out for debug - Loading SRM from LRM or IOT record
245 //---------------------------------------------------------------------------------------------
246
247 assign ld_srm_rcd = ld_srm_lrm_rcd | ld_srm_iot_rcd;
248
249
250 //--------------------------------------------------------------
251 // Transmit Tag compared to LRM Tag inserted onto IOT or LRM Rcd
252 //--------------------------------------------------------------
253
254 assign iot_rcd_lrmtag = sr_iot_dout[`FIRE_DLC_IOT_LRMTAG_MSB:`FIRE_DLC_IOT_LRMTAG_LSB];
255 assign sr_lrm_lrmtag = sr_lrm_dout[`FIRE_DLC_RMU_LRM_LRMTAG_MSB:`FIRE_DLC_RMU_LRM_LRMTAG_LSB];
256
257 assign ttag_match_iot = ((ttag == iot_rcd_lrmtag) & ~sr_iot_empty);
258 assign ttag_match_lrm = ((ttag == sr_lrm_lrmtag) & ~sr_lrm_empty);
259
260
261 //-----------------------------------------------------------------------------------------
262 // SRM Output Control Logic - Merges either IOT Rcd or LRM Rcd into Ingress Pipeline to MMU
263 //-----------------------------------------------------------------------------------------
264
265 always @ ( ttag_match_iot or ttag_match_lrm or mm2rm_rcd_full )
266 begin
267
268 ld_srm_lrm_rcd = 1'b0; // Load Enable and LRM rcd dequeue
269 ld_srm_iot_rcd = 1'b0; // Load Enable and IOT rcd dequeue
270 next_rm2mm_rcd_enq = 1'b0; // Registered Enqueue signal to SRM
271
272 case ({mm2rm_rcd_full, ttag_match_iot, ttag_match_lrm}) // 0in < case -parallel
273
274 (3'b001) : // OK to send LRM rcd to SRM!
275 begin
276 ld_srm_lrm_rcd = 1'b1; // Load SRM rcd, dequeue LRM rcd
277 next_rm2mm_rcd_enq = 1'b1; // Incr ttag and Enqueue SRM
278 end
279
280 (3'b010) : // OK to send IOT rcd to SRM!
281 begin
282 ld_srm_iot_rcd = 1'b1; // Load SRM rcd, dequeue IOT rcd
283 next_rm2mm_rcd_enq = 1'b1; // Incr ttag and Enqueue SRM
284 end
285
286 default : // NO tag matches OR SRM fifo FULL
287 begin
288 ld_srm_lrm_rcd = 1'b0;
289 ld_srm_iot_rcd = 1'b0;
290 next_rm2mm_rcd_enq = 1'b0;
291 end
292 endcase // Ends case statement
293 end // Ends Always block
294
295
296 //---------------------------------------------------------
297 // Outgoing SRM Record is MUXed from either IOT or LRM fifo
298 //---------------------------------------------------------
299
300 always @ (ld_srm_iot_rcd or sr_iot_dout or sr_lrm_dout or mondo_vld)
301 begin
302
303 case (ld_srm_iot_rcd) // synopsys infer_mux
304
305 // SRM Mux Select - IOT Record
306 (1'b1) :
307 begin
308 next_srm_type = sr_iot_dout[`FIRE_DLC_IOT_TYPE];
309 next_srm_len = sr_iot_dout[`FIRE_DLC_IOT_LEN];
310 next_srm_reqid = sr_iot_dout[`FIRE_DLC_IOT_REQID];
311 next_srm_dwbe = mondo_vld ? {sr_iot_dout[`FIRE_DLC_IOT_DATA_MSB:`FIRE_DLC_IOT_DATA_LSB+2],
312 sr_iot_dout[`FIRE_DLC_IOT_REQID_LSB+1:`FIRE_DLC_IOT_REQID_LSB]} :
313 sr_iot_dout[`FIRE_DLC_IOT_DATA];
314 next_srm_addr = sr_iot_dout[`FIRE_DLC_IOT_ADDR];
315 next_srm_dptr = sr_iot_dout[`FIRE_DLC_IOT_DPTR];
316 next_srm_sbdtag = sr_iot_dout[`FIRE_DLC_IOT_TLPTAG_LSB+4:`FIRE_DLC_IOT_TLPTAG_LSB];
317 end
318
319 // SRM record by default will originate from Ingress Pipeline LRM record
320 (1'b0) :
321 begin
322 next_srm_type = sr_lrm_dout[`FIRE_DLC_RMU_LRM_TYPE];
323 next_srm_len = sr_lrm_dout[`FIRE_DLC_RMU_LRM_LEN];
324 next_srm_reqid = sr_lrm_dout[`FIRE_DLC_RMU_LRM_REQID];
325 next_srm_dwbe = sr_lrm_dout[`FIRE_DLC_RMU_LRM_LDWBE_MSB:`FIRE_DLC_RMU_LRM_FDWBE_LSB];
326 next_srm_addr = sr_lrm_dout[`FIRE_DLC_RMU_LRM_ADDR];
327 next_srm_dptr = sr_lrm_dout[`FIRE_DLC_RMU_LRM_DPTR];
328 next_srm_sbdtag = sr_lrm_dout[`FIRE_DLC_RMU_LRM_TAG_LSB+4:`FIRE_DLC_RMU_LRM_TAG_LSB];
329 end
330 endcase
331 end
332
333
334 // Steering logiv for SRM DWBE field
335 assign mondo_vld = (sr_iot_dout[`FIRE_DLC_IOT_TYPE] == MONDO) & ~sr_iot_empty;
336
337
338 //-----------------------------------------------------------
339 // For Readability - will define next SRM record fields here!
340 //-----------------------------------------------------------
341
342 // Formulation of the 115 bit Next SRM Record - Output of LRM/IOT fifo's
343 assign next_rm2mm_rcd = { next_srm_type,
344 next_srm_len,
345 next_srm_reqid,
346 next_srm_dwbe,
347 next_srm_addr,
348 next_srm_dptr,
349 next_srm_sbdtag
350 };
351
352
353
354//############################################################################
355// SEQUENTIAL LOGIC
356//############################################################################
357
358
359 //-----------------------------------------------------
360 // SRM Record Enqueue Signal
361 //-----------------------------------------------------
362
363 always @ (posedge clk)
364 if (~rst_l)
365 rm2mm_rcd_enq <= 1'b0;
366 else
367 rm2mm_rcd_enq <= next_rm2mm_rcd_enq;
368
369
370 //----------------------------------------------
371 // 115 bit Registered SRM Record Generation
372 //----------------------------------------------
373
374 always @ (posedge clk)
375 if (~rst_l)
376 rm2mm_rcd <= {`FIRE_DLC_SRM_WDTH{1'b0}};
377 else if (ld_srm_rcd) // SRM Load Enable = ld_srm_iot,ld_srm_lrm
378 rm2mm_rcd <= next_rm2mm_rcd;
379 else
380 rm2mm_rcd <= rm2mm_rcd;
381
382
383//-------------------------------------------
384 // Transmit Tag (Merge) Manager Functionality
385 //-------------------------------------------
386
387 always @ (posedge clk)
388 if (~rst_l)
389 ttag <= `FIRE_DLC_IIN_LRMTAG_WDTH'b0; // First Tag to Look for is 8'b0
390 else
391 ttag <= next_ttag;
392
393
394 // Transmit Tag is simply a counter - As each Record is Transmitted - we look for the next
395 // record - from either IOT or LRM record fifo - that was assigned an lrmtag IN ORDER received
396
397 assign next_ttag = next_rm2mm_rcd_enq ? ttag_plusone : ttag;
398 assign ttag_plusone = ttag + 1'b1;
399
400
401//############################################################################
402// MODULE INSTANTIATIONS
403//############################################################################
404
405
406 //-------------------------------------------------------------------------
407 // LRM Record SR FIFO = (WIDTH) 131 * (DEPTH) 5 = 655 registers
408 // LRM Record SR FIFO = (WIDTH) 131 * (DEPTH) 4 = 524 registers
409 //-------------------------------------------------------------------------
410
411 fire_dmc_common_srfifo #(LRM_SR_WIDTH, LRM_SR_DEPTH) sr_lrm_fifo (
412 .clk (clk),
413 .rst_l (rst_l),
414
415 .enq (lrm_rcd_enq),
416 .data_in (lrm_rcd),
417
418 .deq (lrm_rcd_deq),
419 .data_out (sr_lrm_dout),
420
421 .full (),
422 .empty (sr_lrm_empty),
423 .overflow (),
424 .underflow ()
425 );
426
427 //----------------------------------------------------------------------------------
428 // LRM Interrupt Out Record (IOT) SR FIFO = (WIDTH) 131 * (DEPTH) 8 = 1048 registers
429 // Note: For comparison - (gate size and io timing) will use simple fifo for IOT Rcd
430 //
431 // Parameters to be passed into Common Simple FIFO
432 // IOT_WDTH = `FIRE_DLC_IOT_REC_WDTH = 131 bit IOT Record
433 // IOT_DPTH = 4'd8 = MAS2.0 = 8 entries
434 // IOT_PTR_WDTH = 3 = 3 bits
435 // IOT_DPTH_MINUSONE = 3'd7 = Depth-1
436 //-------------------------------------------------------------------------------------------
437
438
439dmu_common_simple_fifo #(IOT_WDTH,IOT_DPTH,IOT_PTR_WDTH,IOT_DPTH_MINUSONE) iot_rcd_fifo(
440 .clk (clk),
441 .rst_l (rst_l),
442
443 .data_in (im2rm_rcd),
444 .write (im2rm_rcd_enq),
445
446 .data_out (sr_iot_dout),
447 .read (iot_rcd_deq),
448
449 .fifo_full (),
450 .fifo_almost_full (),
451 .fifo_empty (sr_iot_empty)
452 );
453
454//
455// //----------------------------------------------------------------------------------
456// // LRM Interrupt Out Record (IOT) SR FIFO = (WIDTH) 131 * (DEPTH) 8 = 1048 registers
457// // Note: For comparison - (gate size and io timing) will use simple fifo for IOT Rcd
458// //----------------------------------------------------------------------------------
459//
460// fire_dmc_common_srfifo #(IOT_SR_WIDTH, IOT_SR_DEPTH) sr_iot_fifo (
461// .clk (clk),
462// .rst_l (rst_l),
463//
464// .enq (im2rm_rcd_enq),
465// .data_in (im2rm_rcd),
466//
467// .deq (iot_rcd_deq),
468// .data_out (sr_iot_dout),
469//
470// .full (),
471// .empty (sr_iot_empty),
472// .overflow (),
473// .underflow ()
474// );
475
476
477
478endmodule