iew_impl.hh revision 2863
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; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution; 12 * neither the name of the copyright holders nor the names of its 13 * contributors may be used to endorse or promote products derived from 14 * this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * Authors: Kevin Lim 29 */ 30 31// @todo: Fix the instantaneous communication among all the stages within 32// iew. There's a clear delay between issue and execute, yet backwards 33// communication happens simultaneously. 34 35#include <queue> 36 37#include "base/timebuf.hh" 38#include "cpu/o3/fu_pool.hh" 39#include "cpu/o3/iew.hh" 40 41using namespace std; 42 43template<class Impl> 44DefaultIEW<Impl>::DefaultIEW(Params *params) 45 : // @todo: Make this into a parameter. 46 issueToExecQueue(5, 5), 47 instQueue(params), 48 ldstQueue(params), 49 fuPool(params->fuPool), 50 commitToIEWDelay(params->commitToIEWDelay), 51 renameToIEWDelay(params->renameToIEWDelay), 52 issueToExecuteDelay(params->issueToExecuteDelay), 53 dispatchWidth(params->dispatchWidth), 54 issueWidth(params->issueWidth), 55 wbOutstanding(0), 56 wbWidth(params->wbWidth), 57 numThreads(params->numberOfThreads), 58 switchedOut(false) 59{ 60 _status = Active; 61 exeStatus = Running; 62 wbStatus = Idle; 63 64 // Setup wire to read instructions coming from issue. 65 fromIssue = issueToExecQueue.getWire(-issueToExecuteDelay); 66 67 // Instruction queue needs the queue between issue and execute. 68 instQueue.setIssueToExecuteQueue(&issueToExecQueue); 69 70 instQueue.setIEW(this); 71 ldstQueue.setIEW(this); 72 73 for (int i=0; i < numThreads; i++) { 74 dispatchStatus[i] = Running; 75 stalls[i].commit = false; 76 fetchRedirect[i] = false; 77 } 78 79 wbMax = wbWidth * params->wbDepth; 80 81 updateLSQNextCycle = false; 82 83 ableToIssue = true; 84 85 skidBufferMax = (3 * (renameToIEWDelay * params->renameWidth)) + issueWidth; 86} 87 88template <class Impl> 89std::string 90DefaultIEW<Impl>::name() const 91{ 92 return cpu->name() + ".iew"; 93} 94 95template <class Impl> 96void 97DefaultIEW<Impl>::regStats() 98{ 99 using namespace Stats; 100 101 instQueue.regStats(); 102 ldstQueue.regStats(); 103 104 iewIdleCycles 105 .name(name() + ".iewIdleCycles") 106 .desc("Number of cycles IEW is idle"); 107 108 iewSquashCycles 109 .name(name() + ".iewSquashCycles") 110 .desc("Number of cycles IEW is squashing"); 111 112 iewBlockCycles 113 .name(name() + ".iewBlockCycles") 114 .desc("Number of cycles IEW is blocking"); 115 116 iewUnblockCycles 117 .name(name() + ".iewUnblockCycles") 118 .desc("Number of cycles IEW is unblocking"); 119 120 iewDispatchedInsts 121 .name(name() + ".iewDispatchedInsts") 122 .desc("Number of instructions dispatched to IQ"); 123 124 iewDispSquashedInsts 125 .name(name() + ".iewDispSquashedInsts") 126 .desc("Number of squashed instructions skipped by dispatch"); 127 128 iewDispLoadInsts 129 .name(name() + ".iewDispLoadInsts") 130 .desc("Number of dispatched load instructions"); 131 132 iewDispStoreInsts 133 .name(name() + ".iewDispStoreInsts") 134 .desc("Number of dispatched store instructions"); 135 136 iewDispNonSpecInsts 137 .name(name() + ".iewDispNonSpecInsts") 138 .desc("Number of dispatched non-speculative instructions"); 139 140 iewIQFullEvents 141 .name(name() + ".iewIQFullEvents") 142 .desc("Number of times the IQ has become full, causing a stall"); 143 144 iewLSQFullEvents 145 .name(name() + ".iewLSQFullEvents") 146 .desc("Number of times the LSQ has become full, causing a stall"); 147 148 memOrderViolationEvents 149 .name(name() + ".memOrderViolationEvents") 150 .desc("Number of memory order violations"); 151 152 predictedTakenIncorrect 153 .name(name() + ".predictedTakenIncorrect") 154 .desc("Number of branches that were predicted taken incorrectly"); 155 156 predictedNotTakenIncorrect 157 .name(name() + ".predictedNotTakenIncorrect") 158 .desc("Number of branches that were predicted not taken incorrectly"); 159 160 branchMispredicts 161 .name(name() + ".branchMispredicts") 162 .desc("Number of branch mispredicts detected at execute"); 163 164 branchMispredicts = predictedTakenIncorrect + predictedNotTakenIncorrect; 165 166 iewExecutedInsts 167 .name(name() + ".EXEC:insts") 168 .desc("Number of executed instructions"); 169 170 iewExecLoadInsts 171 .init(cpu->number_of_threads) 172 .name(name() + ".EXEC:loads") 173 .desc("Number of load instructions executed") 174 .flags(total); 175 176 iewExecSquashedInsts 177 .name(name() + ".EXEC:squashedInsts") 178 .desc("Number of squashed instructions skipped in execute"); 179 180 iewExecutedSwp 181 .init(cpu->number_of_threads) 182 .name(name() + ".EXEC:swp") 183 .desc("number of swp insts executed") 184 .flags(total); 185 186 iewExecutedNop 187 .init(cpu->number_of_threads) 188 .name(name() + ".EXEC:nop") 189 .desc("number of nop insts executed") 190 .flags(total); 191 192 iewExecutedRefs 193 .init(cpu->number_of_threads) 194 .name(name() + ".EXEC:refs") 195 .desc("number of memory reference insts executed") 196 .flags(total); 197 198 iewExecutedBranches 199 .init(cpu->number_of_threads) 200 .name(name() + ".EXEC:branches") 201 .desc("Number of branches executed") 202 .flags(total); 203 204 iewExecStoreInsts 205 .name(name() + ".EXEC:stores") 206 .desc("Number of stores executed") 207 .flags(total); 208 iewExecStoreInsts = iewExecutedRefs - iewExecLoadInsts; 209 210 iewExecRate 211 .name(name() + ".EXEC:rate") 212 .desc("Inst execution rate") 213 .flags(total); 214 215 iewExecRate = iewExecutedInsts / cpu->numCycles; 216 217 iewInstsToCommit 218 .init(cpu->number_of_threads) 219 .name(name() + ".WB:sent") 220 .desc("cumulative count of insts sent to commit") 221 .flags(total); 222 223 writebackCount 224 .init(cpu->number_of_threads) 225 .name(name() + ".WB:count") 226 .desc("cumulative count of insts written-back") 227 .flags(total); 228 229 producerInst 230 .init(cpu->number_of_threads) 231 .name(name() + ".WB:producers") 232 .desc("num instructions producing a value") 233 .flags(total); 234 235 consumerInst 236 .init(cpu->number_of_threads) 237 .name(name() + ".WB:consumers") 238 .desc("num instructions consuming a value") 239 .flags(total); 240 241 wbPenalized 242 .init(cpu->number_of_threads) 243 .name(name() + ".WB:penalized") 244 .desc("number of instrctions required to write to 'other' IQ") 245 .flags(total); 246 247 wbPenalizedRate 248 .name(name() + ".WB:penalized_rate") 249 .desc ("fraction of instructions written-back that wrote to 'other' IQ") 250 .flags(total); 251 252 wbPenalizedRate = wbPenalized / writebackCount; 253 254 wbFanout 255 .name(name() + ".WB:fanout") 256 .desc("average fanout of values written-back") 257 .flags(total); 258 259 wbFanout = producerInst / consumerInst; 260 261 wbRate 262 .name(name() + ".WB:rate") 263 .desc("insts written-back per cycle") 264 .flags(total); 265 wbRate = writebackCount / cpu->numCycles; 266} 267 268template<class Impl> 269void 270DefaultIEW<Impl>::initStage() 271{ 272 for (int tid=0; tid < numThreads; tid++) { 273 toRename->iewInfo[tid].usedIQ = true; 274 toRename->iewInfo[tid].freeIQEntries = 275 instQueue.numFreeEntries(tid); 276 277 toRename->iewInfo[tid].usedLSQ = true; 278 toRename->iewInfo[tid].freeLSQEntries = 279 ldstQueue.numFreeEntries(tid); 280 } 281} 282 283template<class Impl> 284void 285DefaultIEW<Impl>::setCPU(O3CPU *cpu_ptr) 286{ 287 DPRINTF(IEW, "Setting CPU pointer.\n"); 288 cpu = cpu_ptr; 289 290 instQueue.setCPU(cpu_ptr); 291 ldstQueue.setCPU(cpu_ptr); 292 293 cpu->activateStage(O3CPU::IEWIdx); 294} 295 296template<class Impl> 297void 298DefaultIEW<Impl>::setTimeBuffer(TimeBuffer<TimeStruct> *tb_ptr) 299{ 300 DPRINTF(IEW, "Setting time buffer pointer.\n"); 301 timeBuffer = tb_ptr; 302 303 // Setup wire to read information from time buffer, from commit. 304 fromCommit = timeBuffer->getWire(-commitToIEWDelay); 305 306 // Setup wire to write information back to previous stages. 307 toRename = timeBuffer->getWire(0); 308 309 toFetch = timeBuffer->getWire(0); 310 311 // Instruction queue also needs main time buffer. 312 instQueue.setTimeBuffer(tb_ptr); 313} 314 315template<class Impl> 316void 317DefaultIEW<Impl>::setRenameQueue(TimeBuffer<RenameStruct> *rq_ptr) 318{ 319 DPRINTF(IEW, "Setting rename queue pointer.\n"); 320 renameQueue = rq_ptr; 321 322 // Setup wire to read information from rename queue. 323 fromRename = renameQueue->getWire(-renameToIEWDelay); 324} 325 326template<class Impl> 327void 328DefaultIEW<Impl>::setIEWQueue(TimeBuffer<IEWStruct> *iq_ptr) 329{ 330 DPRINTF(IEW, "Setting IEW queue pointer.\n"); 331 iewQueue = iq_ptr; 332 333 // Setup wire to write instructions to commit. 334 toCommit = iewQueue->getWire(0); 335} 336 337template<class Impl> 338void 339DefaultIEW<Impl>::setActiveThreads(list<unsigned> *at_ptr) 340{ 341 DPRINTF(IEW, "Setting active threads list pointer.\n"); 342 activeThreads = at_ptr; 343 344 ldstQueue.setActiveThreads(at_ptr); 345 instQueue.setActiveThreads(at_ptr); 346} 347 348template<class Impl> 349void 350DefaultIEW<Impl>::setScoreboard(Scoreboard *sb_ptr) 351{ 352 DPRINTF(IEW, "Setting scoreboard pointer.\n"); 353 scoreboard = sb_ptr; 354} 355 356template <class Impl> 357bool 358DefaultIEW<Impl>::drain() 359{ 360 // IEW is ready to drain at any time. 361 cpu->signalDrained(); 362 return true; 363} 364 365template <class Impl> 366void 367DefaultIEW<Impl>::resume() 368{ 369} 370 371template <class Impl> 372void 373DefaultIEW<Impl>::switchOut() 374{ 375 // Clear any state. 376 switchedOut = true; 377 378 instQueue.switchOut(); 379 ldstQueue.switchOut(); 380 fuPool->switchOut(); 381 382 for (int i = 0; i < numThreads; i++) { 383 while (!insts[i].empty()) 384 insts[i].pop(); 385 while (!skidBuffer[i].empty()) 386 skidBuffer[i].pop(); 387 } 388} 389 390template <class Impl> 391void 392DefaultIEW<Impl>::takeOverFrom() 393{ 394 // Reset all state. 395 _status = Active; 396 exeStatus = Running; 397 wbStatus = Idle; 398 switchedOut = false; 399 400 instQueue.takeOverFrom(); 401 ldstQueue.takeOverFrom(); 402 fuPool->takeOverFrom(); 403 404 initStage(); 405 cpu->activityThisCycle(); 406 407 for (int i=0; i < numThreads; i++) { 408 dispatchStatus[i] = Running; 409 stalls[i].commit = false; 410 fetchRedirect[i] = false; 411 } 412 413 updateLSQNextCycle = false; 414 415 // @todo: Fix hardcoded number 416 for (int i = 0; i < 6; ++i) { 417 issueToExecQueue.advance(); 418 } 419} 420 421template<class Impl> 422void 423DefaultIEW<Impl>::squash(unsigned tid) 424{ 425 DPRINTF(IEW, "[tid:%i]: Squashing all instructions.\n", 426 tid); 427 428 // Tell the IQ to start squashing. 429 instQueue.squash(tid); 430 431 // Tell the LDSTQ to start squashing. 432 ldstQueue.squash(fromCommit->commitInfo[tid].doneSeqNum, tid); 433 434 updatedQueues = true; 435 436 // Clear the skid buffer in case it has any data in it. 437 while (!skidBuffer[tid].empty()) { 438 439 if (skidBuffer[tid].front()->isLoad() || 440 skidBuffer[tid].front()->isStore() ) { 441 toRename->iewInfo[tid].dispatchedToLSQ++; 442 } 443 444 toRename->iewInfo[tid].dispatched++; 445 446 skidBuffer[tid].pop(); 447 } 448 449 emptyRenameInsts(tid); 450} 451 452template<class Impl> 453void 454DefaultIEW<Impl>::squashDueToBranch(DynInstPtr &inst, unsigned tid) 455{ 456 DPRINTF(IEW, "[tid:%i]: Squashing from a specific instruction, PC: %#x " 457 "[sn:%i].\n", tid, inst->readPC(), inst->seqNum); 458 459 toCommit->squash[tid] = true; 460 toCommit->squashedSeqNum[tid] = inst->seqNum; 461 toCommit->mispredPC[tid] = inst->readPC(); 462 toCommit->nextPC[tid] = inst->readNextPC(); 463 toCommit->branchMispredict[tid] = true; 464 toCommit->branchTaken[tid] = inst->readNextPC() != 465 (inst->readPC() + sizeof(TheISA::MachInst)); 466 467 toCommit->includeSquashInst[tid] = false; 468 469 wroteToTimeBuffer = true; 470} 471 472template<class Impl> 473void 474DefaultIEW<Impl>::squashDueToMemOrder(DynInstPtr &inst, unsigned tid) 475{ 476 DPRINTF(IEW, "[tid:%i]: Squashing from a specific instruction, " 477 "PC: %#x [sn:%i].\n", tid, inst->readPC(), inst->seqNum); 478 479 toCommit->squash[tid] = true; 480 toCommit->squashedSeqNum[tid] = inst->seqNum; 481 toCommit->nextPC[tid] = inst->readNextPC(); 482 483 toCommit->includeSquashInst[tid] = false; 484 485 wroteToTimeBuffer = true; 486} 487 488template<class Impl> 489void 490DefaultIEW<Impl>::squashDueToMemBlocked(DynInstPtr &inst, unsigned tid) 491{ 492 DPRINTF(IEW, "[tid:%i]: Memory blocked, squashing load and younger insts, " 493 "PC: %#x [sn:%i].\n", tid, inst->readPC(), inst->seqNum); 494 495 toCommit->squash[tid] = true; 496 toCommit->squashedSeqNum[tid] = inst->seqNum; 497 toCommit->nextPC[tid] = inst->readPC(); 498 499 // Must include the broadcasted SN in the squash. 500 toCommit->includeSquashInst[tid] = true; 501 502 ldstQueue.setLoadBlockedHandled(tid); 503 504 wroteToTimeBuffer = true; 505} 506 507template<class Impl> 508void 509DefaultIEW<Impl>::block(unsigned tid) 510{ 511 DPRINTF(IEW, "[tid:%u]: Blocking.\n", tid); 512 513 if (dispatchStatus[tid] != Blocked && 514 dispatchStatus[tid] != Unblocking) { 515 toRename->iewBlock[tid] = true; 516 wroteToTimeBuffer = true; 517 } 518 519 // Add the current inputs to the skid buffer so they can be 520 // reprocessed when this stage unblocks. 521 skidInsert(tid); 522 523 dispatchStatus[tid] = Blocked; 524} 525 526template<class Impl> 527void 528DefaultIEW<Impl>::unblock(unsigned tid) 529{ 530 DPRINTF(IEW, "[tid:%i]: Reading instructions out of the skid " 531 "buffer %u.\n",tid, tid); 532 533 // If the skid bufffer is empty, signal back to previous stages to unblock. 534 // Also switch status to running. 535 if (skidBuffer[tid].empty()) { 536 toRename->iewUnblock[tid] = true; 537 wroteToTimeBuffer = true; 538 DPRINTF(IEW, "[tid:%i]: Done unblocking.\n",tid); 539 dispatchStatus[tid] = Running; 540 } 541} 542 543template<class Impl> 544void 545DefaultIEW<Impl>::wakeDependents(DynInstPtr &inst) 546{ 547 instQueue.wakeDependents(inst); 548} 549 550template<class Impl> 551void 552DefaultIEW<Impl>::rescheduleMemInst(DynInstPtr &inst) 553{ 554 instQueue.rescheduleMemInst(inst); 555} 556 557template<class Impl> 558void 559DefaultIEW<Impl>::replayMemInst(DynInstPtr &inst) 560{ 561 instQueue.replayMemInst(inst); 562} 563 564template<class Impl> 565void 566DefaultIEW<Impl>::instToCommit(DynInstPtr &inst) 567{ 568 // First check the time slot that this instruction will write 569 // to. If there are free write ports at the time, then go ahead 570 // and write the instruction to that time. If there are not, 571 // keep looking back to see where's the first time there's a 572 // free slot. 573 while ((*iewQueue)[wbCycle].insts[wbNumInst]) { 574 ++wbNumInst; 575 if (wbNumInst == wbWidth) { 576 ++wbCycle; 577 wbNumInst = 0; 578 } 579 580 assert((wbCycle * wbWidth + wbNumInst) < wbMax); 581 } 582 583 // Add finished instruction to queue to commit. 584 (*iewQueue)[wbCycle].insts[wbNumInst] = inst; 585 (*iewQueue)[wbCycle].size++; 586} 587 588template <class Impl> 589unsigned 590DefaultIEW<Impl>::validInstsFromRename() 591{ 592 unsigned inst_count = 0; 593 594 for (int i=0; i<fromRename->size; i++) { 595 if (!fromRename->insts[i]->isSquashed()) 596 inst_count++; 597 } 598 599 return inst_count; 600} 601 602template<class Impl> 603void 604DefaultIEW<Impl>::skidInsert(unsigned tid) 605{ 606 DynInstPtr inst = NULL; 607 608 while (!insts[tid].empty()) { 609 inst = insts[tid].front(); 610 611 insts[tid].pop(); 612 613 DPRINTF(Decode,"[tid:%i]: Inserting [sn:%lli] PC:%#x into " 614 "dispatch skidBuffer %i\n",tid, inst->seqNum, 615 inst->readPC(),tid); 616 617 skidBuffer[tid].push(inst); 618 } 619 620 assert(skidBuffer[tid].size() <= skidBufferMax && 621 "Skidbuffer Exceeded Max Size"); 622} 623 624template<class Impl> 625int 626DefaultIEW<Impl>::skidCount() 627{ 628 int max=0; 629 630 list<unsigned>::iterator threads = (*activeThreads).begin(); 631 632 while (threads != (*activeThreads).end()) { 633 unsigned thread_count = skidBuffer[*threads++].size(); 634 if (max < thread_count) 635 max = thread_count; 636 } 637 638 return max; 639} 640 641template<class Impl> 642bool 643DefaultIEW<Impl>::skidsEmpty() 644{ 645 list<unsigned>::iterator threads = (*activeThreads).begin(); 646 647 while (threads != (*activeThreads).end()) { 648 if (!skidBuffer[*threads++].empty()) 649 return false; 650 } 651 652 return true; 653} 654 655template <class Impl> 656void 657DefaultIEW<Impl>::updateStatus() 658{ 659 bool any_unblocking = false; 660 661 list<unsigned>::iterator threads = (*activeThreads).begin(); 662 663 threads = (*activeThreads).begin(); 664 665 while (threads != (*activeThreads).end()) { 666 unsigned tid = *threads++; 667 668 if (dispatchStatus[tid] == Unblocking) { 669 any_unblocking = true; 670 break; 671 } 672 } 673 674 // If there are no ready instructions waiting to be scheduled by the IQ, 675 // and there's no stores waiting to write back, and dispatch is not 676 // unblocking, then there is no internal activity for the IEW stage. 677 if (_status == Active && !instQueue.hasReadyInsts() && 678 !ldstQueue.willWB() && !any_unblocking) { 679 DPRINTF(IEW, "IEW switching to idle\n"); 680 681 deactivateStage(); 682 683 _status = Inactive; 684 } else if (_status == Inactive && (instQueue.hasReadyInsts() || 685 ldstQueue.willWB() || 686 any_unblocking)) { 687 // Otherwise there is internal activity. Set to active. 688 DPRINTF(IEW, "IEW switching to active\n"); 689 690 activateStage(); 691 692 _status = Active; 693 } 694} 695 696template <class Impl> 697void 698DefaultIEW<Impl>::resetEntries() 699{ 700 instQueue.resetEntries(); 701 ldstQueue.resetEntries(); 702} 703 704template <class Impl> 705void 706DefaultIEW<Impl>::readStallSignals(unsigned tid) 707{ 708 if (fromCommit->commitBlock[tid]) { 709 stalls[tid].commit = true; 710 } 711 712 if (fromCommit->commitUnblock[tid]) { 713 assert(stalls[tid].commit); 714 stalls[tid].commit = false; 715 } 716} 717 718template <class Impl> 719bool 720DefaultIEW<Impl>::checkStall(unsigned tid) 721{ 722 bool ret_val(false); 723 724 if (stalls[tid].commit) { 725 DPRINTF(IEW,"[tid:%i]: Stall from Commit stage detected.\n",tid); 726 ret_val = true; 727 } else if (instQueue.isFull(tid)) { 728 DPRINTF(IEW,"[tid:%i]: Stall: IQ is full.\n",tid); 729 ret_val = true; 730 } else if (ldstQueue.isFull(tid)) { 731 DPRINTF(IEW,"[tid:%i]: Stall: LSQ is full\n",tid); 732 733 if (ldstQueue.numLoads(tid) > 0 ) { 734 735 DPRINTF(IEW,"[tid:%i]: LSQ oldest load: [sn:%i] \n", 736 tid,ldstQueue.getLoadHeadSeqNum(tid)); 737 } 738 739 if (ldstQueue.numStores(tid) > 0) { 740 741 DPRINTF(IEW,"[tid:%i]: LSQ oldest store: [sn:%i] \n", 742 tid,ldstQueue.getStoreHeadSeqNum(tid)); 743 } 744 745 ret_val = true; 746 } else if (ldstQueue.isStalled(tid)) { 747 DPRINTF(IEW,"[tid:%i]: Stall: LSQ stall detected.\n",tid); 748 ret_val = true; 749 } 750 751 return ret_val; 752} 753 754template <class Impl> 755void 756DefaultIEW<Impl>::checkSignalsAndUpdate(unsigned tid) 757{ 758 // Check if there's a squash signal, squash if there is 759 // Check stall signals, block if there is. 760 // If status was Blocked 761 // if so then go to unblocking 762 // If status was Squashing 763 // check if squashing is not high. Switch to running this cycle. 764 765 readStallSignals(tid); 766 767 if (fromCommit->commitInfo[tid].squash) { 768 squash(tid); 769 770 if (dispatchStatus[tid] == Blocked || 771 dispatchStatus[tid] == Unblocking) { 772 toRename->iewUnblock[tid] = true; 773 wroteToTimeBuffer = true; 774 } 775 776 dispatchStatus[tid] = Squashing; 777 778 fetchRedirect[tid] = false; 779 return; 780 } 781 782 if (fromCommit->commitInfo[tid].robSquashing) { 783 DPRINTF(IEW, "[tid:%i]: ROB is still squashing.\n", tid); 784 785 dispatchStatus[tid] = Squashing; 786 787 emptyRenameInsts(tid); 788 wroteToTimeBuffer = true; 789 return; 790 } 791 792 if (checkStall(tid)) { 793 block(tid); 794 dispatchStatus[tid] = Blocked; 795 return; 796 } 797 798 if (dispatchStatus[tid] == Blocked) { 799 // Status from previous cycle was blocked, but there are no more stall 800 // conditions. Switch over to unblocking. 801 DPRINTF(IEW, "[tid:%i]: Done blocking, switching to unblocking.\n", 802 tid); 803 804 dispatchStatus[tid] = Unblocking; 805 806 unblock(tid); 807 808 return; 809 } 810 811 if (dispatchStatus[tid] == Squashing) { 812 // Switch status to running if rename isn't being told to block or 813 // squash this cycle. 814 DPRINTF(IEW, "[tid:%i]: Done squashing, switching to running.\n", 815 tid); 816 817 dispatchStatus[tid] = Running; 818 819 return; 820 } 821} 822 823template <class Impl> 824void 825DefaultIEW<Impl>::sortInsts() 826{ 827 int insts_from_rename = fromRename->size; 828#ifdef DEBUG 829 for (int i = 0; i < numThreads; i++) 830 assert(insts[i].empty()); 831#endif 832 for (int i = 0; i < insts_from_rename; ++i) { 833 insts[fromRename->insts[i]->threadNumber].push(fromRename->insts[i]); 834 } 835} 836 837template <class Impl> 838void 839DefaultIEW<Impl>::emptyRenameInsts(unsigned tid) 840{ 841 while (!insts[tid].empty()) { 842 if (insts[tid].front()->isLoad() || 843 insts[tid].front()->isStore() ) { 844 toRename->iewInfo[tid].dispatchedToLSQ++; 845 } 846 847 toRename->iewInfo[tid].dispatched++; 848 849 insts[tid].pop(); 850 } 851} 852 853template <class Impl> 854void 855DefaultIEW<Impl>::wakeCPU() 856{ 857 cpu->wakeCPU(); 858} 859 860template <class Impl> 861void 862DefaultIEW<Impl>::activityThisCycle() 863{ 864 DPRINTF(Activity, "Activity this cycle.\n"); 865 cpu->activityThisCycle(); 866} 867 868template <class Impl> 869inline void 870DefaultIEW<Impl>::activateStage() 871{ 872 DPRINTF(Activity, "Activating stage.\n"); 873 cpu->activateStage(O3CPU::IEWIdx); 874} 875 876template <class Impl> 877inline void 878DefaultIEW<Impl>::deactivateStage() 879{ 880 DPRINTF(Activity, "Deactivating stage.\n"); 881 cpu->deactivateStage(O3CPU::IEWIdx); 882} 883 884template<class Impl> 885void 886DefaultIEW<Impl>::dispatch(unsigned tid) 887{ 888 // If status is Running or idle, 889 // call dispatchInsts() 890 // If status is Unblocking, 891 // buffer any instructions coming from rename 892 // continue trying to empty skid buffer 893 // check if stall conditions have passed 894 895 if (dispatchStatus[tid] == Blocked) { 896 ++iewBlockCycles; 897 898 } else if (dispatchStatus[tid] == Squashing) { 899 ++iewSquashCycles; 900 } 901 902 // Dispatch should try to dispatch as many instructions as its bandwidth 903 // will allow, as long as it is not currently blocked. 904 if (dispatchStatus[tid] == Running || 905 dispatchStatus[tid] == Idle) { 906 DPRINTF(IEW, "[tid:%i] Not blocked, so attempting to run " 907 "dispatch.\n", tid); 908 909 dispatchInsts(tid); 910 } else if (dispatchStatus[tid] == Unblocking) { 911 // Make sure that the skid buffer has something in it if the 912 // status is unblocking. 913 assert(!skidsEmpty()); 914 915 // If the status was unblocking, then instructions from the skid 916 // buffer were used. Remove those instructions and handle 917 // the rest of unblocking. 918 dispatchInsts(tid); 919 920 ++iewUnblockCycles; 921 922 if (validInstsFromRename() && dispatchedAllInsts) { 923 // Add the current inputs to the skid buffer so they can be 924 // reprocessed when this stage unblocks. 925 skidInsert(tid); 926 } 927 928 unblock(tid); 929 } 930} 931 932template <class Impl> 933void 934DefaultIEW<Impl>::dispatchInsts(unsigned tid) 935{ 936 dispatchedAllInsts = true; 937 938 // Obtain instructions from skid buffer if unblocking, or queue from rename 939 // otherwise. 940 std::queue<DynInstPtr> &insts_to_dispatch = 941 dispatchStatus[tid] == Unblocking ? 942 skidBuffer[tid] : insts[tid]; 943 944 int insts_to_add = insts_to_dispatch.size(); 945 946 DynInstPtr inst; 947 bool add_to_iq = false; 948 int dis_num_inst = 0; 949 950 // Loop through the instructions, putting them in the instruction 951 // queue. 952 for ( ; dis_num_inst < insts_to_add && 953 dis_num_inst < dispatchWidth; 954 ++dis_num_inst) 955 { 956 inst = insts_to_dispatch.front(); 957 958 if (dispatchStatus[tid] == Unblocking) { 959 DPRINTF(IEW, "[tid:%i]: Issue: Examining instruction from skid " 960 "buffer\n", tid); 961 } 962 963 // Make sure there's a valid instruction there. 964 assert(inst); 965 966 DPRINTF(IEW, "[tid:%i]: Issue: Adding PC %#x [sn:%lli] [tid:%i] to " 967 "IQ.\n", 968 tid, inst->readPC(), inst->seqNum, inst->threadNumber); 969 970 // Be sure to mark these instructions as ready so that the 971 // commit stage can go ahead and execute them, and mark 972 // them as issued so the IQ doesn't reprocess them. 973 974 // Check for squashed instructions. 975 if (inst->isSquashed()) { 976 DPRINTF(IEW, "[tid:%i]: Issue: Squashed instruction encountered, " 977 "not adding to IQ.\n", tid); 978 979 ++iewDispSquashedInsts; 980 981 insts_to_dispatch.pop(); 982 983 //Tell Rename That An Instruction has been processed 984 if (inst->isLoad() || inst->isStore()) { 985 toRename->iewInfo[tid].dispatchedToLSQ++; 986 } 987 toRename->iewInfo[tid].dispatched++; 988 989 continue; 990 } 991 992 // Check for full conditions. 993 if (instQueue.isFull(tid)) { 994 DPRINTF(IEW, "[tid:%i]: Issue: IQ has become full.\n", tid); 995 996 // Call function to start blocking. 997 block(tid); 998 999 // Set unblock to false. Special case where we are using 1000 // skidbuffer (unblocking) instructions but then we still 1001 // get full in the IQ. 1002 toRename->iewUnblock[tid] = false; 1003 1004 dispatchedAllInsts = false; 1005 1006 ++iewIQFullEvents; 1007 break; 1008 } else if (ldstQueue.isFull(tid)) { 1009 DPRINTF(IEW, "[tid:%i]: Issue: LSQ has become full.\n",tid); 1010 1011 // Call function to start blocking. 1012 block(tid); 1013 1014 // Set unblock to false. Special case where we are using 1015 // skidbuffer (unblocking) instructions but then we still 1016 // get full in the IQ. 1017 toRename->iewUnblock[tid] = false; 1018 1019 dispatchedAllInsts = false; 1020 1021 ++iewLSQFullEvents; 1022 break; 1023 } 1024 1025 // Otherwise issue the instruction just fine. 1026 if (inst->isLoad()) { 1027 DPRINTF(IEW, "[tid:%i]: Issue: Memory instruction " 1028 "encountered, adding to LSQ.\n", tid); 1029 1030 // Reserve a spot in the load store queue for this 1031 // memory access. 1032 ldstQueue.insertLoad(inst); 1033 1034 ++iewDispLoadInsts; 1035 1036 add_to_iq = true; 1037 1038 toRename->iewInfo[tid].dispatchedToLSQ++; 1039 } else if (inst->isStore()) { 1040 DPRINTF(IEW, "[tid:%i]: Issue: Memory instruction " 1041 "encountered, adding to LSQ.\n", tid); 1042 1043 ldstQueue.insertStore(inst); 1044 1045 ++iewDispStoreInsts; 1046 1047 if (inst->isStoreConditional()) { 1048 // Store conditionals need to be set as "canCommit()" 1049 // so that commit can process them when they reach the 1050 // head of commit. 1051 // @todo: This is somewhat specific to Alpha. 1052 inst->setCanCommit(); 1053 instQueue.insertNonSpec(inst); 1054 add_to_iq = false; 1055 1056 ++iewDispNonSpecInsts; 1057 } else { 1058 add_to_iq = true; 1059 } 1060 1061 toRename->iewInfo[tid].dispatchedToLSQ++; 1062#if FULL_SYSTEM 1063 } else if (inst->isMemBarrier() || inst->isWriteBarrier()) { 1064 // Same as non-speculative stores. 1065 inst->setCanCommit(); 1066 instQueue.insertBarrier(inst); 1067 add_to_iq = false; 1068#endif 1069 } else if (inst->isNonSpeculative()) { 1070 DPRINTF(IEW, "[tid:%i]: Issue: Nonspeculative instruction " 1071 "encountered, skipping.\n", tid); 1072 1073 // Same as non-speculative stores. 1074 inst->setCanCommit(); 1075 1076 // Specifically insert it as nonspeculative. 1077 instQueue.insertNonSpec(inst); 1078 1079 ++iewDispNonSpecInsts; 1080 1081 add_to_iq = false; 1082 } else if (inst->isNop()) { 1083 DPRINTF(IEW, "[tid:%i]: Issue: Nop instruction encountered, " 1084 "skipping.\n", tid); 1085 1086 inst->setIssued(); 1087 inst->setExecuted(); 1088 inst->setCanCommit(); 1089 1090 instQueue.recordProducer(inst); 1091 1092 iewExecutedNop[tid]++; 1093 1094 add_to_iq = false; 1095 } else if (inst->isExecuted()) { 1096 assert(0 && "Instruction shouldn't be executed.\n"); 1097 DPRINTF(IEW, "Issue: Executed branch encountered, " 1098 "skipping.\n"); 1099 1100 inst->setIssued(); 1101 inst->setCanCommit(); 1102 1103 instQueue.recordProducer(inst); 1104 1105 add_to_iq = false; 1106 } else { 1107 add_to_iq = true; 1108 } 1109 1110 // If the instruction queue is not full, then add the 1111 // instruction. 1112 if (add_to_iq) { 1113 instQueue.insert(inst); 1114 } 1115 1116 insts_to_dispatch.pop(); 1117 1118 toRename->iewInfo[tid].dispatched++; 1119 1120 ++iewDispatchedInsts; 1121 } 1122 1123 if (!insts_to_dispatch.empty()) { 1124 DPRINTF(IEW,"[tid:%i]: Issue: Bandwidth Full. Blocking.\n"); 1125 block(tid); 1126 toRename->iewUnblock[tid] = false; 1127 } 1128 1129 if (dispatchStatus[tid] == Idle && dis_num_inst) { 1130 dispatchStatus[tid] = Running; 1131 1132 updatedQueues = true; 1133 } 1134 1135 dis_num_inst = 0; 1136} 1137 1138template <class Impl> 1139void 1140DefaultIEW<Impl>::printAvailableInsts() 1141{ 1142 int inst = 0; 1143 1144 cout << "Available Instructions: "; 1145 1146 while (fromIssue->insts[inst]) { 1147 1148 if (inst%3==0) cout << "\n\t"; 1149 1150 cout << "PC: " << fromIssue->insts[inst]->readPC() 1151 << " TN: " << fromIssue->insts[inst]->threadNumber 1152 << " SN: " << fromIssue->insts[inst]->seqNum << " | "; 1153 1154 inst++; 1155 1156 } 1157 1158 cout << "\n"; 1159} 1160 1161template <class Impl> 1162void 1163DefaultIEW<Impl>::executeInsts() 1164{ 1165 wbNumInst = 0; 1166 wbCycle = 0; 1167 1168 list<unsigned>::iterator threads = (*activeThreads).begin(); 1169 1170 while (threads != (*activeThreads).end()) { 1171 unsigned tid = *threads++; 1172 fetchRedirect[tid] = false; 1173 } 1174 1175 // Uncomment this if you want to see all available instructions. 1176// printAvailableInsts(); 1177 1178 // Execute/writeback any instructions that are available. 1179 int insts_to_execute = fromIssue->size; 1180 int inst_num = 0; 1181 for (; inst_num < insts_to_execute; 1182 ++inst_num) { 1183 1184 DPRINTF(IEW, "Execute: Executing instructions from IQ.\n"); 1185 1186 DynInstPtr inst = instQueue.getInstToExecute(); 1187 1188 DPRINTF(IEW, "Execute: Processing PC %#x, [tid:%i] [sn:%i].\n", 1189 inst->readPC(), inst->threadNumber,inst->seqNum); 1190 1191 // Check if the instruction is squashed; if so then skip it 1192 if (inst->isSquashed()) { 1193 DPRINTF(IEW, "Execute: Instruction was squashed.\n"); 1194 1195 // Consider this instruction executed so that commit can go 1196 // ahead and retire the instruction. 1197 inst->setExecuted(); 1198 1199 // Not sure if I should set this here or just let commit try to 1200 // commit any squashed instructions. I like the latter a bit more. 1201 inst->setCanCommit(); 1202 1203 ++iewExecSquashedInsts; 1204 1205 decrWb(inst->seqNum); 1206 continue; 1207 } 1208 1209 Fault fault = NoFault; 1210 1211 // Execute instruction. 1212 // Note that if the instruction faults, it will be handled 1213 // at the commit stage. 1214 if (inst->isMemRef() && 1215 (!inst->isDataPrefetch() && !inst->isInstPrefetch())) { 1216 DPRINTF(IEW, "Execute: Calculating address for memory " 1217 "reference.\n"); 1218 1219 // Tell the LDSTQ to execute this instruction (if it is a load). 1220 if (inst->isLoad()) { 1221 // Loads will mark themselves as executed, and their writeback 1222 // event adds the instruction to the queue to commit 1223 fault = ldstQueue.executeLoad(inst); 1224 } else if (inst->isStore()) { 1225 ldstQueue.executeStore(inst); 1226 1227 // If the store had a fault then it may not have a mem req 1228 if (inst->req && !(inst->req->getFlags() & LOCKED)) { 1229 inst->setExecuted(); 1230 1231 instToCommit(inst); 1232 } 1233 1234 // Store conditionals will mark themselves as 1235 // executed, and their writeback event will add the 1236 // instruction to the queue to commit. 1237 } else { 1238 panic("Unexpected memory type!\n"); 1239 } 1240 1241 } else { 1242 inst->execute(); 1243 1244 inst->setExecuted(); 1245 1246 instToCommit(inst); 1247 } 1248 1249 updateExeInstStats(inst); 1250 1251 // Check if branch prediction was correct, if not then we need 1252 // to tell commit to squash in flight instructions. Only 1253 // handle this if there hasn't already been something that 1254 // redirects fetch in this group of instructions. 1255 1256 // This probably needs to prioritize the redirects if a different 1257 // scheduler is used. Currently the scheduler schedules the oldest 1258 // instruction first, so the branch resolution order will be correct. 1259 unsigned tid = inst->threadNumber; 1260 1261 if (!fetchRedirect[tid]) { 1262 1263 if (inst->mispredicted()) { 1264 fetchRedirect[tid] = true; 1265 1266 DPRINTF(IEW, "Execute: Branch mispredict detected.\n"); 1267 DPRINTF(IEW, "Execute: Redirecting fetch to PC: %#x.\n", 1268 inst->nextPC); 1269 1270 // If incorrect, then signal the ROB that it must be squashed. 1271 squashDueToBranch(inst, tid); 1272 1273 if (inst->predTaken()) { 1274 predictedTakenIncorrect++; 1275 } else { 1276 predictedNotTakenIncorrect++; 1277 } 1278 } else if (ldstQueue.violation(tid)) { 1279 fetchRedirect[tid] = true; 1280 1281 // If there was an ordering violation, then get the 1282 // DynInst that caused the violation. Note that this 1283 // clears the violation signal. 1284 DynInstPtr violator; 1285 violator = ldstQueue.getMemDepViolator(tid); 1286 1287 DPRINTF(IEW, "LDSTQ detected a violation. Violator PC: " 1288 "%#x, inst PC: %#x. Addr is: %#x.\n", 1289 violator->readPC(), inst->readPC(), inst->physEffAddr); 1290 1291 // Tell the instruction queue that a violation has occured. 1292 instQueue.violation(inst, violator); 1293 1294 // Squash. 1295 squashDueToMemOrder(inst,tid); 1296 1297 ++memOrderViolationEvents; 1298 } else if (ldstQueue.loadBlocked(tid) && 1299 !ldstQueue.isLoadBlockedHandled(tid)) { 1300 fetchRedirect[tid] = true; 1301 1302 DPRINTF(IEW, "Load operation couldn't execute because the " 1303 "memory system is blocked. PC: %#x [sn:%lli]\n", 1304 inst->readPC(), inst->seqNum); 1305 1306 squashDueToMemBlocked(inst, tid); 1307 } 1308 } 1309 } 1310 1311 // Update and record activity if we processed any instructions. 1312 if (inst_num) { 1313 if (exeStatus == Idle) { 1314 exeStatus = Running; 1315 } 1316 1317 updatedQueues = true; 1318 1319 cpu->activityThisCycle(); 1320 } 1321 1322 // Need to reset this in case a writeback event needs to write into the 1323 // iew queue. That way the writeback event will write into the correct 1324 // spot in the queue. 1325 wbNumInst = 0; 1326} 1327 1328template <class Impl> 1329void 1330DefaultIEW<Impl>::writebackInsts() 1331{ 1332 // Loop through the head of the time buffer and wake any 1333 // dependents. These instructions are about to write back. Also 1334 // mark scoreboard that this instruction is finally complete. 1335 // Either have IEW have direct access to scoreboard, or have this 1336 // as part of backwards communication. 1337 for (int inst_num = 0; inst_num < issueWidth && 1338 toCommit->insts[inst_num]; inst_num++) { 1339 DynInstPtr inst = toCommit->insts[inst_num]; 1340 int tid = inst->threadNumber; 1341 1342 DPRINTF(IEW, "Sending instructions to commit, [sn:%lli] PC %#x.\n", 1343 inst->seqNum, inst->readPC()); 1344 1345 iewInstsToCommit[tid]++; 1346 1347 // Some instructions will be sent to commit without having 1348 // executed because they need commit to handle them. 1349 // E.g. Uncached loads have not actually executed when they 1350 // are first sent to commit. Instead commit must tell the LSQ 1351 // when it's ready to execute the uncached load. 1352 if (!inst->isSquashed() && inst->isExecuted()) { 1353 int dependents = instQueue.wakeDependents(inst); 1354 1355 for (int i = 0; i < inst->numDestRegs(); i++) { 1356 //mark as Ready 1357 DPRINTF(IEW,"Setting Destination Register %i\n", 1358 inst->renamedDestRegIdx(i)); 1359 scoreboard->setReg(inst->renamedDestRegIdx(i)); 1360 } 1361 1362 if (dependents) { 1363 producerInst[tid]++; 1364 consumerInst[tid]+= dependents; 1365 } 1366 writebackCount[tid]++; 1367 } 1368 1369 decrWb(inst->seqNum); 1370 } 1371} 1372 1373template<class Impl> 1374void 1375DefaultIEW<Impl>::tick() 1376{ 1377 wbNumInst = 0; 1378 wbCycle = 0; 1379 1380 wroteToTimeBuffer = false; 1381 updatedQueues = false; 1382 1383 sortInsts(); 1384 1385 // Free function units marked as being freed this cycle. 1386 fuPool->processFreeUnits(); 1387 1388 list<unsigned>::iterator threads = (*activeThreads).begin(); 1389 1390 // Check stall and squash signals, dispatch any instructions. 1391 while (threads != (*activeThreads).end()) { 1392 unsigned tid = *threads++; 1393 1394 DPRINTF(IEW,"Issue: Processing [tid:%i]\n",tid); 1395 1396 checkSignalsAndUpdate(tid); 1397 dispatch(tid); 1398 } 1399 1400 if (exeStatus != Squashing) { 1401 executeInsts(); 1402 1403 writebackInsts(); 1404 1405 // Have the instruction queue try to schedule any ready instructions. 1406 // (In actuality, this scheduling is for instructions that will 1407 // be executed next cycle.) 1408 instQueue.scheduleReadyInsts(); 1409 1410 // Also should advance its own time buffers if the stage ran. 1411 // Not the best place for it, but this works (hopefully). 1412 issueToExecQueue.advance(); 1413 } 1414 1415 bool broadcast_free_entries = false; 1416 1417 if (updatedQueues || exeStatus == Running || updateLSQNextCycle) { 1418 exeStatus = Idle; 1419 updateLSQNextCycle = false; 1420 1421 broadcast_free_entries = true; 1422 } 1423 1424 // Writeback any stores using any leftover bandwidth. 1425 ldstQueue.writebackStores(); 1426 1427 // Check the committed load/store signals to see if there's a load 1428 // or store to commit. Also check if it's being told to execute a 1429 // nonspeculative instruction. 1430 // This is pretty inefficient... 1431 1432 threads = (*activeThreads).begin(); 1433 while (threads != (*activeThreads).end()) { 1434 unsigned tid = (*threads++); 1435 1436 DPRINTF(IEW,"Processing [tid:%i]\n",tid); 1437 1438 // Update structures based on instructions committed. 1439 if (fromCommit->commitInfo[tid].doneSeqNum != 0 && 1440 !fromCommit->commitInfo[tid].squash && 1441 !fromCommit->commitInfo[tid].robSquashing) { 1442 1443 ldstQueue.commitStores(fromCommit->commitInfo[tid].doneSeqNum,tid); 1444 1445 ldstQueue.commitLoads(fromCommit->commitInfo[tid].doneSeqNum,tid); 1446 1447 updateLSQNextCycle = true; 1448 instQueue.commit(fromCommit->commitInfo[tid].doneSeqNum,tid); 1449 } 1450 1451 if (fromCommit->commitInfo[tid].nonSpecSeqNum != 0) { 1452 1453 //DPRINTF(IEW,"NonspecInst from thread %i",tid); 1454 if (fromCommit->commitInfo[tid].uncached) { 1455 instQueue.replayMemInst(fromCommit->commitInfo[tid].uncachedLoad); 1456 } else { 1457 instQueue.scheduleNonSpec( 1458 fromCommit->commitInfo[tid].nonSpecSeqNum); 1459 } 1460 } 1461 1462 if (broadcast_free_entries) { 1463 toFetch->iewInfo[tid].iqCount = 1464 instQueue.getCount(tid); 1465 toFetch->iewInfo[tid].ldstqCount = 1466 ldstQueue.getCount(tid); 1467 1468 toRename->iewInfo[tid].usedIQ = true; 1469 toRename->iewInfo[tid].freeIQEntries = 1470 instQueue.numFreeEntries(); 1471 toRename->iewInfo[tid].usedLSQ = true; 1472 toRename->iewInfo[tid].freeLSQEntries = 1473 ldstQueue.numFreeEntries(tid); 1474 1475 wroteToTimeBuffer = true; 1476 } 1477 1478 DPRINTF(IEW, "[tid:%i], Dispatch dispatched %i instructions.\n", 1479 tid, toRename->iewInfo[tid].dispatched); 1480 } 1481 1482 DPRINTF(IEW, "IQ has %i free entries (Can schedule: %i). " 1483 "LSQ has %i free entries.\n", 1484 instQueue.numFreeEntries(), instQueue.hasReadyInsts(), 1485 ldstQueue.numFreeEntries()); 1486 1487 updateStatus(); 1488 1489 if (wroteToTimeBuffer) { 1490 DPRINTF(Activity, "Activity this cycle.\n"); 1491 cpu->activityThisCycle(); 1492 } 1493} 1494 1495template <class Impl> 1496void 1497DefaultIEW<Impl>::updateExeInstStats(DynInstPtr &inst) 1498{ 1499 int thread_number = inst->threadNumber; 1500 1501 // 1502 // Pick off the software prefetches 1503 // 1504#ifdef TARGET_ALPHA 1505 if (inst->isDataPrefetch()) 1506 iewExecutedSwp[thread_number]++; 1507 else 1508 iewIewExecutedcutedInsts++; 1509#else 1510 iewExecutedInsts++; 1511#endif 1512 1513 // 1514 // Control operations 1515 // 1516 if (inst->isControl()) 1517 iewExecutedBranches[thread_number]++; 1518 1519 // 1520 // Memory operations 1521 // 1522 if (inst->isMemRef()) { 1523 iewExecutedRefs[thread_number]++; 1524 1525 if (inst->isLoad()) { 1526 iewExecLoadInsts[thread_number]++; 1527 } 1528 } 1529} 1530