1/* 2 * Copyright (c) 2004-2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 467 unchanged lines hidden (view full) --- 476 "[sn:%i].\n", tid, inst->readPC(), inst->seqNum); 477 478 toCommit->squash[tid] = true; 479 toCommit->squashedSeqNum[tid] = inst->seqNum; 480 toCommit->mispredPC[tid] = inst->readPC(); 481 toCommit->branchMispredict[tid] = true; 482 483#if ISA_HAS_DELAY_SLOT |
484 int instSize = sizeof(TheISA::MachInst); 485 bool branch_taken = 486 !(inst->readNextPC() + instSize == inst->readNextNPC() && 487 (inst->readNextPC() == inst->readPC() + instSize || 488 inst->readNextPC() == inst->readPC() + 2 * instSize)); 489 DPRINTF(Sparc, "Branch taken = %s [sn:%i]\n", 490 branch_taken ? "true": "false", inst->seqNum); |
491 492 toCommit->branchTaken[tid] = branch_taken; 493 |
494 bool squashDelaySlot = true; 495// (inst->readNextPC() != inst->readPC() + sizeof(TheISA::MachInst)); 496 DPRINTF(Sparc, "Squash delay slot = %s [sn:%i]\n", 497 squashDelaySlot ? "true": "false", inst->seqNum); 498 toCommit->squashDelaySlot[tid] = squashDelaySlot; 499 //If we're squashing the delay slot, we need to pick back up at NextPC. 500 //Otherwise, NextPC isn't being squashed, so we should pick back up at 501 //NextNPC. 502 if (squashDelaySlot) { |
503 toCommit->nextPC[tid] = inst->readNextPC(); |
504 toCommit->nextNPC[tid] = inst->readNextNPC(); 505 } else |
506 toCommit->nextPC[tid] = inst->readNextNPC(); |
507#else 508 toCommit->branchTaken[tid] = inst->readNextPC() != 509 (inst->readPC() + sizeof(TheISA::MachInst)); 510 toCommit->nextPC[tid] = inst->readNextPC(); 511#endif 512 513 toCommit->includeSquashInst[tid] = false; 514 --- 5 unchanged lines hidden (view full) --- 520DefaultIEW<Impl>::squashDueToMemOrder(DynInstPtr &inst, unsigned tid) 521{ 522 DPRINTF(IEW, "[tid:%i]: Squashing from a specific instruction, " 523 "PC: %#x [sn:%i].\n", tid, inst->readPC(), inst->seqNum); 524 525 toCommit->squash[tid] = true; 526 toCommit->squashedSeqNum[tid] = inst->seqNum; 527 toCommit->nextPC[tid] = inst->readNextPC(); |
528#if ISA_HAS_DELAY_SLOT 529 toCommit->nextNPC[tid] = inst->readNextNPC(); 530#endif |
531 toCommit->branchMispredict[tid] = false; 532 533 toCommit->includeSquashInst[tid] = false; 534 535 wroteToTimeBuffer = true; 536} 537 538template<class Impl> 539void 540DefaultIEW<Impl>::squashDueToMemBlocked(DynInstPtr &inst, unsigned tid) 541{ 542 DPRINTF(IEW, "[tid:%i]: Memory blocked, squashing load and younger insts, " 543 "PC: %#x [sn:%i].\n", tid, inst->readPC(), inst->seqNum); 544 545 toCommit->squash[tid] = true; 546 toCommit->squashedSeqNum[tid] = inst->seqNum; 547 toCommit->nextPC[tid] = inst->readPC(); |
548#if ISA_HAS_DELAY_SLOT 549 toCommit->nextNPC[tid] = inst->readNextNPC(); 550#endif |
551 toCommit->branchMispredict[tid] = false; 552 553 // Must include the broadcasted SN in the squash. 554 toCommit->includeSquashInst[tid] = true; 555 556 ldstQueue.setLoadBlockedHandled(tid); 557 558 wroteToTimeBuffer = true; --- 124 unchanged lines hidden (view full) --- 683} 684 685template<class Impl> 686int 687DefaultIEW<Impl>::skidCount() 688{ 689 int max=0; 690 |
691 std::list<unsigned>::iterator threads = (*activeThreads).begin(); |
692 |
693 while (threads != (*activeThreads).end()) { 694 unsigned thread_count = skidBuffer[*threads++].size(); |
695 if (max < thread_count) 696 max = thread_count; 697 } 698 699 return max; 700} 701 702template<class Impl> 703bool 704DefaultIEW<Impl>::skidsEmpty() 705{ |
706 std::list<unsigned>::iterator threads = (*activeThreads).begin(); |
707 |
708 while (threads != (*activeThreads).end()) { 709 if (!skidBuffer[*threads++].empty()) |
710 return false; 711 } 712 713 return true; 714} 715 716template <class Impl> 717void 718DefaultIEW<Impl>::updateStatus() 719{ 720 bool any_unblocking = false; 721 |
722 std::list<unsigned>::iterator threads = (*activeThreads).begin(); |
723 |
724 threads = (*activeThreads).begin(); 725 726 while (threads != (*activeThreads).end()) { |
727 unsigned tid = *threads++; 728 729 if (dispatchStatus[tid] == Unblocking) { 730 any_unblocking = true; 731 break; 732 } 733 } 734 --- 397 unchanged lines hidden (view full) --- 1132 add_to_iq = false; 1133 1134 ++iewDispNonSpecInsts; 1135 } else { 1136 add_to_iq = true; 1137 } 1138 1139 toRename->iewInfo[tid].dispatchedToLSQ++; |
1140#if FULL_SYSTEM |
1141 } else if (inst->isMemBarrier() || inst->isWriteBarrier()) { 1142 // Same as non-speculative stores. 1143 inst->setCanCommit(); 1144 instQueue.insertBarrier(inst); 1145 add_to_iq = false; |
1146#endif |
1147 } else if (inst->isNonSpeculative()) { 1148 DPRINTF(IEW, "[tid:%i]: Issue: Nonspeculative instruction " 1149 "encountered, skipping.\n", tid); 1150 1151 // Same as non-speculative stores. 1152 inst->setCanCommit(); 1153 1154 // Specifically insert it as nonspeculative. --- 83 unchanged lines hidden (view full) --- 1238 1239template <class Impl> 1240void 1241DefaultIEW<Impl>::executeInsts() 1242{ 1243 wbNumInst = 0; 1244 wbCycle = 0; 1245 |
1246 std::list<unsigned>::iterator threads = (*activeThreads).begin(); |
1247 |
1248 while (threads != (*activeThreads).end()) { |
1249 unsigned tid = *threads++; 1250 fetchRedirect[tid] = false; 1251 } 1252 1253 // Uncomment this if you want to see all available instructions. 1254// printAvailableInsts(); 1255 1256 // Execute/writeback any instructions that are available. --- 93 unchanged lines hidden (view full) --- 1350 1351 if (!fetchRedirect[tid] || 1352 toCommit->squashedSeqNum[tid] > inst->seqNum) { 1353 1354 if (inst->mispredicted()) { 1355 fetchRedirect[tid] = true; 1356 1357 DPRINTF(IEW, "Execute: Branch mispredict detected.\n"); |
1358 DPRINTF(IEW, "Predicted target was %#x.\n", inst->predPC); |
1359#if ISA_HAS_DELAY_SLOT 1360 DPRINTF(IEW, "Execute: Redirecting fetch to PC: %#x.\n", 1361 inst->nextNPC); 1362#else 1363 DPRINTF(IEW, "Execute: Redirecting fetch to PC: %#x.\n", 1364 inst->nextPC); 1365#endif 1366 // If incorrect, then signal the ROB that it must be squashed. 1367 squashDueToBranch(inst, tid); 1368 |
1369 if (inst->readPredTaken()) { |
1370 predictedTakenIncorrect++; 1371 } else { 1372 predictedNotTakenIncorrect++; 1373 } 1374 } else if (ldstQueue.violation(tid)) { 1375 // If there was an ordering violation, then get the 1376 // DynInst that caused the violation. Note that this 1377 // clears the violation signal. --- 104 unchanged lines hidden (view full) --- 1482 wroteToTimeBuffer = false; 1483 updatedQueues = false; 1484 1485 sortInsts(); 1486 1487 // Free function units marked as being freed this cycle. 1488 fuPool->processFreeUnits(); 1489 |
1490 std::list<unsigned>::iterator threads = (*activeThreads).begin(); |
1491 1492 // Check stall and squash signals, dispatch any instructions. |
1493 while (threads != (*activeThreads).end()) { 1494 unsigned tid = *threads++; |
1495 1496 DPRINTF(IEW,"Issue: Processing [tid:%i]\n",tid); 1497 1498 checkSignalsAndUpdate(tid); 1499 dispatch(tid); 1500 } 1501 1502 if (exeStatus != Squashing) { --- 23 unchanged lines hidden (view full) --- 1526 // Writeback any stores using any leftover bandwidth. 1527 ldstQueue.writebackStores(); 1528 1529 // Check the committed load/store signals to see if there's a load 1530 // or store to commit. Also check if it's being told to execute a 1531 // nonspeculative instruction. 1532 // This is pretty inefficient... 1533 |
1534 threads = (*activeThreads).begin(); 1535 while (threads != (*activeThreads).end()) { |
1536 unsigned tid = (*threads++); 1537 1538 DPRINTF(IEW,"Processing [tid:%i]\n",tid); 1539 1540 // Update structures based on instructions committed. 1541 if (fromCommit->commitInfo[tid].doneSeqNum != 0 && 1542 !fromCommit->commitInfo[tid].squash && 1543 !fromCommit->commitInfo[tid].robSquashing) { --- 88 unchanged lines hidden --- |