| 1 | // ========== Copyright Header Begin ========================================== |
| 2 | // |
| 3 | // OpenSPARC T2 Processor File: N2PEUTestBase.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 PEUTestBase { |
| 36 | |
| 37 | |
| 38 | BootPEUStr boot; // A strategy for starting things up |
| 39 | protected PEUTestEnv env; // The test environment |
| 40 | PIOPEUCtx pio; // The context to perform PIO traffic |
| 41 | DMAPEUCtx dma; // The context to perform DMA traffic |
| 42 | |
| 43 | protected integer txBadInit = 0; // Tx bad init fc dllps before link up |
| 44 | protected bit slowClock; // Do we have a slow ILU clock? |
| 45 | protected bit stallNpstWr; // Do PIO reqs stall after Cfg/IO write? |
| 46 | |
| 47 | protected bit AHBdone = 0; // used to start/stop AHB traffic |
| 48 | protected bit PMmsgDone = 0; // used to start/stop PMmsg traffic |
| 49 | protected event donePMmsgs; // signals when PMmsgs finishes |
| 50 | |
| 51 | protected integer numPhyLanes; |
| 52 | protected integer numActiveLanes; |
| 53 | protected bit fastTrain; |
| 54 | protected bit enableL0s; |
| 55 | protected bit [63:0] retryBufSize; |
| 56 | protected PECBool txEnableScramble; |
| 57 | protected PECBool rxEnableScramble; |
| 58 | |
| 59 | //N2 - Start |
| 60 | |
| 61 | // Only need to create 1 Report class to pass around the whole testbench |
| 62 | ReportClass Report = new; |
| 63 | |
| 64 | // The Scenario classes holds some test parameters |
| 65 | ilupeuScenario Scenario = new( Report ); |
| 66 | |
| 67 | // urandom Seed Generation |
| 68 | bit [31:0] urand_seed = 32'hdeadbeef; |
| 69 | bit seed_with_tod = 1'b0; |
| 70 | // bit seed_with_tod = 1'b1; |
| 71 | |
| 72 | public task Seed(); |
| 73 | //N2 - End |
| 74 | |
| 75 | public task new(); |
| 76 | |
| 77 | virtual public task execute(); // Run the whole test |
| 78 | |
| 79 | virtual public task setBoot(); // Set the params in Boot Str |
| 80 | virtual public task setEnv(); // Set initial params in env. |
| 81 | |
| 82 | virtual public task setPIO(); // Set params for PIO Noise Context |
| 83 | virtual public task setDMA(); // Set params for DMA Noise Context |
| 84 | |
| 85 | virtual public task runPIO(); // Run the PIO Noise Context |
| 86 | virtual public task runDMA(); // Run the DMA Noise Context |
| 87 | |
| 88 | virtual public task runTest(); // Test something interesting |
| 89 | |
| 90 | virtual public task startAHB( PEUTestEnv env ); |
| 91 | virtual public task stopAHB(); |
| 92 | |
| 93 | virtual public task startPMmsgs( PEUTestEnv env, |
| 94 | integer minDelay = 100, |
| 95 | integer maxDelay = 200 ); |
| 96 | virtual public task stopPMmsgs(); |
| 97 | |
| 98 | virtual public task startLTSSM( PEUTestEnv env, |
| 99 | integer minDelay, integer maxDelay, |
| 100 | integer recovery, integer L0s ); |
| 101 | virtual public task stopLTSSM(); |
| 102 | virtual public task stopPioDma(); |
| 103 | } |
| 104 | |
| 105 | |
| 106 | task PEUTestBase::new() { |
| 107 | |
| 108 | integer status, unk; |
| 109 | integer print_str; |
| 110 | |
| 111 | this.enableL0s = 0; |
| 112 | this.retryBufSize = 64'h0; |
| 113 | this.slowClock = 0; |
| 114 | |
| 115 | //Set the print threshold at the command line |
| 116 | //example: sims ... -vcs_run_args=+report_global_print_threshold=RPRT_DEBUG_3 |
| 117 | if( get_plus_arg( CHECK, "+report_global_print_threshold=" ) ){ |
| 118 | print_str = get_plus_arg( NUM, "+report_global_print_threshold=" ); |
| 119 | case( print_str ){ |
| 120 | RPRT_INFO: Report.set_global_print_threshold( RPRT_INFO ); |
| 121 | RPRT_DEBUG_3: Report.set_global_print_threshold( RPRT_DEBUG_3 ); |
| 122 | default: Report.set_global_print_threshold( RPRT_INFO ); |
| 123 | } |
| 124 | }else{ |
| 125 | //If there is no print level passed in then only print the minimum |
| 126 | Report.set_global_print_threshold( RPRT_NONMASKABLE ); |
| 127 | } |
| 128 | |
| 129 | // Seed(); |
| 130 | |
| 131 | //Step 0. Initialize Denali Vera Interface |
| 132 | status = denaliVeraPcieInit(); |
| 133 | if (status == -1) |
| 134 | QuickReport(Report,RTYP_TEST_ERROR,"denaliVeraPcieInit() failed. \n" ); |
| 135 | |
| 136 | status = DenaliDDVinitialize("","",unk,"","API"); |
| 137 | if (status == -1) |
| 138 | QuickReport(Report,RTYP_TEST_ERROR,"DenaliDDVinitialize() failed. \n" ); |
| 139 | |
| 140 | // Set Denali Register Callback Task For PCIE Xactors |
| 141 | status = DenaliDDVaccessSetCallback("FNXPCIEXactorRegCbTask"); |
| 142 | if (status == -1) |
| 143 | QuickReport(Report,RTYP_TEST_ERROR,"DenaliDDVaccessSetCallback() failed. \n" ); |
| 144 | |
| 145 | } |
| 146 | |
| 147 | |
| 148 | task PEUTestBase::execute() { |
| 149 | bit pioDone; |
| 150 | bit dmaDone; |
| 151 | PioCfgIOWrPEUStr CfgWr0; |
| 152 | |
| 153 | |
| 154 | printf("**PEUTestBase Begin Execution**\n"); |
| 155 | |
| 156 | |
| 157 | printf("**PEUTestBase Set Up Boot Strategy**\n"); |
| 158 | boot = new( Report, |
| 159 | Scenario ); // Let's get ready to rumble .... |
| 160 | this.setBoot(); |
| 161 | printf("**PEUTestBase Boot Strategy Set Up Complete**\n"); |
| 162 | |
| 163 | |
| 164 | printf("**PEUTestBase Execute Boot Strategy**\n"); |
| 165 | boot.Execute(); |
| 166 | printf("**PEUTestBase Boot Strategy Complete**\n"); |
| 167 | |
| 168 | |
| 169 | printf("**PEUTestBase Set Up Environment**\n"); |
| 170 | env = boot.getEnv(); |
| 171 | this.setEnv(); |
| 172 | printf("**PEUTestBase Environment Set Up Complete**\n"); |
| 173 | |
| 174 | #ifndef N2_FC |
| 175 | |
| 176 | //Make the 1st transaction a Cfg Write 0 so that the |
| 177 | // Config ID in Denali can be set |
| 178 | CfgWr0 = new( env ); |
| 179 | CfgWr0._type_req_prob_cfg1 = 0; |
| 180 | CfgWr0._type_req_prob_io = 0; |
| 181 | CfgWr0._ep_cpl_prob_true = 0; |
| 182 | CfgWr0._td_cpl_prob_true = 0; |
| 183 | CfgWr0._bcm_prob_true = 0; |
| 184 | CfgWr0.Execute(); |
| 185 | printf("**PEUTestBase Sent ConfigWrite0 to Denali**\n"); |
| 186 | |
| 187 | |
| 188 | printf("**PEUTestBase Set Up PIO Traffic**\n"); |
| 189 | pio = new(env); |
| 190 | this.setPIO(); |
| 191 | printf("**PEUTestBase PIO Traffic Set Up Complete**\n"); |
| 192 | |
| 193 | |
| 194 | printf("**PEUTestBase Set Up DMA Traffic**\n"); |
| 195 | dma = new( "DmaTraffic", env, "random" ); |
| 196 | this.setDMA(); |
| 197 | printf("**PEUTestBase DMA Traffic Set Up Complete**\n"); |
| 198 | |
| 199 | pioDone = 0; |
| 200 | dmaDone = 0; |
| 201 | fork |
| 202 | { |
| 203 | printf("**PEUTestBase Run PIO Traffic**\n"); |
| 204 | this.runPIO(); |
| 205 | printf("**PEUTestBase PIO Traffic Complete**\n"); |
| 206 | pioDone = 1; |
| 207 | } |
| 208 | { |
| 209 | printf("**PEUTestBase Run DMA Traffic**\n"); |
| 210 | this.runDMA(); |
| 211 | printf("**PEUTestBase DMA Traffic Complete**\n"); |
| 212 | dmaDone = 1; |
| 213 | } |
| 214 | { |
| 215 | printf("**PEUTestBase Run Test**\n"); |
| 216 | this.runTest(); |
| 217 | printf("**PEUTestBase Test Complete**\n"); |
| 218 | |
| 219 | printf("**PEUTestBase Signal PIO & DMA Traffic Stop**\n"); |
| 220 | pio.StratStop = 1'b1; |
| 221 | dma.StratStop = 1'b1; |
| 222 | printf("**PEUTestBase PIO & DMA Traffic Stop Signal Complete**\n"); |
| 223 | while( ( !pioDone && (pio.NumStrat - pio.StratDone) > 100 ) |
| 224 | || ( !dmaDone && (dma.NumStrat - dma.StratDone) > 100 ) ) |
| 225 | { |
| 226 | printf( "**PEUTestBase (cyc %0d) PIO/DMA remaining = %0d/%0d\n", |
| 227 | get_cycle(), |
| 228 | pio.NumStrat - pio.StratDone, dma.NumStrat - dma.StratDone ); |
| 229 | env.wait(100); |
| 230 | } |
| 231 | printf( "**PEUTestBase (cyc %0d) PIO/DMA remaining = %0d/%0d\n", |
| 232 | get_cycle(), |
| 233 | pio.NumStrat - pio.StratDone, dma.NumStrat - dma.StratDone ); |
| 234 | } |
| 235 | join all |
| 236 | |
| 237 | printf("**PEUTestBase Expect Idle State**\n"); |
| 238 | env.expectIdleState(); |
| 239 | printf("**PEUTestBase Expect Idle State Complete**\n"); |
| 240 | |
| 241 | #endif |
| 242 | |
| 243 | printf("**PEUTestBase Execution Complete**\n"); |
| 244 | } |
| 245 | |
| 246 | /* |
| 247 | * Beat up on the AHB interface to the LPU's CSRs. |
| 248 | * But only if we don't have an LPU hooked up! |
| 249 | */ |
| 250 | task PEUTestBase::startAHB( PEUTestEnv env ) |
| 251 | { |
| 252 | /* N2 review - Not Needed??? |
| 253 | bit [63:0] data; |
| 254 | bit [31:0] addr; |
| 255 | |
| 256 | if ( get_plus_arg( CHECK, "LPU" ) ) return; |
| 257 | |
| 258 | repeat(10) @(posedge CLOCK); // Let reset finish... |
| 259 | |
| 260 | this.AHBdone = 0; |
| 261 | while( !this.AHBdone ) |
| 262 | { |
| 263 | data = { 32'b0, urandom() }; |
| 264 | addr = env.getLPUaddr( urandom() % PEC_LPU_CSR_MAX_COUNT ); |
| 265 | env.writeCSR( addr, data ); |
| 266 | env.expectCSRdirect( addr, data ); |
| 267 | |
| 268 | data = { 32'b0, urandom() }; |
| 269 | addr = env.getLPUaddr( urandom() % PEC_LPU_CSR_MAX_COUNT ); |
| 270 | env.writeCSRdirect( addr, data ); |
| 271 | env.expectCSR( addr, data ); |
| 272 | |
| 273 | data = { 32'b0, urandom() }; |
| 274 | addr = env.getLPUaddr( urandom() % PEC_LPU_CSR_MAX_COUNT ); |
| 275 | data = env.readCSRdirect( addr ); |
| 276 | env.expectCSR( addr, data ); |
| 277 | } |
| 278 | */ |
| 279 | } /* end startAHB */ |
| 280 | |
| 281 | task PEUTestBase::stopAHB() |
| 282 | { |
| 283 | //N2 review this.AHBdone = 1; |
| 284 | } |
| 285 | |
| 286 | |
| 287 | /* |
| 288 | * Write CSRs which cause PM messages to be sent by the TLU. |
| 289 | */ |
| 290 | task PEUTestBase::startPMmsgs( PEUTestEnv env, |
| 291 | integer minDelay = 100, |
| 292 | integer maxDelay = 200 ) |
| 293 | { |
| 294 | bit [7:0] msgType; |
| 295 | bit [63:0] data; |
| 296 | bit [63:0] capData; |
| 297 | bit [31:0] expData; |
| 298 | bit [31:0] addr; |
| 299 | integer delay; |
| 300 | event csrWritten; |
| 301 | |
| 302 | capData = 64'h00100; |
| 303 | trigger( OFF, this.donePMmsgs ); |
| 304 | |
| 305 | this.PMmsgDone = 0; |
| 306 | while( !this.PMmsgDone ) |
| 307 | { |
| 308 | delay = minDelay + urandom() % (maxDelay-minDelay+1); |
| 309 | repeat(delay) @(posedge CLOCK); |
| 310 | if ( urandom()%2 ) |
| 311 | { |
| 312 | data = 64'b01; |
| 313 | expData = 0; |
| 314 | addr = env.getCSRaddr( e_CSR_pme_ctl ); |
| 315 | msgType = PEC_PCI__MSG_CODE_PM_TURN_OFF; |
| 316 | } |
| 317 | else |
| 318 | { |
| 319 | capData = capData + 64'h00100; |
| 320 | data = capData; |
| 321 | expData = { 22'b0, capData[16:7] }; |
| 322 | addr = env.getCSRaddr( e_CSR_slot_cap ); |
| 323 | msgType = PEC_PCI__MSG_CODE_SET_SLOT_POWER_LIMIT; |
| 324 | } |
| 325 | trigger( OFF, csrWritten ); |
| 326 | fork |
| 327 | env.expectEgressMsg( msgType, expData, csrWritten ); |
| 328 | { |
| 329 | env.writeCSR( addr, data ); |
| 330 | trigger( ON, csrWritten ); |
| 331 | } |
| 332 | join |
| 333 | } |
| 334 | trigger( ON, this.donePMmsgs ); |
| 335 | } /* end exercisePMmsgs */ |
| 336 | |
| 337 | task PEUTestBase::stopPMmsgs() |
| 338 | { |
| 339 | this.PMmsgDone = 1; |
| 340 | sync( ANY, this.donePMmsgs ); |
| 341 | } |
| 342 | |
| 343 | task PEUTestBase::startLTSSM( PEUTestEnv env, |
| 344 | integer minDelay, integer maxDelay, |
| 345 | integer recovery, integer L0s ) |
| 346 | { |
| 347 | } |
| 348 | |
| 349 | task PEUTestBase::stopLTSSM() |
| 350 | { |
| 351 | } |
| 352 | |
| 353 | |
| 354 | task PEUTestBase::setBoot() { |
| 355 | |
| 356 | boot.getPhyConfig( this.numPhyLanes, |
| 357 | this.numActiveLanes, |
| 358 | this.fastTrain, |
| 359 | txEnableScramble, |
| 360 | rxEnableScramble |
| 361 | ); |
| 362 | |
| 363 | // QuickReport(Report,RTYP_INFO, " PEUTestBase::setBoot() result of get_plus_arg( CHECK, \"vera_random_seed=\" ) is %h\n", get_plus_arg( CHECK, "vera_random_seed=" ) ); |
| 364 | |
| 365 | //N2 review boot.setClkDrift(8); |
| 366 | //N2 review boot.setDriftPeriod(19); |
| 367 | boot.setPostedCredits( 16, 64 ); |
| 368 | boot.setNonpostedCredits( 16, 64 ); |
| 369 | boot.setCompletionCredits( 16, 64 ); |
| 370 | return; |
| 371 | |
| 372 | #ifndef N2_FC |
| 373 | |
| 374 | randcase |
| 375 | { |
| 376 | //N2 review 1: { boot.slowClock(1); this.slowClock = 1; } |
| 377 | //N2 review 5: { boot.slowClock(0); } |
| 378 | 10: {} |
| 379 | } |
| 380 | randcase |
| 381 | { |
| 382 | //N2 review 1: { boot.setClkDrift(1); boot.setDriftPeriod(2); } |
| 383 | //N2 review 1: { boot.setClkDrift(10); boot.setDriftPeriod( urandom()%20 + 20 ); } |
| 384 | 1: {} |
| 385 | } |
| 386 | randcase |
| 387 | { |
| 388 | 1: boot.setPostedCredits( 0, 0 ); |
| 389 | 1: boot.setPostedCredits( 1, 32 ); |
| 390 | 1: boot.setPostedCredits( 2, 32 ); |
| 391 | 1: boot.setPostedCredits( 4, 32 ); |
| 392 | 1: boot.setPostedCredits( 16, 64 ); |
| 393 | 1: boot.setPostedCredits( 128, 2048 ); |
| 394 | } |
| 395 | randcase |
| 396 | { |
| 397 | 1: boot.setNonpostedCredits( 0, 0 ); |
| 398 | 1: boot.setNonpostedCredits( 1, 32 ); |
| 399 | 1: boot.setNonpostedCredits( 2, 32 ); |
| 400 | 1: boot.setNonpostedCredits( 4, 32 ); |
| 401 | 1: boot.setNonpostedCredits( 16, 64 ); |
| 402 | 1: boot.setNonpostedCredits( 128, 2048 ); |
| 403 | } |
| 404 | randcase |
| 405 | { |
| 406 | 1: boot.setCompletionCredits( 0, 0 ); |
| 407 | 1: boot.setCompletionCredits( 1, 32 ); |
| 408 | 1: boot.setCompletionCredits( 2, 32 ); |
| 409 | 1: boot.setCompletionCredits( 4, 32 ); |
| 410 | 1: boot.setCompletionCredits( 16, 64 ); |
| 411 | 1: boot.setCompletionCredits( 128, 2048 ); |
| 412 | } |
| 413 | #endif |
| 414 | } |
| 415 | |
| 416 | |
| 417 | task PEUTestBase::setEnv() { |
| 418 | bit useLpu; |
| 419 | integer seed; |
| 420 | integer mps; |
| 421 | integer len1; |
| 422 | integer len2; |
| 423 | integer len16; |
| 424 | integer lenBulk; |
| 425 | integer egressThrottle; |
| 426 | integer ingressThrottle; |
| 427 | integer ingressAbortRate; |
| 428 | integer minGap; |
| 429 | integer maxGap; |
| 430 | |
| 431 | //N2 useLpu = get_plus_arg( CHECK, "LPU" ); |
| 432 | useLpu = 1; //Always set for N2 |
| 433 | |
| 434 | #ifndef N2_FC |
| 435 | |
| 436 | // Randomly select environment / device parameters |
| 437 | randcase |
| 438 | { |
| 439 | 1: mps = 128; |
| 440 | 1: mps = 256; |
| 441 | 1: mps = 512; |
| 442 | } |
| 443 | |
| 444 | randcase |
| 445 | { |
| 446 | 1: egressThrottle = 0; |
| 447 | 1: egressThrottle = 25; |
| 448 | 1: egressThrottle = 50; |
| 449 | } |
| 450 | |
| 451 | randcase |
| 452 | { |
| 453 | 1: ingressThrottle = 0; |
| 454 | //N2 review 1: ingressThrottle = useLpu ? 0 : 25; |
| 455 | //N2 review 1: ingressThrottle = useLpu ? 0 : 50; |
| 456 | } |
| 457 | |
| 458 | randcase |
| 459 | { |
| 460 | 1: ingressAbortRate = 0; |
| 461 | //N2 review 1: ingressAbortRate = useLpu ? 0 : 10; |
| 462 | //N2 review 1: ingressAbortRate = useLpu ? 0 : 25; |
| 463 | } |
| 464 | |
| 465 | randcase |
| 466 | { |
| 467 | 1: { minGap = 2; maxGap = 2; } |
| 468 | 1: { minGap = 2; maxGap = 6; } |
| 469 | } |
| 470 | |
| 471 | randcase // Payload sizes... |
| 472 | { |
| 473 | 1: { len1=10; len2=10; len16=10; lenBulk=10; } // A little of each |
| 474 | 1: { len1=10; len2=1; len16=1; lenBulk=0; } // Lots of 1DW payloads |
| 475 | 1: { len1=10; len2=10; len16=10; lenBulk=0; } // No bulk payloads |
| 476 | } |
| 477 | |
| 478 | randcase |
| 479 | { |
| 480 | 1: stallNpstWr = 0; |
| 481 | 1: stallNpstWr = 1; |
| 482 | } |
| 483 | |
| 484 | // |
| 485 | // If the initial (random) seed is small, then choose environment |
| 486 | // parameters based on that seed. In this way, a couple of random runs |
| 487 | // can be used for coverage purposes. |
| 488 | // |
| 489 | if ( get_plus_arg( CHECK, "vera_random_seed=" ) ) |
| 490 | { |
| 491 | seed = get_plus_arg( NUM, "vera_random_seed=" ); |
| 492 | case ( seed ) |
| 493 | { |
| 494 | 1: { mps = 128; stallNpstWr = 0; } |
| 495 | 2: { mps = 256; stallNpstWr = 0; } |
| 496 | 3: { mps = 512; stallNpstWr = 0; } |
| 497 | 4: { stallNpstWr = 1; } |
| 498 | } |
| 499 | } |
| 500 | |
| 501 | // |
| 502 | // If no "vera random seed" was specified, then we have a directed test. |
| 503 | // Use default values for all tests. |
| 504 | // |
| 505 | else |
| 506 | { |
| 507 | #endif |
| 508 | |
| 509 | mps = 128; |
| 510 | len1 = 10; |
| 511 | len2 = 10; |
| 512 | len16 = 0; |
| 513 | lenBulk = 0; |
| 514 | egressThrottle = -1; |
| 515 | ingressThrottle = useLpu ? 0 : -1; |
| 516 | ingressAbortRate = useLpu ? 0 : 10; |
| 517 | stallNpstWr = 0; |
| 518 | minGap = 2; |
| 519 | maxGap = 2; |
| 520 | |
| 521 | #ifndef N2_FC |
| 522 | } |
| 523 | #endif |
| 524 | |
| 525 | |
| 526 | // |
| 527 | // Set the environment parameters determined above. |
| 528 | // |
| 529 | env.setLenWeights( len1, len2, len16, lenBulk ); |
| 530 | env.setIngressAbortRate( ingressAbortRate ); |
| 531 | env.setIngressThrottle( ingressThrottle ); |
| 532 | env.setIngressGap( minGap, maxGap ); |
| 533 | env.setEgressThrottle( egressThrottle ); |
| 534 | env.setMaxPayloadSize( mps ); |
| 535 | env.setMaxRequestSize( 4096 ); |
| 536 | // env.setMaxRequestSize( mps ); |
| 537 | if ( stallNpstWr && !useLpu ) |
| 538 | env.stallNonpostedWrite( 1 ); |
| 539 | |
| 540 | #ifndef N2_FC |
| 541 | // If we're using the LPU, initialize the replay and acknak timers |
| 542 | //N2 review - Disabled in env |
| 543 | if ( useLpu ) |
| 544 | env.initLpuCSRs( this.numActiveLanes, mps, this.fastTrain, this.enableL0s, this.retryBufSize ); |
| 545 | |
| 546 | // |
| 547 | // Bring up the link and present initial credit advertisements to the TLU |
| 548 | // |
| 549 | env.linkUp( 20 * (urandom()%5) + 20, this.txBadInit ); |
| 550 | |
| 551 | // Wait a bit and make sure the 'link up' event was recorded |
| 552 | repeat(20) @(posedge CLOCK); |
| 553 | env.expectError( e_ERR_oe_lup, 1, 0 ); |
| 554 | #endif |
| 555 | } |
| 556 | |
| 557 | |
| 558 | task PEUTestBase::setPIO() { |
| 559 | |
| 560 | pio.StratStop = 1'b0; |
| 561 | pio._stratNum = 0; |
| 562 | pio.NumStrat = 15000; |
| 563 | |
| 564 | pio._ep_cpl_mode = e_fixed; |
| 565 | pio._ep_cpl_fixed = e_false; |
| 566 | |
| 567 | pio._cpl_status_mode = e_fixed; |
| 568 | pio._cpl_status_fixed = PEC_PCI__CPL_STATUS_SC; |
| 569 | |
| 570 | } |
| 571 | |
| 572 | |
| 573 | task PEUTestBase::setDMA() { |
| 574 | |
| 575 | dma.StratStop = 1'b0; |
| 576 | dma._stratNum = 0; |
| 577 | dma.NumStrat = ( this.slowClock || this.stallNpstWr ) ? 25000 : 15000; |
| 578 | } |
| 579 | |
| 580 | |
| 581 | task PEUTestBase::runPIO() { |
| 582 | |
| 583 | pio.Execute(); |
| 584 | if (pio.StratStop !== 1'b1) |
| 585 | error("PIO Background Traffic Finished Early\n"); |
| 586 | } |
| 587 | |
| 588 | |
| 589 | task PEUTestBase::runDMA() { |
| 590 | |
| 591 | dma.Execute(); |
| 592 | if (dma.StratStop !== 1'b1) |
| 593 | error("DMA Background Traffic Finished Early\n"); |
| 594 | } |
| 595 | |
| 596 | |
| 597 | task PEUTestBase::Seed() |
| 598 | { |
| 599 | string msg; |
| 600 | bit [31:0] time_0; |
| 601 | |
| 602 | // Grab Seed With Time of Day Bit |
| 603 | if ( get_plus_arg( CHECK, "seed_with_tod=" )) |
| 604 | seed_with_tod = get_plus_arg( NUM, "seed_with_tod=" ); |
| 605 | |
| 606 | // Seed With Time of Day if Set |
| 607 | if (seed_with_tod) { |
| 608 | time_0 = get_systime(); |
| 609 | urandom(time_0); |
| 610 | urand_seed = time_0 + urandom(); |
| 611 | } |
| 612 | |
| 613 | // Grab Urandom Seed From Command Line If Present |
| 614 | if ( get_plus_arg( CHECK, "urand_seed=" )) |
| 615 | urand_seed = get_plus_arg( HNUM, "urand_seed=" ); |
| 616 | |
| 617 | urandom(urand_seed); |
| 618 | |
| 619 | if (seed_with_tod) |
| 620 | QuickReport(Report,RTYP_INFO, "ilupeuTestBase: urandom() seeded with time of day, seed=%h \n", |
| 621 | urand_seed ); |
| 622 | else |
| 623 | QuickReport(Report,RTYP_INFO,"ilupeuTestBase: urandom() seeded with seed=%h \n", urand_seed ); |
| 624 | |
| 625 | } // End task Seed() |
| 626 | |
| 627 | task PEUTestBase::runTest() { } |
| 628 | |
| 629 | task PEUTestBase::stopPioDma(){ |
| 630 | |
| 631 | pio.StratStop = 1'b1; |
| 632 | dma.StratStop = 1'b1; |
| 633 | } |