| 1 | // ========== Copyright Header Begin ========================================== |
| 2 | // |
| 3 | // OpenSPARC T2 Processor File: ilupeuEgressContext.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 ilupeuEgressContext extends ilupeuContextBase { |
| 36 | |
| 37 | |
| 38 | //Inherited from CTContextBase |
| 39 | //integer NumStrat; |
| 40 | //string Name = ""; |
| 41 | //protected CTTransactionID ID = new; |
| 42 | |
| 43 | |
| 44 | // Strategy Type Encoding |
| 45 | protected integer strat_type_tlp_enc; |
| 46 | protected integer strat_type_dllp_enc; |
| 47 | |
| 48 | local bit HangDetect = 0; |
| 49 | local integer WaitCount; |
| 50 | |
| 51 | // Constructor |
| 52 | task new ( ReportClass _Report, |
| 53 | CSRCollection _CSR, |
| 54 | ilupeuPodClass _Pod, //Xactors |
| 55 | ilupeuScenario _Scenario ); //Xactors |
| 56 | |
| 57 | // Public Methods |
| 58 | task Execute(); |
| 59 | |
| 60 | |
| 61 | function CTStrategyBase ProvideTlpStrategy(); |
| 62 | function CTStrategyBase ProvideDllpStrategy(); |
| 63 | function CTStrategyBase FinalizeTlpParms( CTStrategyBase FinalStrategy ); |
| 64 | function CTStrategyBase FinalizeDllpParms( CTStrategyBase FinalStrategy ); |
| 65 | |
| 66 | } //End ilupeuEgressContext extends CTContextBase |
| 67 | |
| 68 | task ilupeuEgressContext::new ( ReportClass _Report, |
| 69 | CSRCollection _CSR, |
| 70 | ilupeuPodClass _Pod, |
| 71 | ilupeuScenario _Scenario) |
| 72 | { |
| 73 | |
| 74 | string Name = "ilupeuEgressContext" ; |
| 75 | |
| 76 | super.new ( _Report, |
| 77 | _CSR, |
| 78 | _Pod, |
| 79 | _Scenario, |
| 80 | Name ); |
| 81 | |
| 82 | |
| 83 | } //End ilupeuEgressContext::new |
| 84 | |
| 85 | function CTStrategyBase ilupeuEgressContext::ProvideTlpStrategy() |
| 86 | { |
| 87 | // All Supported TLP Strategies Should Be Listed Here |
| 88 | ilupeuEgressTlpStrategy TlpStrat; |
| 89 | |
| 90 | //Provide the strategy based on test parameters |
| 91 | randcase{ |
| 92 | |
| 93 | Scenario.EgrTlpWt: { |
| 94 | |
| 95 | strat_type_tlp_enc = ILUPEU_TLP_STRAT_ENC; |
| 96 | TlpStrat = new ( Report, |
| 97 | CSR, |
| 98 | Pod, |
| 99 | Scenario ) ; |
| 100 | |
| 101 | ProvideTlpStrategy = TlpStrat; |
| 102 | } |
| 103 | } |
| 104 | } //End ilupeuEgressContext::ProvideTlpStrategy() |
| 105 | |
| 106 | |
| 107 | function CTStrategyBase ilupeuEgressContext::ProvideDllpStrategy() |
| 108 | { |
| 109 | /* review |
| 110 | // All Supported DLLP Strategies Should Be Listed Here |
| 111 | ilupeuEgressDllpFCStrategy DllpFCStrat; |
| 112 | // ilupeuEgressDllpPMStrategy DllpPMStrat; |
| 113 | |
| 114 | //Provide the strategy based on test parameters |
| 115 | randcase{ |
| 116 | Scenario.EgrDllpFCWt: { |
| 117 | |
| 118 | strat_type_dllp_enc = ILUPEU_DLLP_FC_STRAT_ENC; |
| 119 | DllpFCStrat = new ( Report, |
| 120 | CSR, |
| 121 | Pod, |
| 122 | Scenario ) ; |
| 123 | |
| 124 | ProvideDllpStrategy = DllpFCStrat; |
| 125 | } |
| 126 | |
| 127 | Scenario.EgrDllpPMWt: { |
| 128 | |
| 129 | strat_type_dllp_enc = ILUPEU_DLLP_PM_STRAT_ENC; |
| 130 | DllpPMStrat = new ( Report, |
| 131 | CSR, |
| 132 | Pod, |
| 133 | Scenario ) ; |
| 134 | |
| 135 | ProvideDllpStrategy = DllpPMStrat; |
| 136 | } |
| 137 | } |
| 138 | */ |
| 139 | } //End ilupeuEgressContext::ProvideDllpStrategy() |
| 140 | |
| 141 | function CTStrategyBase ilupeuEgressContext::FinalizeTlpParms( CTStrategyBase FinalStrategy ) |
| 142 | { |
| 143 | |
| 144 | // All Supported TLP Strategies Should Be Listed Here |
| 145 | ilupeuEgressTlpStrategy TlpStrat; |
| 146 | |
| 147 | //Cast assign to the correct Type |
| 148 | case( strat_type_tlp_enc ){ |
| 149 | ILUPEU_TLP_STRAT_ENC : cast_assign( TlpStrat, FinalStrategy ); |
| 150 | |
| 151 | default : QuickReport( Report, RTYP_TEST_ERROR, |
| 152 | "ilupeuEgressContext FinalizeTlpParms() -> hit default case strat_type_tlp_enc=%0d", |
| 153 | strat_type_tlp_enc ); |
| 154 | } |
| 155 | |
| 156 | //Set up Necessary Parameters |
| 157 | case( strat_type_tlp_enc ){ |
| 158 | ILUPEU_TLP_STRAT_ENC : FinalizeTlpParms = TlpStrat; |
| 159 | } |
| 160 | |
| 161 | } //End ilupeuEgressContext::FinalizeParms |
| 162 | |
| 163 | |
| 164 | function CTStrategyBase ilupeuEgressContext::FinalizeDllpParms( CTStrategyBase FinalStrategy ) |
| 165 | { |
| 166 | /* |
| 167 | // All Supported DLLP Strategies Should Be Listed Here |
| 168 | //review - Will allow ilupeu and denali to handle all flow control |
| 169 | ilupeuEgressDllpFCStrategy DllpFCStrat; |
| 170 | // ilupeuEgressDllpPMStrategy DllpPMStrat; |
| 171 | |
| 172 | //Cast assign to the correct Type |
| 173 | case( strat_type_dllp_enc ){ |
| 174 | ILUPEU_DLLP_FC_STRAT_ENC : cast_assign( DllpFCStrat, FinalStrategy ); |
| 175 | // ILUPEU_DLLP_PM_STRAT_ENC : cast_assign( DllpPMStrat, FinalStrategy ); |
| 176 | |
| 177 | default : QuickReport( Report, RTYP_TEST_ERROR, |
| 178 | "ilupeuEgressContext FinalizeDllpParms() -> hit default case strat_type_dllp_enc=%0d", |
| 179 | strat_type_dllp_enc ); |
| 180 | } |
| 181 | |
| 182 | //Set up Necessary Parameters |
| 183 | case( strat_type_dllp_enc ){ |
| 184 | ILUPEU_DLLP_FC_STRAT_ENC : FinalizeDllpParms = DllpFCStrat; |
| 185 | // ILUPEU_DLLP_PM_STRAT_ENC : FinalizeDllpParms = DllpPMStrat; |
| 186 | } |
| 187 | */ |
| 188 | } //End ilupeuEgressContext::FinalizeDllpParms |
| 189 | |
| 190 | task ilupeuEgressContext::Execute() { |
| 191 | |
| 192 | //Determine the number of strategies for each type |
| 193 | tlpNumStrat = RandUtil.Rand32( Scenario.EgrTlpMinStrats, Scenario.EgrTlpMaxStrats ); |
| 194 | dllpNumStrat = RandUtil.Rand32( Scenario.EgrDllpMinStrats, Scenario.EgrDllpMaxStrats ); |
| 195 | |
| 196 | //Set the min and max issue delay values |
| 197 | tlpMinDelay = Scenario.EgrTlpMinIssueDly; |
| 198 | tlpMaxDelay = Scenario.EgrTlpMaxIssueDly; |
| 199 | dllpMinDelay = Scenario.EgrDllpMinIssueDly; |
| 200 | dllpMaxDelay = Scenario.EgrDllpMaxIssueDly; |
| 201 | |
| 202 | //Set the min and max active strats values |
| 203 | tlpMinActiveStrats = Scenario.EgrTlpMinActiveStrats; |
| 204 | tlpMaxActiveStrats = Scenario.EgrTlpMaxActiveStrats; |
| 205 | dllpMinActiveStrats = Scenario.EgrDllpMinActiveStrats; |
| 206 | dllpMaxActiveStrats = Scenario.EgrDllpMaxActiveStrats; |
| 207 | |
| 208 | QuickReport( Report,RTYP_INFO, "Starting Context %s ID = %0d tlpNumStrat=%0d dllpNumStrat=%0d", |
| 209 | Name, ID.GetContextID(), tlpNumStrat,dllpNumStrat ); |
| 210 | |
| 211 | //Fork off a seperate thread for TLP's and DLLP's for better control |
| 212 | fork |
| 213 | { |
| 214 | if( tlpNumStrat > 0 && Scenario.EgrTlpWt > 0 ){ |
| 215 | ExecuteTlp(); |
| 216 | } |
| 217 | } |
| 218 | { |
| 219 | if( dllpNumStrat > 0 && ( Scenario.EgrDllpFCWt > 0 || Scenario.EgrDllpPMWt > 0 ) ){ |
| 220 | ExecuteDllp(); |
| 221 | } |
| 222 | } |
| 223 | join |
| 224 | |
| 225 | //Delay to let any Report Errors filter through |
| 226 | repeat(20) @(posedge CLOCK); |
| 227 | |
| 228 | QuickReport( Report,RTYP_INFO, "Finishing Context %s ID = %0d", |
| 229 | Name, |
| 230 | ID.GetContextID() ); |
| 231 | |
| 232 | } |
| 233 | |
| 234 | |