Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / dmu / rtl / dmu_imu_rds.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: dmu_imu_rds.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_imu_rds (
36
37 clk,
38 rst_l,
39
40 // Inputs from the Header Queue
41
42 irs2rds_rcd,
43 rds2irs_rcd_deq,
44 irs2rds_rcd_empty,
45
46 // Inputs and Outputs from the MSI Data Queue
47
48 irs2rds_data,
49 rds2irs_data_deq,
50 irs2rds_data_empty,
51
52 // Static Jbus ID Sel
53
54 j2d_jid,
55 j2d_instance_id,
56
57 // INTX Interrupt Notifcation Mechanism
58
59 rds2iss_intx_int_l,
60
61 // Outputs to State Check Sub-block
62
63 rds2scs_rcd,
64 rds2scs_rcd_sel,
65 rds2scs_eq,
66
67 // Outputs to EQ state Sub-block
68
69 rds2eqs_eq,
70 rds2eqs_eq_sel,
71
72 // Outputs to Data Move Sub-block
73
74 rds2dms_data_sel,
75 rds2dms_data,
76 rds2dms_d_ptr,
77
78 // Error Signal Outputs
79
80 rds2ics_msi_mal_error,
81 rds2ics_msi_par_error,
82 rds2ics_pmeack_mes_not_en_error,
83 rds2ics_pmpme_mes_not_en_error,
84 rds2ics_fatal_mes_not_en_error,
85 rds2ics_nonfatal_mes_not_en_error,
86 rds2ics_cor_mes_not_en_error,
87 rds2ics_msi_not_en_error,
88 rds2ics_error_data,
89
90 // CSRBUS Interface
91
92 csrbus_valid,
93 csrbus_done,
94 csrbus_mapped,
95 csrbus_wr_data,
96 csrbus_wr,
97 csrbus_read_data,
98 csrbus_addr,
99 csrbus_src_bus,
100 csrbus_acc_vio,
101
102
103 // Debug Ports
104
105 dbg2rds_dbg_sel_a,
106 dbg2rds_dbg_sel_b,
107 rds2dbg_dbg_a,
108 rds2dbg_dbg_b,
109
110 //Idle Checkers
111
112 rds2dbg_idle
113
114
115 );
116
117
118//############################################################################
119// PORT DECLARATIONS
120//############################################################################
121
122 //------------------------------------------------------------------------
123 // Clock and Reset Signals
124 //------------------------------------------------------------------------
125 input clk;
126 input rst_l;
127
128 //------------------------------------------------------------------------
129 // Inputs for Recod Headers to RDS
130 //------------------------------------------------------------------------
131
132 input [`FIRE_DLC_IIN_REC_WDTH-1:0] irs2rds_rcd;
133 output rds2irs_rcd_deq;
134 input irs2rds_rcd_empty;
135
136 //------------------------------------------------------------------------
137 // Inputs for Data Headers to RDS
138 //------------------------------------------------------------------------
139
140 input [`FIRE_DLC_MDF_REC_WDTH-1:0] irs2rds_data;
141 output rds2irs_data_deq;
142 input irs2rds_data_empty;
143
144 //------------------------------------------------------------------------
145 // Input Select Signals
146 //------------------------------------------------------------------------
147 input [`FIRE_J2D_JID_WDTH-1:0] j2d_jid;
148 input [`FIRE_J2D_INSTANCE_ID_WDTH-1:0] j2d_instance_id;
149
150 //------------------------------------------------------------------------
151 // Output Interrupt Signals
152 //------------------------------------------------------------------------
153 output [3:0] rds2iss_intx_int_l;
154
155 //------------------------------------------------------------------------
156 // Output to State Check Sub-block Signals
157 //------------------------------------------------------------------------
158
159 output [`FIRE_DLC_IIN_REC_WDTH-1:0] rds2scs_rcd;
160 output rds2scs_rcd_sel;
161 output [5:0] rds2scs_eq;
162
163 //------------------------------------------------------------------------
164 // Output to EQ State Sub-block Signals
165 //------------------------------------------------------------------------
166 output [5:0] rds2eqs_eq;
167 output rds2eqs_eq_sel;
168
169 //------------------------------------------------------------------------
170 // Output to DMS Sub-block Signals
171 //------------------------------------------------------------------------
172 output rds2dms_data_sel;
173 output [127:0] rds2dms_data;
174 output [3:0] rds2dms_d_ptr;
175
176
177 output rds2ics_msi_mal_error;
178 output rds2ics_msi_par_error;
179 output rds2ics_pmeack_mes_not_en_error;
180 output rds2ics_pmpme_mes_not_en_error;
181 output rds2ics_fatal_mes_not_en_error;
182 output rds2ics_nonfatal_mes_not_en_error;
183 output rds2ics_cor_mes_not_en_error;
184 output rds2ics_msi_not_en_error;
185 output [63:0] rds2ics_error_data;
186
187 //------------------------------------------------------------------------
188 // PIO INTERFACE
189 //------------------------------------------------------------------------
190 input csrbus_valid;
191 output csrbus_done;
192 output csrbus_mapped;
193
194 input [`FIRE_CSR_DATA_WIDTH-1:0] csrbus_wr_data;
195 input csrbus_wr;
196
197 output [`FIRE_CSR_DATA_WIDTH-1:0] csrbus_read_data;
198
199 input [`FIRE_CSR_ADDR_MAX_WIDTH-1:0] csrbus_addr;
200
201 input [`FIRE_CSR_SRC_BUS_ID_WIDTH-1:0] csrbus_src_bus;
202 output csrbus_acc_vio;
203
204
205 //------------------------------------------------------------------------
206 // Debug Ports
207 //------------------------------------------------------------------------
208
209 input [2:0] dbg2rds_dbg_sel_a;
210 input [2:0] dbg2rds_dbg_sel_b;
211 output [`FIRE_DEBUG_WDTH-1:0] rds2dbg_dbg_a;
212 output [`FIRE_DEBUG_WDTH-1:0] rds2dbg_dbg_b;
213
214 //------------------------------------------------------------------------
215 // Idle Checkers
216 //------------------------------------------------------------------------
217 output rds2dbg_idle;
218
219//############################################################################
220// PARAMETERS
221//############################################################################
222
223 parameter EQ_WRITE_FIRST_DPTR = 4'b0000;
224 parameter EQ_WRITE_LAST_DPTR = 4'b1011;
225
226//############################################################################
227// SIGNAL DECLARATIONS
228//############################################################################
229
230
231//**************************************************
232// Wire
233//**************************************************
234
235//----------------------------------------------------
236// Header Fields Delayed by one cycle
237//----------------------------------------------------
238wire [`FIRE_DLC_IIN_LRMTAG_WDTH-1:0] in_lrm_tag_del; // LRM tag bits 7:0
239wire [`FIRE_DLC_IIN_DPTR_WDTH-1:0] in_d_ptr_del; // d_ptr bits 14:8
240wire [`FIRE_DLC_IIN_ADDR_WDTH-1:0] in_address_del; // Address 63:2 bits 76:15
241wire [`FIRE_DLC_IIN_DATA_WDTH-1:0] in_data_del; // message code and byte enables bits 84:77
242wire [`FIRE_DLC_IIN_TLPTAG_WDTH-1:0] in_tlp_tag_del; // TLP tag bits 92:85
243wire [`FIRE_DLC_IIN_REQID_WDTH-1:0] in_req_id_del; // PCIE REQ ID bits 108:93
244wire [`FIRE_DLC_IIN_LEN_WDTH-1:0] in_length_del; // PCIE Length bits 118:109
245wire [`FIRE_DLC_IIN_ATR_WDTH-1:0] in_attr_del; // PCIE attr bits 120:119
246wire [`FIRE_DLC_IIN_TC_WDTH-1:0] in_tc_del; // PCIE Length bits 123:121
247wire [`FIRE_DLC_IIN_TYPE_WDTH-1:0] in_type_del; // PCIE type bits 130:124
248
249// wire [`FIRE_DLC_MDF_DATA_WDTH-1:0] in_msi_data_del; // MSI Data error bits 0:15
250 wire [15:0] in_msi_data_del; // MSI Data low order
251 wire [15:0] in_msi_x_data_del; // MSI Data high order bytes
252 wire [15:0] msi_x_wr_data;
253
254
255//----------------------------------------------------
256// Header Sub-Fields Delayed
257//----------------------------------------------------
258wire in_mondo_mode_del; // Mondo Mode
259wire [5:0] in_mondo_ino_del; // INO number
260wire [5:0] in_mondo_tid_del; // TID number
261//wire [1:0] in_mondo_group_del; // Group controller number
262
263
264//----------------------------------------------------
265// Live Record Fields
266//----------------------------------------------------
267wire [1:0] in_type; // PCIE type
268wire [`FIRE_DLC_IIN_DATA_WDTH-1:0] in_message_code; // message code
269
270
271
272//----------------------------------------------------
273// Live Record Types
274//----------------------------------------------------
275wire msi_record;
276wire intx_record;
277wire message_record;
278wire mondo_record;
279
280//----------------------------------------------------
281// Pipe Output Selects
282//----------------------------------------------------
283wire msi_sel_out;
284wire intx_sel_out;
285wire message_sel_out;
286wire mondo_sel_out;
287
288//----------------------------------------------------
289// MSI and Mess Pipe Output Good and EQ Signals
290//----------------------------------------------------
291wire msi_hd_good;
292wire message_hd_good;
293wire [5:0] msi_eq_num;
294wire [5:0] message_eq_num;
295
296//----------------------------------------------------
297// Mondo Pipe Output d_ptr and jid Signals
298//----------------------------------------------------
299
300wire [3:0] mondo_d_ptr;
301reg [3:0] eq_write_d_ptr;
302wire inc_eq_write_ptr;
303wire [4:0] mondo_jid;
304
305//----------------------------------------------------
306// Record pipeline Signals based on output sub-blocks
307//----------------------------------------------------
308wire [`FIRE_DLC_IIN_ADDR_WDTH-1:0] out_address;
309wire [9:0] out_length;
310
311
312//----------------------------------------------------
313// Type Selects Signals based on output sub-blocks
314//----------------------------------------------------
315wire [3:0] all_type_sel;
316
317//----------------------------------------------------
318// Next pipe stage outputs
319//----------------------------------------------------
320wire [`FIRE_DLC_IIN_REC_WDTH-1:0] n_rds2scs_rcd;
321wire [5:0] n_rds2eqs_eq;
322wire [127:0] n_rds2dms_data;
323wire [3:0] n_rds2dms_d_ptr;
324
325//----------------------------------------------------
326// MSI malformed and Parity Error Signal
327//----------------------------------------------------
328wire msi_parity_err;
329wire msi_malformed;
330wire msi_first_be_good;
331wire msi_length_good;
332wire mes_not_en_error;
333wire msi_not_enabled_error;
334wire malformed_error;
335wire msi_error;
336//----------------------------------------------------
337// Wires for DMS
338//----------------------------------------------------
339
340wire msi_record_del;
341wire mondo_record_del;
342
343wire [15:0] eq_wr_data;
344wire [15:0] rds_msi_data;
345
346wire [63:0] sw_mondo_data_1;
347wire [57:0] sw_mondo_data_0;
348
349wire [63:0] eq_wr_dw_0;
350wire [63:0] eq_wr_dw_1;
351
352wire [63:0] mondo_dw_0;
353wire [63:0] mondo_dw_1;
354
355wire [127:0] eq_wr_dms_data;
356wire [127:0] mondo_dms_data;
357
358
359
360//----------------------------------------------------
361// Wires For Muxing PIO Path
362//----------------------------------------------------
363
364wire intx_acc_vio;
365wire msi_acc_vio;
366wire message_acc_vio;
367
368wire intx_done;
369wire msi_done;
370wire message_done;
371
372wire intx_mapped;
373wire msi_mapped;
374wire message_mapped;
375
376wire [`FIRE_CSR_DATA_WIDTH-1:0] intx_read_data;
377wire [`FIRE_CSR_DATA_WIDTH-1:0] msi_read_data;
378wire [`FIRE_CSR_DATA_WIDTH-1:0] message_read_data;
379
380
381//**************************************************
382// Registers that Are Not Flops
383//**************************************************
384
385//--------------------------
386// Output Reg Signals
387//--------------------------
388reg [6:0] out_type;
389reg n_rds2eqs_eq_sel;
390
391reg [`FIRE_DEBUG_WDTH-1:0] n_dbg_a;
392reg [`FIRE_DEBUG_WDTH-1:0] n_dbg_b;
393//**************************************************
394// Registers that Are Flops
395//**************************************************
396reg [`FIRE_DLC_IIN_REC_WDTH-1:0] irs2rds_rcd_del; // Delayed record by one clock
397reg [`FIRE_DLC_MDF_REC_WDTH-1:0] irs2rds_data_del;
398
399
400reg [`FIRE_DLC_IIN_REC_WDTH-1:0] rds2scs_rcd; // Record Output to SCS
401reg rds2scs_rcd_sel; // Select Output to SCS
402
403reg [5:0] rds2eqs_eq; // Record Output to EQS
404reg rds2eqs_eq_sel; // Select Output to EQS
405
406reg rds2dms_data_sel; // Select Output to RDS
407reg [127:0] rds2dms_data; // Record Output to RDS
408reg [3:0] rds2dms_d_ptr; // Address into the DIU RAM
409reg [`FIRE_DEBUG_WDTH-1:0] dbg_a;
410reg [`FIRE_DEBUG_WDTH-1:0] dbg_b;
411reg malformed_error_del;
412
413
414//############################################################################
415// ZERO IN CHECKERS
416//############################################################################
417
418 //---------------------------------------------------------------------
419 // One Hot / Bits On Checkers
420 //---------------------------------------------------------------------
421
422 //0in bits_on -var {msi_record, message_record, mondo_record, intx_record} -max 1
423 //0in bits_on -var all_type_sel -max 1
424
425 //---------------------------------------------------------------------
426 // Maximum and Range
427 //---------------------------------------------------------------------
428
429 //0in maximum -var n_rds2eqs_eq -val 35
430
431 //---------------------------------------------------------------------
432 // Value Checker
433 //---------------------------------------------------------------------
434 /* 0in val -var irs2rds_rcd[`FIRE_DLC_IIN_TYPE_MSB : `FIRE_DLC_IIN_TYPE_LSB]
435 -val
436 7'b1011_000
437 7'b1111_000
438
439 7'b0110_000
440 7'b0110_001
441 7'b0110_010
442 7'b0110_011
443 7'b0110_100
444 7'b0110_101
445 7'b0110_110
446 7'b0110_111
447
448 7'b1111_010
449
450 -active ~irs2rds_rcd_empty
451
452 */
453
454 /* 0in val -var out_type
455 -val
456 `FIRE_DLC_IMU_TYPE_MONDO
457 `FIRE_DLC_IMU_TYPE_NULL
458 `FIRE_DLC_IMU_TYPE_MSI_32
459 `FIRE_DLC_IMU_TYPE_MES_32
460
461 -active |all_type_sel;
462
463 */
464
465
466
467//############################################################################
468// COMBINATIONAL LOGIC
469//############################################################################
470
471
472//------------------------------------------------------------------------------
473// Header Fields Delayed
474//------------------------------------------------------------------------------
475 assign in_lrm_tag_del = irs2rds_rcd_del[`FIRE_DLC_IIN_LRMTAG_MSB : `FIRE_DLC_IIN_LRMTAG_LSB]; // NO CHANGE
476 assign in_d_ptr_del = irs2rds_rcd_del[`FIRE_DLC_IIN_DPTR_MSB : `FIRE_DLC_IIN_DPTR_LSB]; // MONDO ONLY *****
477 assign in_address_del = irs2rds_rcd_del[`FIRE_DLC_IIN_ADDR_MSB : `FIRE_DLC_IIN_ADDR_LSB]; // MONDO ONLY *****
478 assign in_data_del = irs2rds_rcd_del[`FIRE_DLC_IIN_DATA_MSB : `FIRE_DLC_IIN_DATA_LSB]; // NO CHANGE
479 assign in_tlp_tag_del = irs2rds_rcd_del[`FIRE_DLC_IIN_TLPTAG_MSB : `FIRE_DLC_IIN_TLPTAG_LSB]; // NO CHANGE
480 assign in_req_id_del = irs2rds_rcd_del[`FIRE_DLC_IIN_REQID_MSB : `FIRE_DLC_IIN_REQID_LSB]; // NO CHANGE
481 assign in_length_del = irs2rds_rcd_del[`FIRE_DLC_IIN_LEN_MSB : `FIRE_DLC_IIN_LEN_LSB]; // UPDATE to 10h *****
482 assign in_attr_del = irs2rds_rcd_del[`FIRE_DLC_IIN_ATR_MSB : `FIRE_DLC_IIN_ATR_LSB]; // NO CHANGE
483 assign in_tc_del = irs2rds_rcd_del[`FIRE_DLC_IIN_TC_MSB : `FIRE_DLC_IIN_TC_LSB]; // NO CHANGE
484 assign in_type_del = irs2rds_rcd_del[`FIRE_DLC_IIN_TYPE_MSB : `FIRE_DLC_IIN_TYPE_LSB]; // CHANGE ON ALL 4 *****
485
486// assign in_msi_data_del = irs2rds_data_del[15:0];
487 assign in_msi_data_del = irs2rds_data_del[31:16]; // Byte 0 (31:24) and Byte 1 (23:16) of MSI Data
488 assign in_msi_x_data_del = irs2rds_data_del[15:0]; // Byte 2 (15:8) and Byte 3 (7:0) of MSI data
489
490
491
492//----------------------------------------------------------------------------
493// Header Sub Fields Delayed
494//----------------------------------------------------------------------------
495 assign in_mondo_mode_del = in_req_id_del[13];
496 assign in_mondo_ino_del = in_req_id_del[12:7];
497 assign in_mondo_tid_del = {in_req_id_del[14],in_req_id_del[6:2]};
498//assign in_mondo_group_del = in_req_id_del[1:0];
499
500//-----------------------------------------------------------------------------
501// Do the output muxing after the lookups have been done.
502//
503// d_ptr - This is for Mondo Transactions ONLY
504// - If mondo take new d_ptr
505// - Else take the delayed value
506//
507// address - This is for Mondo Transactions ONLY
508// - If mondo take new address
509// - Else take the delayed value
510
511// length - This is for ALL Transactions
512// - set to 10H
513
514//-----------------------------------------------------------------------------
515
516assign n_rds2dms_d_ptr = mondo_sel_out ? mondo_d_ptr : eq_write_d_ptr;
517assign out_address = mondo_sel_out ? {22'h0,in_mondo_tid_del,mondo_jid,29'h0}: in_address_del; // ADD MONDO MODE
518assign out_length = 10'h10;
519
520//-----------------------------------------------------------------------------
521// Create the selc signals used fo rthe output selects to different blocks
522//-----------------------------------------------------------------------------
523
524assign all_type_sel = {mondo_sel_out,intx_sel_out,msi_sel_out,message_sel_out};
525
526assign inc_eq_write_ptr = |all_type_sel[2:0];
527//-----------------------------------------------------------------------------
528// Create Parity Error
529//
530// Packet is and MSI and there is a parity error (irs2rds_data_del[16])
531//-----------------------------------------------------------------------------
532
533assign msi_parity_err = irs2rds_data_del[32] & msi_sel_out;
534
535//-----------------------------------------------------------------------------
536// Create Malformed MSI Signals
537//
538// Rules
539//
540// a) length of PCIE packet is NOT 01h
541//
542// b) If the last byte enable field is not 0000b
543// - howevere the PEC already does this check so I do not need to do it here
544// - if the length is one the Last BE are have to be 0000b or the packet
545// is malfomed and dropped in the PEC
546//
547// c) if the lower 2 bits in the first byte enable field are not 11b
548//
549//
550// All checking of the actual MSI data will be ignored (ie upper two bytes equals 0
551// as well as the upper two bits of the the first byte enable field.
552//
553//-----------------------------------------------------------------------------
554
555assign msi_length_good = (irs2rds_rcd[`FIRE_DLC_IIN_LEN_MSB : `FIRE_DLC_IIN_LEN_LSB] == 10'h01);
556
557assign msi_first_be_good = irs2rds_rcd[`FIRE_DLC_IIN_DATA_LSB] & irs2rds_rcd[`FIRE_DLC_IIN_DATA_LSB + 1];
558
559assign malformed_error = !msi_first_be_good | !msi_length_good;
560
561assign msi_malformed = malformed_error_del & msi_sel_out;
562
563
564//-----------------------------------------------------------------------------
565// Create Error Signal going into MSI Block
566//
567// This is needed as to not update the ok 2 write on any of the follwoing errors
568// - msi not enabled
569// - msi parity error
570// - msi malformed error
571//
572// Since the msi not enable error is detected in the MSI block it does not need
573// to factor into this equation as the valid bit will be not set and thus the
574// value of the ok 2 write bit will also not chnage
575//
576// This error signal will only for the remanining 2 errors
577//
578//-----------------------------------------------------------------------------
579
580assign msi_error = malformed_error | irs2rds_data[32];
581
582
583
584//-----------------------------------------------------------------------------
585// Do the output muxing after the lookups have been done.
586//
587// type - This is for All Transactions
588// - For Mondos - type is always MONDO
589// - For INTX - type is always NULL
590// - For MSI
591// - good header - type is MSI_EQ_WR
592// - bad header - type is NULL
593// - parity err - type is NULL
594// - malformed - type is NULL
595//
596// - This totals 7 error cases and 1 good case
597//
598// - For MES
599// - good header- type is MES_EQ_WR
600// - bad header- type is NULL
601//-----------------------------------------------------------------------------
602
603always @(all_type_sel or msi_parity_err or msi_malformed or msi_hd_good or message_hd_good)
604 begin
605 casez ({all_type_sel,msi_parity_err,msi_malformed,msi_hd_good,message_hd_good})
606
607 8'b1000_000_0:
608 begin
609 out_type = `FIRE_DLC_IMU_TYPE_MONDO; // MONDO HEADER - ALWAYS MONDO
610 n_rds2eqs_eq_sel = 1'b0;
611 end
612
613 8'b0100_000_0:
614 begin
615 out_type = `FIRE_DLC_IMU_TYPE_NULL; // INTX HEADER - ALWAYS NULL
616 n_rds2eqs_eq_sel = 1'b0;
617 end
618
619 8'b0010_zz0_0:
620 begin
621 out_type = `FIRE_DLC_IMU_TYPE_NULL; // MSI HEADER - 4 of 7 errors - TURN TO NULL
622 n_rds2eqs_eq_sel = 1'b0;
623 end
624 8'b0010_1z1_0:
625 begin
626 out_type = `FIRE_DLC_IMU_TYPE_NULL; // MSI HEADER - 2 of 7 errors - TURN TO NULL
627 n_rds2eqs_eq_sel = 1'b0;
628 end
629 8'b0010_011_0:
630 begin
631 out_type = `FIRE_DLC_IMU_TYPE_NULL; // MSI HEADER - 1 of 7 errors - TURN TO NULL
632 n_rds2eqs_eq_sel = 1'b0;
633 end
634
635 8'b0010_001_0:
636 begin
637 out_type = `FIRE_DLC_IMU_TYPE_MSI_32; // MSI HEADER - GOOD HEADER - MSI TYPE
638 n_rds2eqs_eq_sel = 1'b1;
639 end
640
641 8'b0001_000_0:
642 begin
643 out_type = `FIRE_DLC_IMU_TYPE_NULL; // MESSAGE HEADER - BAD HEADER - TURN TO NULL
644 n_rds2eqs_eq_sel = 1'b0;
645 end
646
647 8'b0001_000_1:
648 begin
649 out_type = `FIRE_DLC_IMU_TYPE_MES_32; // MESSAGE HEADER - GOOD HEADER - MESSAGE TYPE
650 n_rds2eqs_eq_sel = 1'b1;
651 end
652
653 default:
654 begin
655 out_type = 7'b0000000;
656 n_rds2eqs_eq_sel = 1'b0;
657 end
658 endcase
659 end
660
661
662//--------------------------------
663// Concat all of the signals
664//--------------------------------
665assign n_rds2scs_rcd = {out_type, in_tc_del, in_attr_del, out_length, in_req_id_del, in_tlp_tag_del,
666 in_data_del, out_address, in_d_ptr_del, in_lrm_tag_del};
667
668
669assign n_rds2eqs_eq = message_sel_out ? message_eq_num : (msi_sel_out ? msi_eq_num: 6'h0);
670
671//--------------------------------
672// Live Header Fields Off of Fifo
673//--------------------------------
674
675assign in_type = {irs2rds_rcd[`FIRE_DLC_IIN_TYPE_LSB + `FIRE_DLC_IMU_ITYPE_DECODE_1], //bit 3 of type field
676 irs2rds_rcd[`FIRE_DLC_IIN_TYPE_LSB + `FIRE_DLC_IMU_ITYPE_DECODE_0] //bit 1 of type field
677 };
678
679assign in_message_code = irs2rds_rcd[`FIRE_DLC_IIN_DATA_MSB : `FIRE_DLC_IIN_DATA_LSB];
680
681//-----------------------------------------------------------------------------
682// The IMU decodes three different types of token based on the the valeu of the
683// in_type file.
684//
685// For this case, bits 3 and bits 1 will be choosen making the decode as
686// follows
687//
688// - MSI - bit[3] & !bit[1]
689// - MSG - !bit[3]
690// - MDO - bit[3] & bit[1]
691//
692// Since we are only doing a 3 type a full decode is not needed we can just look
693// two bits
694//-----------------------------------------------------------------------------
695
696assign msi_record = in_type[1] & ~in_type[0] & ~irs2rds_rcd_empty;
697assign message_record = ~in_type[1] & ~(in_message_code[7:4] == 4'b0010) & ~irs2rds_rcd_empty;
698assign mondo_record = in_type[1] & in_type[0] & ~irs2rds_rcd_empty;
699assign intx_record = ~in_type[1] & (in_message_code[7:4] == 4'b0010) & ~irs2rds_rcd_empty;
700
701
702//-----------------------------------------------------------------------------
703// Assign the Values to the Dequeue Signals for the Two fifo's
704//
705// The command fifo needs to be dequeued as long as its not empty
706//
707// The MSI data fifo only needs to be dequeued if its a MSI transaction
708//
709//-----------------------------------------------------------------------------
710
711assign rds2irs_rcd_deq = ~irs2rds_rcd_empty;
712
713assign rds2irs_data_deq = rds2irs_rcd_deq & msi_record & ~irs2rds_data_empty;
714
715
716
717//-----------------------------------------------------------------------------
718// Muxing Logic for PIO Path
719//
720//-----------------------------------------------------------------------------
721assign csrbus_acc_vio = msi_acc_vio | intx_acc_vio | message_acc_vio;
722assign csrbus_done = msi_done | intx_done | message_done;
723assign csrbus_mapped = msi_mapped | intx_mapped | message_mapped;
724assign csrbus_read_data = msi_done ? msi_read_data : (message_done ? message_read_data : intx_read_data);
725
726
727
728
729//-----------------------------------------------------------------------------
730// DATA PATH SETUP
731//
732//-----------------------------------------------------------------------------
733
734//----------------------
735// Decode delayed type
736//----------------------
737
738assign msi_record_del = in_type_del[`FIRE_DLC_IMU_ITYPE_DECODE_1] & ~in_type_del[`FIRE_DLC_IMU_ITYPE_DECODE_0];
739assign mondo_record_del = in_type_del[`FIRE_DLC_IMU_ITYPE_DECODE_1] & in_type_del[`FIRE_DLC_IMU_ITYPE_DECODE_0];
740
741//-----------------------------------------
742// Pick what the Data field will be
743// - for msi - msi_data
744// - for mes - message code
745//-----------------------------------------
746
747// assign eq_wr_data = msi_record_del ? in_msi_data_del : {8'h0, in_data_del};
748assign eq_wr_data = msi_record_del ? {in_msi_data_del[7:0],in_msi_data_del[15:8]} : {8'h0, in_data_del};
749
750assign rds_msi_data = msi_record_del ? in_msi_data_del : {16'h0};
751assign msi_x_wr_data = msi_record_del ? {in_msi_x_data_del[7:0],in_msi_x_data_del[15:8]} : {in_address_del[13:0], 2'h0};
752
753//-----------------------------------------
754// Assign Each Data Word
755//-----------------------------------------
756assign eq_wr_dw_0 = {1'b0, in_type_del, in_length_del,in_address_del[13:0],in_req_id_del,eq_wr_data};
757// assign eq_wr_dw_1 = {in_address_del, 2'b0};
758assign eq_wr_dw_1 = {in_address_del[61:14], msi_x_wr_data};
759
760
761//BP n2 11-21-05 assign mondo_dw_0 = in_mondo_mode_del ? {sw_mondo_data_0, in_mondo_ino_del} : {52'b0, in_mondo_tid_del, in_mondo_ino_del};
762assign mondo_dw_0 = in_mondo_mode_del ? {sw_mondo_data_0[57:6],in_mondo_tid_del, in_mondo_ino_del} : {52'b0, in_mondo_tid_del, in_mondo_ino_del};
763// assign mondo_dw_0 = in_mondo_mode_del ? {sw_mondo_data_0, in_mondo_ino_del} : {53'b0, mondo_jid, in_mondo_ino_del};
764assign mondo_dw_1 = in_mondo_mode_del ? sw_mondo_data_1 : 64'h0;
765
766//-----------------------------------------
767//Make the 128 bit bus
768//-----------------------------------------
769assign eq_wr_dms_data = {eq_wr_dw_0, eq_wr_dw_1};
770assign mondo_dms_data = {mondo_dw_0, mondo_dw_1};
771
772//-----------------------------------------
773//Make the 128 bit bus
774//-----------------------------------------
775
776assign n_rds2dms_data = mondo_record_del ? mondo_dms_data : eq_wr_dms_data;
777
778
779//-----------------------------------------------------------------------------
780// ERRORS
781//
782//-----------------------------------------------------------------------------
783assign rds2ics_msi_par_error = msi_parity_err;
784assign rds2ics_msi_mal_error = msi_malformed & ~msi_parity_err;
785assign rds2ics_msi_not_en_error = msi_not_enabled_error & ~(msi_parity_err | msi_malformed);
786
787assign rds2ics_error_data = {in_type_del[5:0],in_length_del,in_req_id_del,in_tlp_tag_del,in_data_del,rds_msi_data};
788
789assign mes_not_en_error = rds2ics_pmeack_mes_not_en_error |
790 rds2ics_pmpme_mes_not_en_error |
791 rds2ics_fatal_mes_not_en_error |
792 rds2ics_nonfatal_mes_not_en_error |
793 rds2ics_cor_mes_not_en_error;
794
795
796//############################################################################
797// SEQUENTIAL LOGIC
798//############################################################################
799
800//--------------------------------------------------------------------------
801// ALLOCATION of the DPTR for the MSI DIU RAM
802//
803// - The RAM is 1K with 64 rows and holds 16 cachelines of data
804// - Space is alloctaed on cachline boundry
805// - 16 lines is 4 bits
806// - C-F are dedicated to the Mondo (1100-1111)
807//
808// - Reset the value to the first RAM location
809//
810// - If new requests comes in advance the dptr in cicular fashion
811// - If no new request hold the value.
812//
813//--------------------------------------------------------------------------
814
815always @ (posedge clk)
816 if (!rst_l)
817 eq_write_d_ptr <= EQ_WRITE_FIRST_DPTR;
818 else if (inc_eq_write_ptr)
819 begin
820 if(eq_write_d_ptr == EQ_WRITE_LAST_DPTR)
821 eq_write_d_ptr <= EQ_WRITE_FIRST_DPTR;
822 else
823 eq_write_d_ptr <= eq_write_d_ptr + 1;
824 end
825 else
826 eq_write_d_ptr <= eq_write_d_ptr;
827
828
829//-----------------------------------------------------------------------------
830// Delay all of the In Record infomrtaion to keep in step with the pipeline.
831//
832//-----------------------------------------------------------------------------
833always @ (posedge clk)
834 if (!rst_l)
835 begin // At reset reset all of them to zero.
836 irs2rds_rcd_del <= {`FIRE_DLC_IIN_REC_WDTH{1'h0}};
837 irs2rds_data_del <= {`FIRE_DLC_MDF_REC_WDTH{1'h0}};
838 end
839 else
840 begin
841 irs2rds_rcd_del <= irs2rds_rcd;
842 irs2rds_data_del <= irs2rds_data;
843 end
844
845//-----------------------------------------------------------------------------
846// Delay error to keep in step with the pipeline.
847//
848//-----------------------------------------------------------------------------
849always @ (posedge clk)
850 if (!rst_l)
851 begin // At reset reset all of them to zero.
852 malformed_error_del <= 1'h0;
853 end
854 else
855 begin
856 malformed_error_del <= malformed_error;
857 end
858
859//-----------------------------------------------------------------------------
860// Flop the Out Record to the SCS
861//
862//-----------------------------------------------------------------------------
863always @ (posedge clk)
864 if (!rst_l)
865 begin // At reset reset all of them to zero.
866 rds2scs_rcd <= {`FIRE_DLC_IIN_REC_WDTH{1'h0}};
867 rds2scs_rcd_sel <= 1'h0;
868 end
869 else
870 begin
871 rds2scs_rcd <= n_rds2scs_rcd;
872 rds2scs_rcd_sel <= |all_type_sel; // if any of the stages where selected
873
874 end
875//-----------------------------------------------------------------------------
876// Flop the Data Record to the DMS
877//
878//-----------------------------------------------------------------------------
879always @ (posedge clk)
880 if (!rst_l)
881 begin // At reset reset all of them to zero.
882 rds2dms_data <= 128'h0;
883 rds2dms_data_sel <= 1'h0;
884 rds2dms_d_ptr <= 4'h0;
885 end
886 else
887 begin
888 rds2dms_data <= n_rds2dms_data;
889 rds2dms_data_sel <= |all_type_sel; // if any of the stages where selected
890 rds2dms_d_ptr <= n_rds2dms_d_ptr; // select the lower 4 bits
891 end
892
893
894
895 //-----------------------------------------------------------------------------
896// Flop the EQ Record to the EQS
897//
898//-----------------------------------------------------------------------------
899always @ (posedge clk)
900 if (!rst_l)
901 begin // At reset reset all of them to zero.
902 rds2eqs_eq <= 6'h0;
903 rds2eqs_eq_sel <= 1'h0;
904 end
905 else
906 begin
907 rds2eqs_eq <= n_rds2eqs_eq;
908 rds2eqs_eq_sel <= n_rds2eqs_eq_sel; // if any of the stages where selected
909
910 end
911
912assign rds2scs_eq = rds2eqs_eq;
913
914//-----------------------------------------------------
915// Debug Ports
916//-----------------------------------------------------
917
918always @ (dbg2rds_dbg_sel_a or msi_record or message_record or mondo_record or intx_record or irs2rds_rcd_empty or
919 mondo_sel_out or mondo_d_ptr or mondo_jid or intx_sel_out or in_message_code or
920 message_sel_out or message_hd_good or message_eq_num or msi_sel_out or msi_hd_good or msi_eq_num or
921 rds2scs_rcd_sel or rds2scs_rcd or rds2ics_msi_mal_error or rds2ics_msi_par_error or mes_not_en_error or
922 rds2ics_msi_not_en_error or msi_length_good or msi_first_be_good)
923 begin
924 case (dbg2rds_dbg_sel_a) // synopsys infer_mux
925 3'b000: n_dbg_a = {3'h0, msi_record, message_record, mondo_record, intx_record, irs2rds_rcd_empty};
926 3'b001: n_dbg_a = {3'h0, mondo_sel_out, mondo_d_ptr[3:0]};
927 3'b010: n_dbg_a = {1'b0, mondo_jid[4:0], mondo_record, intx_sel_out};
928 3'b011: n_dbg_a = {in_message_code[7:0]};
929 3'b100: n_dbg_a = {message_sel_out, message_hd_good,message_eq_num[5:0]};
930 3'b101: n_dbg_a = {msi_sel_out, msi_hd_good, msi_eq_num[5:0]};
931 3'b110: n_dbg_a = {rds2scs_rcd_sel, rds2scs_rcd[`FIRE_DLC_IIN_TYPE_MSB:`FIRE_DLC_IIN_TYPE_LSB]};
932 3'b111: n_dbg_a = {2'b00, rds2ics_msi_mal_error, rds2ics_msi_par_error, mes_not_en_error,
933 rds2ics_msi_not_en_error, msi_length_good, msi_first_be_good };
934 endcase
935 end
936
937always @ (dbg2rds_dbg_sel_b or msi_record or message_record or mondo_record or intx_record or irs2rds_rcd_empty or
938 mondo_sel_out or mondo_d_ptr or mondo_jid or intx_sel_out or in_message_code or
939 message_sel_out or message_hd_good or message_eq_num or msi_sel_out or msi_hd_good or msi_eq_num or
940 rds2scs_rcd_sel or rds2scs_rcd or rds2ics_msi_mal_error or rds2ics_msi_par_error or mes_not_en_error or
941 rds2ics_msi_not_en_error or msi_length_good or msi_first_be_good)
942 begin
943 case (dbg2rds_dbg_sel_b) // synopsys infer_mux
944 3'b000: n_dbg_b = {3'h0, msi_record, message_record, mondo_record, intx_record, irs2rds_rcd_empty};
945 3'b001: n_dbg_b = {3'h0, mondo_sel_out, mondo_d_ptr[3:0]};
946 3'b010: n_dbg_b = {1'b0, mondo_jid[4:0], mondo_record, intx_sel_out};
947 3'b011: n_dbg_b = {in_message_code[7:0]};
948 3'b100: n_dbg_b = {message_sel_out, message_hd_good,message_eq_num[5:0]};
949 3'b101: n_dbg_b = {msi_sel_out, msi_hd_good, msi_eq_num[5:0]};
950 3'b110: n_dbg_b = {rds2scs_rcd_sel, rds2scs_rcd[`FIRE_DLC_IIN_TYPE_MSB:`FIRE_DLC_IIN_TYPE_LSB]};
951 3'b111: n_dbg_b = {2'b00, rds2ics_msi_mal_error, rds2ics_msi_par_error, mes_not_en_error,
952 rds2ics_msi_not_en_error, msi_length_good, msi_first_be_good };
953 endcase
954 end
955
956
957always @ (posedge clk)
958 begin
959 if (!rst_l ) begin
960 dbg_a <= `FIRE_DEBUG_WDTH'b0;
961 dbg_b <= `FIRE_DEBUG_WDTH'b0;
962 end
963 else begin
964 dbg_a <= n_dbg_a;
965 dbg_b <= n_dbg_b;
966 end
967 end
968
969
970assign rds2dbg_dbg_a = dbg_a;
971assign rds2dbg_dbg_b = dbg_b;
972
973 //------------------------------------------------------------------------
974 // Idle Checkers
975 //------------------------------------------------------------------------
976assign rds2dbg_idle = ~rds2scs_rcd_sel &
977 ~(|all_type_sel) &
978 irs2rds_rcd_empty &
979 irs2rds_data_empty;
980
981
982
983//############################################################################
984// MODULE INSTANTIATIONS
985//############################################################################
986
987 dmu_imu_rds_mondo mondo(
988 .clk (clk),
989 .rst_l (rst_l),
990
991 .j2d_jid (1'b0),
992 .j2d_instance_id (1'b0),
993
994 .pipe_select_in (mondo_record),
995
996 .pipe_select_out (mondo_sel_out),
997 .mondo_d_ptr (mondo_d_ptr),
998 .mondo_jid (mondo_jid)
999
1000 );
1001
1002
1003
1004 dmu_imu_rds_mess mess(
1005 .clk (clk),
1006 .rst_l (rst_l),
1007
1008 .pipe_select_in (message_record),
1009 .message_code (in_message_code),
1010
1011 .pipe_select_out (message_sel_out),
1012 .header_good (message_hd_good),
1013 .message_eq_num (message_eq_num),
1014
1015 .rds2ics_pmeack_mes_not_en_error (rds2ics_pmeack_mes_not_en_error),
1016 .rds2ics_pmpme_mes_not_en_error (rds2ics_pmpme_mes_not_en_error),
1017 .rds2ics_fatal_mes_not_en_error (rds2ics_fatal_mes_not_en_error),
1018 .rds2ics_nonfatal_mes_not_en_error (rds2ics_nonfatal_mes_not_en_error),
1019 .rds2ics_cor_mes_not_en_error (rds2ics_cor_mes_not_en_error),
1020
1021 .csrbus_valid (csrbus_valid),
1022 .csrbus_done (message_done),
1023 .csrbus_mapped (message_mapped),
1024 .csrbus_wr_data (csrbus_wr_data),
1025 .csrbus_wr (csrbus_wr),
1026 .csrbus_read_data (message_read_data),
1027 .csrbus_addr (csrbus_addr),
1028
1029 .csrbus_src_bus (csrbus_src_bus),
1030 .csrbus_acc_vio (message_acc_vio),
1031 .j2d_instance_id (j2d_instance_id)
1032
1033
1034 );
1035
1036
1037
1038 dmu_imu_rds_msi msi(
1039 .clk (clk),
1040 .rst_l (rst_l),
1041
1042 .pipe_select_in (msi_record),
1043// .msi_data (irs2rds_data[15:8]),
1044 .msi_data (irs2rds_data[31:24]),
1045 .msi_error (msi_error),
1046
1047 .pipe_select_out (msi_sel_out),
1048 .header_good (msi_hd_good),
1049 .msi_eq_num (msi_eq_num),
1050 .msi_not_enabled_error (msi_not_enabled_error),
1051
1052 .sw_mondo_data_0 (sw_mondo_data_0),
1053 .sw_mondo_data_1 (sw_mondo_data_1),
1054
1055 .csrbus_valid (csrbus_valid),
1056 .csrbus_done (msi_done),
1057 .csrbus_mapped (msi_mapped),
1058 .csrbus_wr_data (csrbus_wr_data),
1059 .csrbus_wr (csrbus_wr),
1060 .csrbus_read_data (msi_read_data),
1061 .csrbus_addr (csrbus_addr),
1062
1063 .csrbus_src_bus (csrbus_src_bus),
1064 .csrbus_acc_vio (msi_acc_vio),
1065 .j2d_instance_id (j2d_instance_id)
1066
1067
1068 );
1069
1070
1071 dmu_imu_rds_intx intx(
1072 .clk (clk),
1073 .rst_l (rst_l),
1074
1075 .pipe_select_in (intx_record),
1076 .message_code (in_message_code),
1077
1078 .pipe_select_out (intx_sel_out),
1079 .rds2iss_intx_int_l (rds2iss_intx_int_l),
1080
1081
1082 .csrbus_valid (csrbus_valid),
1083 .csrbus_done (intx_done),
1084 .csrbus_mapped (intx_mapped),
1085 .csrbus_wr_data (csrbus_wr_data),
1086 .csrbus_wr (csrbus_wr),
1087 .csrbus_read_data (intx_read_data),
1088 .csrbus_addr (csrbus_addr),
1089
1090 .csrbus_src_bus (csrbus_src_bus),
1091 .csrbus_acc_vio (intx_acc_vio),
1092 .j2d_instance_id (j2d_instance_id)
1093
1094
1095 );
1096
1097
1098
1099endmodule