// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: dmu_clu_crm_pktgen.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 ============================================
module dmu_clu_crm_pktgen
// cru : config packet setup
// >>>>>>>>>>>>>>>>>>>>>>>>> Parameter Declarations <<<<<<<<<<<<<<<<<<<<<<<<<
// --------------------------------------------------------
// DMA/INT Command Record (DCR) Field Widths
// --------------------------------------------------------
parameter DCR_CMD_WDTH = `FIRE_J2D_DI_CMD_WDTH,
// --------------------------------------------------------
// PIO Command Record (PCR) Field Widths
// --------------------------------------------------------
parameter PCR_CMD_WDTH = `FIRE_J2D_P_CMD_WDTH,
PCR_ADDR_WDTH = `FIRE_J2D_P_ADDR_WDTH,
PCR_BMSK_WDTH = `FIRE_J2D_P_BMSK_WDTH,
// PCTAG_AGNTID_WDTH = 4,
// PCTAG_TRNSID_WDTH = 2;
// --------------------------------------------------------
// PIO JBC-to-DMC Command Encoding
// --------------------------------------------------------
parameter PWR_BLK_M64 = 4'b0000,
// --------------------------------------------------------
// Unsupported Request Record (URR) Type Encoding
// --------------------------------------------------------
parameter DMA_MRD_ERR = 3'b001,
// --------------------------------------------------------
// Egress Packet Record (EPR) Type Encoding
// --------------------------------------------------------
parameter PIO_MRD_32BIT = 7'b00_00000,
PIO_MRD_64BIT = 7'b01_00000,
PIO_CFGRD_TYP0 = 7'b00_00100,
PIO_CFGRD_TYP1 = 7'b00_00101,
PIO_MWR_32BIT = 7'b10_00000,
PIO_MWR_64BIT = 7'b11_00000,
PIO_CFGWR_TYP0 = 7'b10_00100,
PIO_CFGWR_TYP1 = 7'b10_00101,
// --------------------------------------------------------
// Valid EPR Length Encodings
// --------------------------------------------------------
parameter ONE_DW = `FIRE_DLC_EPR_LEN_WDTH'h1,
TWO_DW = `FIRE_DLC_EPR_LEN_WDTH'h2,
FOUR_DW = `FIRE_DLC_EPR_LEN_WDTH'h4,
SIXTEEN_DW = `FIRE_DLC_EPR_LEN_WDTH'h10;
// >>>>>>>>>>>>>>>>>>>>>>>>> Port Declarations <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// --------------------------------------------------------
// --------------------------------------------------------
// --------------------------------------------------------
// --------------------------------------------------------
output [(`FIRE_DLC_EPR_REC_WDTH - 1):0] cl2cm_rcd;
// --------------------------------------------------------
// --------------------------------------------------------
// scoreboard access port
output [(`FIRE_DLC_PSR_TRN_WDTH - 1):0] cl2ps_e_trn;
output [(`FIRE_DLC_PSR_PIO_DATA_WDTH - 1):0] cl2ps_e_wr_data;
input [(`FIRE_DLC_PSR_BYTECNT_WDTH - 1):0] psb_rd_bcnt;
input [(`FIRE_DLC_PSR_LENGTH_WDTH - 1):0] psb_rd_len;
input [(`FIRE_DLC_PSR_PKSEQ_WDTH - 1):0] psb_rd_pktseq;
input [(`FIRE_DLC_PSR_CNTX_WDTH - 1):0] psb_rd_cntxtnum;
input [(`FIRE_DLC_PSR_TRTAG_WDTH - 1):0] psb_rd_sbdtag;
// --------------------------------------------------------
// --------------------------------------------------------
// ----- Config Packet Setup -----
input [`FIRE_PCIE_BUS_NUM_BITS] cr2cl_bus_num;
// --------------------------------------------------------
// --------------------------------------------------------
output [3:0] crm2ctm_tag;
// --------------------------------------------------------
// --------------------------------------------------------
// --------------------------------------------------------
// --------------------------------------------------------
input [(DCR_CMD_WDTH - 1):0] dcr_cmd;
input [(DCTAG_TRNSNUM_WDTH - 1):0] dcr_ctag_trnsnum;
input [(DCTAG_DPTR_WDTH - 1):0] dcr_ctag_dptr;
input [(DCR_PKTAG_WDTH - 1):0] dcr_pktag;
// --------------------------------------------------------
// --------------------------------------------------------
input [(PCR_CMD_WDTH - 1):0] pcr_cmd;
input [(PCR_ADDR_WDTH - 1):0] pcr_addr;
input [(PCR_BMSK_WDTH - 1):0] pcr_bmsk;
input [(PCTAG_TRNSNUM_WDTH - 1):0] pcr_ctag_trnsnum;
// input [(PCTAG_AGNTID_WDTH - 1):0] pcr_ctag_agntid;
// input [(PCTAG_TRNSID_WDTH - 1):0] pcr_ctag_trnsid;
input [(PCTAG_THRDID_WDTH - 1):0] pcr_ctag_thrdid;
// --------------------------------------------------------
// --------------------------------------------------------
input [(`FIRE_DLC_CLU_URR_TYP_WDTH - 1):0] urr_typ;
input [(`FIRE_DLC_CLU_URR_SBDTAG_WDTH - 1):0] urr_sbdtag;
// --------------------------------------------------------
// --------------------------------------------------------
// >>>>>>>>>>>>>>>>>>>>>>>>> Data Type Declarations <<<<<<<<<<<<<<<<<<<<<<<<<
// ~~~~~~~~~~~~~~~~~~~~~~~~~ REGISTERS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ********** Flops **********
reg [(`FIRE_DLC_EPR_TYP_WDTH - 1):0] epr_typ;
reg [(`FIRE_DLC_EPR_LEN_WDTH - 1):0] epr_len;
reg [(`FIRE_DLC_EPR_DWBE_WDTH/2 - 1):0] epr_ldwbe;
reg [(`FIRE_DLC_EPR_DWBE_WDTH/2 - 1):0] epr_fdwbe;
reg [(`FIRE_DLC_EPR_ADDR_WDTH - 1):0] epr_addr;
reg [(`FIRE_DLC_EPR_SBDTAG_WDTH - 1):0] epr_sbdtag;
reg [(`FIRE_DLC_EPR_DPTR_WDTH - 1):0] epr_dptr;
reg [(`FIRE_DLC_EPR_PKSEQNUM_WDTH - 1):0] epr_pkseqnum;
reg [(`FIRE_DLC_EPR_CNTXTNUM_WDTH - 1):0] epr_cntxtnum;
// psb interface registers
reg [(`FIRE_DLC_PSR_TRN_WDTH - 1):0] cl2ps_e_trn;
reg [(`FIRE_DLC_PSR_PIO_DATA_WDTH - 1):0] cl2ps_e_wr_data;
// ********** Non-Flops ******
// dcr pktgen field declarations
reg [(`FIRE_DLC_EPR_TYP_WDTH - 1):0] dcr_pkt_typ;
// pcr pktgen field declarations
reg [(`FIRE_DLC_EPR_TYP_WDTH - 1):0] pcr_pkt_typ;
reg [(`FIRE_DLC_EPR_LEN_WDTH - 1):0] pcr_pkt_len;
reg [(`FIRE_DLC_EPR_DWBE_WDTH/2 - 1):0] pcr_pkt_ldwbe;
reg [(`FIRE_DLC_EPR_DWBE_WDTH/2 - 1):0] pcr_pkt_fdwbe;
// urr field declarations
reg [(`FIRE_DLC_EPR_TYP_WDTH - 1):0] urr_pkt_typ;
// epr field declarations
reg [(`FIRE_DLC_EPR_TYP_WDTH - 1):0] nxt_epr_typ;
reg [(`FIRE_DLC_EPR_LEN_WDTH - 1):0] nxt_epr_len;
reg [(`FIRE_DLC_EPR_DWBE_WDTH/2 - 1):0] nxt_epr_fdwbe;
reg [(`FIRE_DLC_EPR_ADDR_WDTH - 1):0] nxt_epr_addr;
reg [(`FIRE_DLC_EPR_SBDTAG_WDTH - 1):0] nxt_epr_sbdtag;
reg [(`FIRE_DLC_EPR_DPTR_WDTH - 1):0] nxt_epr_dptr;
reg [(`FIRE_DLC_PSR_TRN_WDTH - 1):0] nxt_psb_trn;
// ~~~~~~~~~~~~~~~~~~~~~~~~~ NETS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// dcr field declarations
wire [(`FIRE_DLC_EPR_DWBE_WDTH/2 - 1):0] dcr_pkt_fdwbe;
wire [(`FIRE_DLC_EPR_DPTR_WDTH - 1):0] dcr_pkt_dptr;
// pcr pktgen field declarations
wire [(`FIRE_DLC_EPR_ADDR_WDTH - 1):0] pcr_pkt_addr;
wire [(`FIRE_DLC_EPR_SBDTAG_WDTH - 1):0] pcr_pkt_sbdtag;
wire [(`FIRE_DLC_EPR_DPTR_WDTH - 1):0] pcr_pkt_dptr;
// urr field declarations
wire [(`FIRE_DLC_EPR_DWBE_WDTH/2 - 1):0] urr_pkt_fdwbe;
// epr field declarations
wire [(`FIRE_DLC_EPR_DWBE_WDTH/2 - 1):0] nxt_epr_ldwbe;
wire [(`FIRE_DLC_EPR_PKSEQNUM_WDTH - 1):0] nxt_epr_pkseqnum;
wire [(`FIRE_DLC_EPR_CNTXTNUM_WDTH - 1):0] nxt_epr_cntxtnum;
// >>>>>>>>>>>>>>>>>>>>>>>>> 0-in Checkers <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-var {mdo_vld, drd_vld, tdr_vld}
-active ~`CPU.dmu.dmc.clu.crm.dcr_fifo_empty
// >>>>>>>>>>>>>>>>>>>>>>>>> RTL Model <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// --------------------------------------------------------
// DCR-TO-EPR PKTGEN (DMA/MDO PROCESSING)
// --------------------------------------------------------
// ----- Type Decode --------------------------------------------------------
assign mdo_vld = dcr_cmd[1];
assign drd_vld = ~dcr_cmd[1] & ~dcr_ctag_typ;
assign tdr_vld = ~dcr_cmd[1] & dcr_ctag_typ;
// ----- First DWBE Gen -----------------------------------------------------
// cpl_sts for dma cpl is always successfull -> 000
// mdo_tag is taken from bits 2:1 of dcr_pktag field
assign mdo_tag = dcr_pktag[1:0];
// ===================================================
// dcr_cmd[1:0] : 11 = int ack, 10 = int nack
// dcr_cmd[0] differs int ack from int nack
// mdo_sts : 1 = ack, 0 = nack
// mapping dcr_cmd[0] to mdo_sts sets mdo_sts
// ====================================================
assign mdo_sts = dcr_cmd[0];
always @(dcr_cmd[1] or cpl_sts or mdo_tag or mdo_sts)
if (dcr_cmd[1]) // 0 = dma, 1 = mdo
fdwbe_2to0 = {mdo_tag, mdo_sts};
// construct fdwbe : fdwbe[3] is rsv for all dcr types
assign dcr_pkt_fdwbe = {1'b0, fdwbe_2to0};
// ----- DPTR Gen -----------------------------------------------------------
// msb of dptr indicates DOU section : 0 = dma, 1 = pio
assign dcr_pkt_dptr = {1'b0, dcr_ctag_dptr};
// --------------------------------------------------------
// PCR-TO-EPR PKTGEN (PIO PROCESSING)
// --------------------------------------------------------
// ----- Type Decode --------------------------------------------------------
// cfg typ : typ0 -> pkt_bus# == prog_bus#; typ1-> pkt_bus# != prog_bus#
always @(cr2cl_bus_num or pcr_addr[27:20])
if (cr2cl_bus_num == pcr_addr[27:20])
always @(pcr_cmd or pcfg_typ)
pcr_pkt_typ = {`FIRE_DLC_EPR_TYP_WDTH{1'b0}};
/* 0in < case -parallel -full
-active ~`CPU.dmu.dmc.clu.crm.pcr_fifo_empty
PRD_16B_M32 : pcr_pkt_typ = PIO_MRD_32BIT;
PRD_16B_M64 : pcr_pkt_typ = PIO_MRD_64BIT;
PRD_16B_IO : pcr_pkt_typ = PIO_IORD;
pcr_pkt_typ = PIO_CFGRD_TYP1;
pcr_pkt_typ = PIO_CFGRD_TYP0;
PWR_16B_M32 : pcr_pkt_typ = PIO_MWR_32BIT;
PWR_16B_M64 : pcr_pkt_typ = PIO_MWR_64BIT;
PWR_16B_IO : pcr_pkt_typ = PIO_IOWR;
pcr_pkt_typ = PIO_CFGWR_TYP1;
pcr_pkt_typ = PIO_CFGWR_TYP0;
assign pcr_typ = pcr_cmd[3]; // 0 = write, 1 = read
// ----- Len & First/Last DWBE Gen ------------------------------------------
assign pbmsk_dw3_vld = |pcr_bmsk[15:12];
assign pbmsk_dw2_vld = |pcr_bmsk[11:8];
assign pbmsk_dw1_vld = |pcr_bmsk[7:4];
assign pbmsk_dw0_vld = |pcr_bmsk[3:0];
// len & f/l_dwbe gen: pcr_cmd[2] -> 0 = 64 byte, 1 = 16 byte
always @(pcr_cmd[2] or pbmsk_dw3_vld or pbmsk_dw2_vld or
pbmsk_dw1_vld or pbmsk_dw0_vld or pcr_bmsk)
pcr_pkt_len = {`FIRE_DLC_EPR_LEN_WDTH{1'b0}};
pcr_pkt_ldwbe = {`FIRE_DLC_EPR_DWBE_WDTH/2{1'b0}};
pcr_pkt_fdwbe = {`FIRE_DLC_EPR_DWBE_WDTH/2{1'b0}};
casez ({pcr_cmd[2], pbmsk_dw3_vld, pbmsk_dw2_vld, pbmsk_dw1_vld,
/* 0in < case -parallel -full
-active ~`CPU.dmu.dmc.clu.crm.pcr_fifo_empty
// len = 16DW; fdwbe = 0xF; ldwbe = 0xF
pcr_pkt_len = SIXTEEN_DW;
pcr_pkt_ldwbe = {(`FIRE_DLC_EPR_DWBE_WDTH/2){1'b1}};
pcr_pkt_fdwbe = {(`FIRE_DLC_EPR_DWBE_WDTH/2){1'b1}};
// len = 0DW; fdwbe = 0x0; ldwbe = 0x0
pcr_pkt_ldwbe = {(`FIRE_DLC_EPR_DWBE_WDTH/2){1'b0}};
pcr_pkt_fdwbe = {(`FIRE_DLC_EPR_DWBE_WDTH/2){1'b0}};
// len = 1DW, DW0; fdwbe = jbc_bmsk[0:3]; ldwbe = 0x0
pcr_pkt_ldwbe = {(`FIRE_DLC_EPR_DWBE_WDTH/2){1'b0}};
pcr_pkt_fdwbe = {pcr_bmsk[0], pcr_bmsk[1], pcr_bmsk[2],
// len = 1DW, DW1; fdwbe = jbc_bmsk[4:7]; ldwbe = 0x0
pcr_pkt_ldwbe = {(`FIRE_DLC_EPR_DWBE_WDTH/2){1'b0}};
pcr_pkt_fdwbe = {pcr_bmsk[4], pcr_bmsk[5], pcr_bmsk[6],
// len = 1DW, DW2; fdwbe = jbc_bmsk[8:11]; ldwbe = 0x0
pcr_pkt_ldwbe = {(`FIRE_DLC_EPR_DWBE_WDTH/2){1'b0}};
pcr_pkt_fdwbe = {pcr_bmsk[8], pcr_bmsk[9], pcr_bmsk[10],
// len = 1DW, DW3; fdwbe = jbc_bmsk[12:15]; ldwbe = 0x0
pcr_pkt_ldwbe = {(`FIRE_DLC_EPR_DWBE_WDTH/2){1'b0}};
pcr_pkt_fdwbe = {pcr_bmsk[12], pcr_bmsk[13], pcr_bmsk[14],
// len = 2DW, DW01; fdwbe = jbc_bmsk[4:7]; ldwbe = jbc_bmsk[0:3]
pcr_pkt_ldwbe = {pcr_bmsk[0], pcr_bmsk[1], pcr_bmsk[2],
pcr_pkt_fdwbe = {pcr_bmsk[4], pcr_bmsk[5], pcr_bmsk[6],
// len = 2DW, DW23; fdwbe = jbc_bmsk[12:15]; ldwbe = jbc_bmsk[8:11]
pcr_pkt_ldwbe = {pcr_bmsk[8], pcr_bmsk[9], pcr_bmsk[10],
pcr_pkt_fdwbe = {pcr_bmsk[12], pcr_bmsk[13], pcr_bmsk[14],
// len = 4DW; fdwbe = 0xF; ldwbe = 0xF
pcr_pkt_ldwbe = {(`FIRE_DLC_EPR_DWBE_WDTH/2){1'b1}};
pcr_pkt_fdwbe = {(`FIRE_DLC_EPR_DWBE_WDTH/2){1'b1}};
// ----- Addr Gen -----------------------------------------------------------
// set addr[31:12] for cfg/non-cfg transactions
always @(pcr_cmd[2:0] or pcr_addr[31:12])
paddr_31to12 = pcr_addr[31:12] << 4;
paddr_31to12 = pcr_addr[31:12];
// set addr[34:2] for all transactions
assign pcr_pkt_addr = {pcr_addr[35:32], paddr_31to12, pcr_addr[11:2]};
// ----- Sbdtag Gen ---------------------------------------------------------
// ===================================================
// pcr_cmd[3] -> 0 = wr, 1 = rd
// tlp_tag[4] -> 0 = rd, 1 = wr
// mapping pcr_cmd[3] to tlp_tag[4] sets the type
// ====================================================
assign pcr_pkt_sbdtag = {~pcr_cmd[3], pcr_ctag_trnsnum};
// ----- Dptr Gen -----------------------------------------------------------
// msb of dptr indicates DOU section : 1'b0 = dma, 1'b1 = pio
assign pcr_pkt_dptr = {2'b10, pcr_ctag_trnsnum};
// --------------------------------------------------------
// URR-TO-EPR PKTGEN (UNSUPPORTED REQ PROCESSING)
// --------------------------------------------------------
// ----- Type Decode --------------------------------------------------------
urr_pkt_typ = {`FIRE_DLC_EPR_TYP_WDTH{1'b0}};
/* 0in < case -parallel -full
-active ~`CPU.dmu.dmc.clu.crm.urr_fifo_empty
DMA_MRD_ERR, UNS_REQ : urr_pkt_typ = DMA_CPL;
DMA_MRD_LK : urr_pkt_typ = DMA_CPLLK;
// ----- First DWBE Gen -----------------------------------------------------
// ===================================================
// fdwbe[2:0] = cpl_sts[2:0]
// ---------------- -----------------------------
// 3'b001 -> MRDERR : 3'b100 -> completer abort
// 3'b010 -> UR : 3'b001 -> unsupported request
// 3'b100 -> MRDLK : 3'b001 -> unsupported request
// cpl_sts[0] = type[2] | type[1]
// ===================================================
assign urr_pkt_fdwbe = {1'b0, urr_typ[0], 1'b0, (urr_typ[2] | urr_typ[1])};
// --------------------------------------------------------
// --------------------------------------------------------
// ##########################################################################
// ----- select typ and fdwbe : from dcr/pcr/urr fifos -----
always @(pkt_sel or dcr_pkt_typ or dcr_pkt_fdwbe or pcr_pkt_typ or
pcr_pkt_fdwbe or urr_pkt_typ or urr_pkt_fdwbe)
// 1st_dwbe[3] is rsv for all dcr/urr types - only one extra mux
case (pkt_sel) // synopsys infer_mux
nxt_epr_typ = dcr_pkt_typ;
nxt_epr_fdwbe = dcr_pkt_fdwbe;
nxt_epr_typ = pcr_pkt_typ;
nxt_epr_fdwbe = pcr_pkt_fdwbe;
nxt_epr_typ = urr_pkt_typ;
nxt_epr_fdwbe = urr_pkt_fdwbe;
// ##########################################################################
// ----- select dptr : from dcr/pcr fifos -----
always @(pkt_sel or dcr_pkt_dptr or pcr_pkt_dptr)
case (pkt_sel) // synopsys infer_mux
nxt_epr_dptr = dcr_pkt_dptr;
nxt_epr_dptr = pcr_pkt_dptr;
// sel urr pkt : dptr is rsv for all urr types
nxt_epr_dptr = {`FIRE_DLC_EPR_DPTR_WDTH{1'b0}};
// ##########################################################################
// ----- select len, addr, sbdtag : from pcr fifo or psb (dcr/urr) -----
always @(done_psb_rd or pcr_pkt_len or pcr_pkt_addr or pcr_pkt_sbdtag or
psb_rd_len or psb_rd_bcnt or psb_rd_sbdtag)
// addr[33:12] rsv for all dcr/urr types
nxt_epr_addr[33:12] = pcr_pkt_addr[33:12];
case (done_psb_rd) // synopsys infer_mux
// sel pcr pkt (default to pcr)
nxt_epr_len = pcr_pkt_len;
nxt_epr_addr[11:0] = pcr_pkt_addr[11:0];
nxt_epr_sbdtag = pcr_pkt_sbdtag;
// note : len, sbdtag & addr[11:0] is rsv for dcr-mdo_cpl, but
// used for other dcr types
// sel dcr/urr pkt (from psb)
nxt_epr_len = psb_rd_len;
nxt_epr_addr[11:0] = psb_rd_bcnt;
nxt_epr_sbdtag = psb_rd_sbdtag;
// ##########################################################################
// select ldwbe : rsv for all dcr/urr types
assign nxt_epr_ldwbe = pcr_pkt_ldwbe;
// select pkseq# and cntxt# : rsv for all pcr types and dcr-mdo_cpls
assign nxt_epr_pkseqnum = psb_rd_pktseq;
assign nxt_epr_cntxtnum = psb_rd_cntxtnum;
// ##########################################################################
// register epr fields that do not involve psb
epr_typ <= `FIRE_DLC_EPR_TYP_WDTH'b0;
epr_ldwbe <= {(`FIRE_DLC_EPR_DWBE_WDTH/2){1'b0}};
epr_fdwbe <= {(`FIRE_DLC_EPR_DWBE_WDTH/2){1'b0}};
epr_dptr <= `FIRE_DLC_EPR_DPTR_WDTH'b0;
epr_ldwbe <= nxt_epr_ldwbe;
epr_fdwbe <= nxt_epr_fdwbe;
epr_dptr <= nxt_epr_dptr;
// register epr fields that require psb access
epr_len <= `FIRE_DLC_EPR_LEN_WDTH'b0;
epr_addr <= `FIRE_DLC_EPR_ADDR_WDTH'b0;
epr_sbdtag <= `FIRE_DLC_EPR_SBDTAG_WDTH'b0;
epr_pkseqnum <= `FIRE_DLC_EPR_PKSEQNUM_WDTH'b0;
epr_cntxtnum <= `FIRE_DLC_EPR_CNTXTNUM_WDTH'b0;
else if (done_psb_rd | epr_ld)
epr_addr <= nxt_epr_addr;
epr_sbdtag <= nxt_epr_sbdtag;
epr_pkseqnum <= nxt_epr_pkseqnum;
epr_cntxtnum <= nxt_epr_cntxtnum;
assign cl2cm_rcd = {epr_typ, epr_len, epr_ldwbe, epr_fdwbe, epr_addr,
epr_sbdtag, epr_dptr, epr_pkseqnum, epr_cntxtnum};
// --------------------------------------------------------
// PSB INTERFACE (TRN/WRDATA)
// --------------------------------------------------------
// next psb trn : pkt_sel -> 00 = dma, 01 = pio, 10 = urr
always @(dcr_pktag or pcr_ctag_trnsnum or urr_sbdtag or trn_sel)
case (trn_sel) // synopsys infer_mux
2'b11 : nxt_psb_trn = dcr_pktag; // dma_cpl
2'b01 : nxt_psb_trn = {1'b0, pcr_ctag_trnsnum}; // pio_rd
2'b10 : nxt_psb_trn = urr_sbdtag; // uns_req
// register psb wr_data/trn
cl2ps_e_wr_data <= `FIRE_DLC_PSR_PIO_DATA_WDTH'b0;
cl2ps_e_trn <= `FIRE_DLC_PSR_TRN_WDTH'b0;
// cl2ps_e_wr_data <= {pcr_ctag_agntid, pcr_ctag_trnsid};
cl2ps_e_wr_data <= {pcr_ctag_thrdid};
cl2ps_e_trn <= nxt_psb_trn;
// --------------------------------------------------------
// CTM INTERFACE (TAG/CREDIT RETURN)
// --------------------------------------------------------
crm2ctm_tag <= dcr_ctag_trnsnum;
endmodule // dmu_clu_crm_pktgen