Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / env / ilu_peu / vera / strategy / ilupeuIngressTlpStrategy.vr
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T2 Processor File: ilupeuIngressTlpStrategy.vr
// 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
// have any questions.
//
// ========== Copyright Header End ============================================
class ilupeuIngressTlpStrategy extends ilupeuTlpStrategyBase {
//Inherited from ilupeuTlpStrategyBase
// CSRCollection CSR;
// ReportClass Report;
// ilupeuPodClass Pod;
// ilupeuScenario Scenario;
//Random Utilities
// FNXRandomUtil RandUtil;
//Transaction and Packet Types
// FNXPCIEXactorTransaction TlpTrans;
// FNXPCIEXactorPacket TlpPkt;
// bit [ILUPEU_TLP_HDR_WIDTH-1:0] tlpHdr = {ILUPEU_TLP_HDR_WIDTH{1'b0}};
// LPUXtrDataTLP LPUXtrTlpPkt;
//Payload arrays
// bit [7:0] pyldByteAry[*];
// bit [31:0] pyldDWAry[*];
// bit [31:0] pyldDW;
// integer dataSpec = 0;
//#ifdef N2_FC
//After constructing the class with new set the
// variables below before calling Execute().
//
// bit [7:0] pyldFirstByteValue = 0;
// bit [63:0] tlpAddr = 0;
//#endif
//Constructor
task new ( ReportClass _Report,
CSRCollection _CSR,
ilupeuPodClass _Pod , //Xactors
ilupeuScenario _Scenario ); //Test Parameters
//Public tasks
task Execute();
}
// class constructor
task ilupeuIngressTlpStrategy::new ( ReportClass _Report,
CSRCollection _CSR,
ilupeuPodClass _Pod,
ilupeuScenario _Scenario )
{
super.new( _Report,
_CSR,
_Pod,
_Scenario );
}
task ilupeuIngressTlpStrategy::Execute()
{
integer driveCompleteTO = 1000*Scenario.EgrTlpMaxActiveStrats;
integer expectCompleteTO;
bit driveComplete = 0;
//Set the value of the 1st byte of payload -
#ifdef N2_FC
//
dataSpec = pyldFirstByteValue;
#else
dataSpec = RandUtil.Rand32( 0, 8'hff );
#endif
//Generate a random Ingress FNXPCIEXactorTransaction TLP - TlpTrans
GenRandomPCIEXtrTlp( ILUPEU_INGRESS_TRANS,
dataSpec );
//Convert the FNXPCIEXactorTransaction to Header format
// tlpHdr is filled in according to Tlp type generated in GenRandomPCIEXtrTLP
ConvertPcieTlp2Hdr(); //Fills in tlpHdr
//Now Convert the Header and Payload to LPUXtr packet
// Instantiate a new LPUXtr packet and move data from tlpHdr into LPUXtrTlpPkt
// ConvertHdr2LpuXtrTlpPkt();
//Set LPUXtrTlpPkt CTTransactionID
// LPUXtrTlpPkt.SetID( ID );
//Set expect to = time to transmit a packet that size + a little overhead depending on the link width
//Read the Denali Link Status Register
denRegTmpData = regTrans.ReadDenaliReg( PCIE_REG_DEN_LINK_ST );
expectCompleteTO = ((xtrLen*4)/denRegTmpData[FNX_PCIE_XTR_REG_DEN_LINK_ST_LINK_WIDTH_SLC]) + 50;
QuickReport( Report,
RTYP_INFO,
"%s ilupeuIngressTlpStrategy:Call TlpTrans.Drive() expectCompleteTO=%0d ",ID.GetString(),expectCompleteTO );
fork
{
TlpTrans.Drive();
driveComplete = 1;
}
{
//Timeout if transaction can't be driven by Denali then this is an error
//review - Deal with retraining here
while( driveCompleteTO && !driveComplete ){
@(posedge CLOCK);
driveCompleteTO--;
}
}
join any
if( !driveComplete ){
QuickReport( Report,
RTYP_TEST_ERROR,
"%s ilupeuEgressTlpStrategy: Denali TlpTrans.Drive() timed out trying to drive TlpPkt ",ID.GetString() );
}
// MAQ: PEU
#ifdef N2_FC
#else
Pod.DMUXtr.recv( tlpHdr,dataSpec );
#endif
// MAQ: PEU
//Free up the unique tag if one was used
if( uniqueTagSet ){
FreeUniqueTag( TlpPkt.ReqTag );
}
QuickReport( Report,
RTYP_INFO,
"%s ilupeuIngressTlpStrategy:Strategy complete!",ID.GetString() );
repeat(10) @(posedge CLOCK);
}