Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / env / ilu_peu / vera / strategy / ilupeuEgressTlpStrategy.vr
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: ilupeuEgressTlpStrategy.vr
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 ============================================
35class ilupeuEgressTlpStrategy extends ilupeuTlpStrategyBase {
36
37 //Inherited from ilupeuTlpStrategyBase
38 // CSRCollection CSR;
39 // ReportClass Report;
40 // ilupeuPodClass Pod;
41 // ilupeuScenario Scenario;
42 //Random Utilities
43 // FNXRandomUtil RandUtil;
44 //Transaction and Packet Types
45 // FNXPCIEXactorTransaction TlpTrans;
46 // FNXPCIEXactorPacket TlpPkt;
47 // bit [LX_TLP_HDR_WIDTH-1:0] tlpHdr = {LX_TLP_HDR_WIDTH{1'b0}};
48 // LPUXtrDataTLP LPUXtrTlpPkt;
49 //Payload arrays
50 // bit [7:0] pyldByteAry[*];
51 // bit [31:0] pyldDWAry[*];
52 // bit [31:0] pyldDW;
53
54//#ifdef N2_FC
55 //After constructing the class with new set the
56 // variables below before calling Execute().
57 //
58 // bit [7:0] pyldFirstByteValue = 0;
59 // bit [63:0] tlpAddr = 0;
60//#endif
61
62
63 //Constructor
64 task new ( ReportClass _Report,
65 CSRCollection _CSR,
66 ilupeuPodClass _Pod , //Xactors
67 ilupeuScenario _Scenario ); //Test Parameters
68
69 //Public tasks
70 task Execute();
71
72}
73
74// class constructor
75task ilupeuEgressTlpStrategy::new ( ReportClass _Report,
76 CSRCollection _CSR,
77 ilupeuPodClass _Pod,
78 ilupeuScenario _Scenario )
79{
80 super.new( _Report,
81 _CSR,
82 _Pod,
83 _Scenario );
84
85
86}
87
88
89
90task ilupeuEgressTlpStrategy::Execute()
91{
92
93 integer driveCompleteTO = 1000*Scenario.EgrTlpMaxActiveStrats;
94 integer expectCompleteTO;
95 bit driveComplete = 0;
96
97 //Set the value of the 1st byte of payload -
98#ifdef N2_FC
99 //
100 dataSpec = pyldFirstByteValue;
101#else
102 dataSpec = RandUtil.Rand32( 0, 8'hff );
103#endif
104 //Generate a random Egress FNXPCIEXactorTransaction TLP - TlpTrans
105 GenRandomPCIEXtrTlp( ILUPEU_EGRESS_TRANS,
106 dataSpec );
107
108 //Convert the FNXPCIEXactorTransaction to Header format
109 // tlpHdr is filled in according to Tlp type generated in GenRandomPCIEXtrTLP
110 ConvertPcieTlp2Hdr();
111
112
113 //Now Convert the Header and Payload to LPUXtr packet
114 // Instantiate a new LPUXtr packet and move data from tlpHdr into LPUXtrTlpPkt
115// ConvertHdr2LpuXtrTlpPkt();
116 //Set LPUXtrTlpPkt CTTransactionID
117// LPUXtrTlpPkt.SetID( ID );
118
119 //Set expect to = time to transmit a packet that size + a little overhead depending on the link width
120 //Read the Denali Link Status Register
121 denRegTmpData = regTrans.ReadDenaliReg( PCIE_REG_DEN_LINK_ST );
122 expectCompleteTO = ( ((xtrLen*4)/denRegTmpData[FNX_PCIE_XTR_REG_DEN_LINK_ST_LINK_WIDTH_SLC]) + 50);
123 //x4 and x1 links need extra time
124 if( denRegTmpData[FNX_PCIE_XTR_REG_DEN_LINK_ST_LINK_WIDTH_SLC] == 4 ){
125 expectCompleteTO = expectCompleteTO + 50;
126 }
127 else if( denRegTmpData[FNX_PCIE_XTR_REG_DEN_LINK_ST_LINK_WIDTH_SLC] == 1 ){
128 expectCompleteTO = expectCompleteTO + 120;
129 }
130
131#ifdef N2_FC
132#else
133 QuickReport( Report,
134 RTYP_INFO,
135 "%s ilupeuEgressTlpStrategy:Call DMUXtr.send expectCompleteTO=%0d LinkWidth=%0d ",ID.GetString(),expectCompleteTO,denRegTmpData[FNX_PCIE_XTR_REG_DEN_LINK_ST_LINK_WIDTH_SLC] );
136
137
138 fork
139 {
140 Pod.DMUXtr.send( tlpHdr,dataSpec,{ 4'b1000, TlpPkt.ReqTag[3:0] } );
141 driveComplete = 1;
142 }
143 {
144 //Timeout if transaction can't be driven to the ilupeu - this means that dack has gone low for
145 // a long time
146 //review - Deal with retraining here
147 while( driveCompleteTO && !driveComplete ){
148 @(posedge CLOCK);
149 driveCompleteTO--;
150 }
151
152 }
153 join any
154#endif
155 if( !driveComplete ){
156 QuickReport( Report,
157 RTYP_TEST_ERROR,
158 "%s ilupeuEgressTlpStrategy: Pod.LPUXtr.driveTLP timed out trying to drive TlpPkt \n",ID.GetString() );
159 }
160
161 expectCompleteTO = 300;
162 void = TlpTrans.Expect( expectCompleteTO );
163
164 //Free up the unique tag if one was used
165 if( uniqueTagSet ){
166 FreeUniqueTag( TlpPkt.ReqTag );
167 }
168
169
170 QuickReport( Report,
171 RTYP_INFO,
172 "%s ilupeuEgressTlpStrategy:Strategy complete! ",ID.GetString() );
173
174 repeat(10) @(posedge CLOCK);
175
176
177}
178