// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: dmu_imu_irs.v
// Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
// 4150 Network Circle, Santa Clara, California 95054, U.S.A.
// * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// For the avoidance of doubt, and except that if any non-GPL license
// choice is available it will apply instead, Sun elects to use only
// the General Public License version 2 (GPLv2) at this time for any
// software where a choice of GPL license versions is made
// available with the language indicating that GPLv2 or any later version
// may be used, or where a choice of which version of the GPL is applied is
// otherwise unspecified.
// Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
// CA 95054 USA or visit www.sun.com if you need additional information or
// ========== Copyright Header End ============================================
// Inputs to Record Header Queue from LRM
//Record Header Queue Interface to RDS
// Inputs to Record Data Queue from LRM
//Data Queue Interface to RDS
//############################################################################
//############################################################################
//------------------------------------------------------------------------
// Clock and Reset Signals
//------------------------------------------------------------------------
//------------------------------------------------------------------------
// Inputs to Record Header Queue from LRM
//------------------------------------------------------------------------
input [`FIRE_DLC_IIN_REC_WDTH-1:0] rm2im_rcd;
//------------------------------------------------------------------------
// Record Header Queue Interface to RDS
//------------------------------------------------------------------------
output [`FIRE_DLC_IIN_REC_WDTH-1:0] irs2rds_rcd;
output irs2rds_rcd_empty;
//------------------------------------------------------------------------
// Inputs to Record Data Queue from LRM
//------------------------------------------------------------------------
input [`FIRE_DLC_MDF_REC_WDTH-1:0] tm2im_data;
//------------------------------------------------------------------------
// Data Queue Interface to RDS
//------------------------------------------------------------------------
output [`FIRE_DLC_MDF_REC_WDTH-1:0] irs2rds_data;
output irs2rds_data_empty;
//------------------------------------------------------------------------
//------------------------------------------------------------------------
input [2:0] dbg2irs_dbg_sel_a;
input [2:0] dbg2irs_dbg_sel_b;
output [`FIRE_DEBUG_WDTH-1:0] irs2dbg_dbg_a;
output [`FIRE_DEBUG_WDTH-1:0] irs2dbg_dbg_b;
//######################## END PORT DECLARATIONS #############################
//**************************************************
// Registers that Are Not Flops
//**************************************************
reg [`FIRE_DEBUG_WDTH-1:0] n_dbg_a;
reg [`FIRE_DEBUG_WDTH-1:0] n_dbg_b;
//**************************************************
// Registers that Are Flops
//**************************************************
reg [`FIRE_DEBUG_WDTH-1:0] dbg_a;
reg [`FIRE_DEBUG_WDTH-1:0] dbg_b;
//-----------------------------------------------------
//-----------------------------------------------------
always @ (dbg2irs_dbg_sel_a or rm2im_rcd_enq or rm2im_rcd or tm2im_data or tm2im_data_enq or
rds2irs_rcd_deq or irs2rds_rcd_empty or rds2irs_data_deq or irs2rds_data_empty)
case (dbg2irs_dbg_sel_a) // synopsys infer_mux
3'b000: n_dbg_a = {rm2im_rcd_enq, rm2im_rcd[`FIRE_DLC_IIN_TYPE_MSB:`FIRE_DLC_IIN_TYPE_LSB]};
3'b001: n_dbg_a = {rm2im_rcd[`FIRE_DLC_IIN_LRMTAG_MSB:`FIRE_DLC_IIN_LRMTAG_LSB]};
3'b010: n_dbg_a = {tm2im_data[7:0]};
3'b011: n_dbg_a = {tm2im_data[15:8]};
3'b100: n_dbg_a = {2'h0, tm2im_data_enq, tm2im_data[16], rds2irs_rcd_deq,
irs2rds_rcd_empty, rds2irs_data_deq, irs2rds_data_empty};
always @ (dbg2irs_dbg_sel_b or rm2im_rcd_enq or rm2im_rcd or tm2im_data or tm2im_data_enq or
rds2irs_rcd_deq or irs2rds_rcd_empty or rds2irs_data_deq or irs2rds_data_empty )
case (dbg2irs_dbg_sel_b) // synopsys infer_mux
3'b000: n_dbg_b = {rm2im_rcd_enq, rm2im_rcd[`FIRE_DLC_IIN_TYPE_MSB:`FIRE_DLC_IIN_TYPE_LSB]};
3'b001: n_dbg_b = {rm2im_rcd[`FIRE_DLC_IIN_LRMTAG_MSB:`FIRE_DLC_IIN_LRMTAG_LSB]};
3'b010: n_dbg_b = {tm2im_data[7:0]};
3'b011: n_dbg_b = {tm2im_data[15:8]};
3'b100: n_dbg_b = {2'h0, tm2im_data_enq, tm2im_data[16], rds2irs_rcd_deq,
irs2rds_rcd_empty, rds2irs_data_deq, irs2rds_data_empty};
assign irs2dbg_dbg_a = dbg_a;
assign irs2dbg_dbg_b = dbg_b;
//############################################################################
//############################################################################
//------------------------------------------------------------------------
// Header Fifo for All Commands Comming from LRM
// Total Data storage = 131 * 2 = 262 Flops
//------------------------------------------------------------------------
dmu_common_simple_fifo #(`FIRE_DLC_IIN_REC_WDTH,2'd2,1,1'd1) simple_fifo_header (
.fifo_empty (irs2rds_rcd_empty)
//------------------------------------------------------------------------
// Data Fifo for MSI Commands Comming from LRM
// Total Data storage = 17 * 8 = 136 Flops
//------------------------------------------------------------------------
dmu_common_simple_fifo #(`FIRE_DLC_MDF_REC_WDTH,4'd8,3, 3'd7) simple_fifo_data (
.data_out (irs2rds_data),
.read (rds2irs_data_deq),
.fifo_empty (irs2rds_data_empty)