Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: ilupeuIngressTlpStrategy.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 ============================================ | |
35 | class ilupeuIngressTlpStrategy 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 [ILUPEU_TLP_HDR_WIDTH-1:0] tlpHdr = {ILUPEU_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 | // integer dataSpec = 0; | |
54 | ||
55 | //#ifdef N2_FC | |
56 | //After constructing the class with new set the | |
57 | // variables below before calling Execute(). | |
58 | // | |
59 | // bit [7:0] pyldFirstByteValue = 0; | |
60 | // bit [63:0] tlpAddr = 0; | |
61 | //#endif | |
62 | ||
63 | ||
64 | //Constructor | |
65 | task new ( ReportClass _Report, | |
66 | CSRCollection _CSR, | |
67 | ilupeuPodClass _Pod , //Xactors | |
68 | ilupeuScenario _Scenario ); //Test Parameters | |
69 | ||
70 | //Public tasks | |
71 | task Execute(); | |
72 | ||
73 | } | |
74 | ||
75 | // class constructor | |
76 | task ilupeuIngressTlpStrategy::new ( ReportClass _Report, | |
77 | CSRCollection _CSR, | |
78 | ilupeuPodClass _Pod, | |
79 | ilupeuScenario _Scenario ) | |
80 | { | |
81 | super.new( _Report, | |
82 | _CSR, | |
83 | _Pod, | |
84 | _Scenario ); | |
85 | ||
86 | ||
87 | } | |
88 | ||
89 | ||
90 | ||
91 | task ilupeuIngressTlpStrategy::Execute() | |
92 | { | |
93 | ||
94 | integer driveCompleteTO = 1000*Scenario.EgrTlpMaxActiveStrats; | |
95 | integer expectCompleteTO; | |
96 | bit driveComplete = 0; | |
97 | ||
98 | //Set the value of the 1st byte of payload - | |
99 | #ifdef N2_FC | |
100 | // | |
101 | dataSpec = pyldFirstByteValue; | |
102 | #else | |
103 | dataSpec = RandUtil.Rand32( 0, 8'hff ); | |
104 | #endif | |
105 | ||
106 | //Generate a random Ingress FNXPCIEXactorTransaction TLP - TlpTrans | |
107 | GenRandomPCIEXtrTlp( ILUPEU_INGRESS_TRANS, | |
108 | dataSpec ); | |
109 | ||
110 | //Convert the FNXPCIEXactorTransaction to Header format | |
111 | // tlpHdr is filled in according to Tlp type generated in GenRandomPCIEXtrTLP | |
112 | ConvertPcieTlp2Hdr(); //Fills in tlpHdr | |
113 | ||
114 | ||
115 | //Now Convert the Header and Payload to LPUXtr packet | |
116 | // Instantiate a new LPUXtr packet and move data from tlpHdr into LPUXtrTlpPkt | |
117 | // ConvertHdr2LpuXtrTlpPkt(); | |
118 | //Set LPUXtrTlpPkt CTTransactionID | |
119 | // LPUXtrTlpPkt.SetID( ID ); | |
120 | ||
121 | //Set expect to = time to transmit a packet that size + a little overhead depending on the link width | |
122 | //Read the Denali Link Status Register | |
123 | denRegTmpData = regTrans.ReadDenaliReg( PCIE_REG_DEN_LINK_ST ); | |
124 | expectCompleteTO = ((xtrLen*4)/denRegTmpData[FNX_PCIE_XTR_REG_DEN_LINK_ST_LINK_WIDTH_SLC]) + 50; | |
125 | ||
126 | QuickReport( Report, | |
127 | RTYP_INFO, | |
128 | "%s ilupeuIngressTlpStrategy:Call TlpTrans.Drive() expectCompleteTO=%0d ",ID.GetString(),expectCompleteTO ); | |
129 | ||
130 | ||
131 | fork | |
132 | { | |
133 | TlpTrans.Drive(); | |
134 | driveComplete = 1; | |
135 | } | |
136 | { | |
137 | //Timeout if transaction can't be driven by Denali then this is an error | |
138 | //review - Deal with retraining here | |
139 | while( driveCompleteTO && !driveComplete ){ | |
140 | @(posedge CLOCK); | |
141 | driveCompleteTO--; | |
142 | } | |
143 | ||
144 | } | |
145 | join any | |
146 | ||
147 | if( !driveComplete ){ | |
148 | QuickReport( Report, | |
149 | RTYP_TEST_ERROR, | |
150 | "%s ilupeuEgressTlpStrategy: Denali TlpTrans.Drive() timed out trying to drive TlpPkt ",ID.GetString() ); | |
151 | } | |
152 | ||
153 | // MAQ: PEU | |
154 | #ifdef N2_FC | |
155 | #else | |
156 | Pod.DMUXtr.recv( tlpHdr,dataSpec ); | |
157 | #endif | |
158 | // MAQ: PEU | |
159 | ||
160 | //Free up the unique tag if one was used | |
161 | if( uniqueTagSet ){ | |
162 | FreeUniqueTag( TlpPkt.ReqTag ); | |
163 | } | |
164 | ||
165 | QuickReport( Report, | |
166 | RTYP_INFO, | |
167 | "%s ilupeuIngressTlpStrategy:Strategy complete!",ID.GetString() ); | |
168 | ||
169 | repeat(10) @(posedge CLOCK); | |
170 | ||
171 | } | |
172 |