decode_impl.hh revision 13453:4a7a060ea26e
1/* 2 * Copyright (c) 2012, 2014 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated 11 * unmodified and in its entirety in all distributions of the software, 12 * modified or unmodified, in source code or in binary form. 13 * 14 * Copyright (c) 2004-2006 The Regents of The University of Michigan 15 * All rights reserved. 16 * 17 * Redistribution and use in source and binary forms, with or without 18 * modification, are permitted provided that the following conditions are 19 * met: redistributions of source code must retain the above copyright 20 * notice, this list of conditions and the following disclaimer; 21 * redistributions in binary form must reproduce the above copyright 22 * notice, this list of conditions and the following disclaimer in the 23 * documentation and/or other materials provided with the distribution; 24 * neither the name of the copyright holders nor the names of its 25 * contributors may be used to endorse or promote products derived from 26 * this software without specific prior written permission. 27 * 28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 * 40 * Authors: Kevin Lim 41 */ 42 43#ifndef __CPU_O3_DECODE_IMPL_HH__ 44#define __CPU_O3_DECODE_IMPL_HH__ 45 46#include "arch/types.hh" 47#include "base/trace.hh" 48#include "config/the_isa.hh" 49#include "cpu/o3/decode.hh" 50#include "cpu/inst_seq.hh" 51#include "debug/Activity.hh" 52#include "debug/Decode.hh" 53#include "debug/O3PipeView.hh" 54#include "params/DerivO3CPU.hh" 55#include "sim/full_system.hh" 56 57// clang complains about std::set being overloaded with Packet::set if 58// we open up the entire namespace std 59using std::list; 60 61template<class Impl> 62DefaultDecode<Impl>::DefaultDecode(O3CPU *_cpu, DerivO3CPUParams *params) 63 : cpu(_cpu), 64 renameToDecodeDelay(params->renameToDecodeDelay), 65 iewToDecodeDelay(params->iewToDecodeDelay), 66 commitToDecodeDelay(params->commitToDecodeDelay), 67 fetchToDecodeDelay(params->fetchToDecodeDelay), 68 decodeWidth(params->decodeWidth), 69 numThreads(params->numThreads) 70{ 71 if (decodeWidth > Impl::MaxWidth) 72 fatal("decodeWidth (%d) is larger than compiled limit (%d),\n" 73 "\tincrease MaxWidth in src/cpu/o3/impl.hh\n", 74 decodeWidth, static_cast<int>(Impl::MaxWidth)); 75 76 // @todo: Make into a parameter 77 skidBufferMax = (fetchToDecodeDelay + 1) * params->fetchWidth; 78 for (int tid = 0; tid < Impl::MaxThreads; tid++) { 79 stalls[tid] = {false}; 80 decodeStatus[tid] = Idle; 81 bdelayDoneSeqNum[tid] = 0; 82 squashInst[tid] = nullptr; 83 squashAfterDelaySlot[tid] = 0; 84 } 85} 86 87template<class Impl> 88void 89DefaultDecode<Impl>::startupStage() 90{ 91 resetStage(); 92} 93 94template<class Impl> 95void 96DefaultDecode<Impl>::resetStage() 97{ 98 _status = Inactive; 99 100 // Setup status, make sure stall signals are clear. 101 for (ThreadID tid = 0; tid < numThreads; ++tid) { 102 decodeStatus[tid] = Idle; 103 104 stalls[tid].rename = false; 105 } 106} 107 108template <class Impl> 109std::string 110DefaultDecode<Impl>::name() const 111{ 112 return cpu->name() + ".decode"; 113} 114 115template <class Impl> 116void 117DefaultDecode<Impl>::regStats() 118{ 119 decodeIdleCycles 120 .name(name() + ".IdleCycles") 121 .desc("Number of cycles decode is idle") 122 .prereq(decodeIdleCycles); 123 decodeBlockedCycles 124 .name(name() + ".BlockedCycles") 125 .desc("Number of cycles decode is blocked") 126 .prereq(decodeBlockedCycles); 127 decodeRunCycles 128 .name(name() + ".RunCycles") 129 .desc("Number of cycles decode is running") 130 .prereq(decodeRunCycles); 131 decodeUnblockCycles 132 .name(name() + ".UnblockCycles") 133 .desc("Number of cycles decode is unblocking") 134 .prereq(decodeUnblockCycles); 135 decodeSquashCycles 136 .name(name() + ".SquashCycles") 137 .desc("Number of cycles decode is squashing") 138 .prereq(decodeSquashCycles); 139 decodeBranchResolved 140 .name(name() + ".BranchResolved") 141 .desc("Number of times decode resolved a branch") 142 .prereq(decodeBranchResolved); 143 decodeBranchMispred 144 .name(name() + ".BranchMispred") 145 .desc("Number of times decode detected a branch misprediction") 146 .prereq(decodeBranchMispred); 147 decodeControlMispred 148 .name(name() + ".ControlMispred") 149 .desc("Number of times decode detected an instruction incorrectly" 150 " predicted as a control") 151 .prereq(decodeControlMispred); 152 decodeDecodedInsts 153 .name(name() + ".DecodedInsts") 154 .desc("Number of instructions handled by decode") 155 .prereq(decodeDecodedInsts); 156 decodeSquashedInsts 157 .name(name() + ".SquashedInsts") 158 .desc("Number of squashed instructions handled by decode") 159 .prereq(decodeSquashedInsts); 160} 161 162template<class Impl> 163void 164DefaultDecode<Impl>::setTimeBuffer(TimeBuffer<TimeStruct> *tb_ptr) 165{ 166 timeBuffer = tb_ptr; 167 168 // Setup wire to write information back to fetch. 169 toFetch = timeBuffer->getWire(0); 170 171 // Create wires to get information from proper places in time buffer. 172 fromRename = timeBuffer->getWire(-renameToDecodeDelay); 173 fromIEW = timeBuffer->getWire(-iewToDecodeDelay); 174 fromCommit = timeBuffer->getWire(-commitToDecodeDelay); 175} 176 177template<class Impl> 178void 179DefaultDecode<Impl>::setDecodeQueue(TimeBuffer<DecodeStruct> *dq_ptr) 180{ 181 decodeQueue = dq_ptr; 182 183 // Setup wire to write information to proper place in decode queue. 184 toRename = decodeQueue->getWire(0); 185} 186 187template<class Impl> 188void 189DefaultDecode<Impl>::setFetchQueue(TimeBuffer<FetchStruct> *fq_ptr) 190{ 191 fetchQueue = fq_ptr; 192 193 // Setup wire to read information from fetch queue. 194 fromFetch = fetchQueue->getWire(-fetchToDecodeDelay); 195} 196 197template<class Impl> 198void 199DefaultDecode<Impl>::setActiveThreads(std::list<ThreadID> *at_ptr) 200{ 201 activeThreads = at_ptr; 202} 203 204template <class Impl> 205void 206DefaultDecode<Impl>::drainSanityCheck() const 207{ 208 for (ThreadID tid = 0; tid < numThreads; ++tid) { 209 assert(insts[tid].empty()); 210 assert(skidBuffer[tid].empty()); 211 } 212} 213 214template <class Impl> 215bool 216DefaultDecode<Impl>::isDrained() const 217{ 218 for (ThreadID tid = 0; tid < numThreads; ++tid) { 219 if (!insts[tid].empty() || !skidBuffer[tid].empty() || 220 (decodeStatus[tid] != Running && decodeStatus[tid] != Idle)) 221 return false; 222 } 223 return true; 224} 225 226template<class Impl> 227bool 228DefaultDecode<Impl>::checkStall(ThreadID tid) const 229{ 230 bool ret_val = false; 231 232 if (stalls[tid].rename) { 233 DPRINTF(Decode,"[tid:%i]: Stall fom Rename stage detected.\n", tid); 234 ret_val = true; 235 } 236 237 return ret_val; 238} 239 240template<class Impl> 241inline bool 242DefaultDecode<Impl>::fetchInstsValid() 243{ 244 return fromFetch->size > 0; 245} 246 247template<class Impl> 248bool 249DefaultDecode<Impl>::block(ThreadID tid) 250{ 251 DPRINTF(Decode, "[tid:%u]: Blocking.\n", tid); 252 253 // Add the current inputs to the skid buffer so they can be 254 // reprocessed when this stage unblocks. 255 skidInsert(tid); 256 257 // If the decode status is blocked or unblocking then decode has not yet 258 // signalled fetch to unblock. In that case, there is no need to tell 259 // fetch to block. 260 if (decodeStatus[tid] != Blocked) { 261 // Set the status to Blocked. 262 decodeStatus[tid] = Blocked; 263 264 if (toFetch->decodeUnblock[tid]) { 265 toFetch->decodeUnblock[tid] = false; 266 } else { 267 toFetch->decodeBlock[tid] = true; 268 wroteToTimeBuffer = true; 269 } 270 271 return true; 272 } 273 274 return false; 275} 276 277template<class Impl> 278bool 279DefaultDecode<Impl>::unblock(ThreadID tid) 280{ 281 // Decode is done unblocking only if the skid buffer is empty. 282 if (skidBuffer[tid].empty()) { 283 DPRINTF(Decode, "[tid:%u]: Done unblocking.\n", tid); 284 toFetch->decodeUnblock[tid] = true; 285 wroteToTimeBuffer = true; 286 287 decodeStatus[tid] = Running; 288 return true; 289 } 290 291 DPRINTF(Decode, "[tid:%u]: Currently unblocking.\n", tid); 292 293 return false; 294} 295 296template<class Impl> 297void 298DefaultDecode<Impl>::squash(const DynInstPtr &inst, ThreadID tid) 299{ 300 DPRINTF(Decode, "[tid:%i]: [sn:%i] Squashing due to incorrect branch " 301 "prediction detected at decode.\n", tid, inst->seqNum); 302 303 // Send back mispredict information. 304 toFetch->decodeInfo[tid].branchMispredict = true; 305 toFetch->decodeInfo[tid].predIncorrect = true; 306 toFetch->decodeInfo[tid].mispredictInst = inst; 307 toFetch->decodeInfo[tid].squash = true; 308 toFetch->decodeInfo[tid].doneSeqNum = inst->seqNum; 309 toFetch->decodeInfo[tid].nextPC = inst->branchTarget(); 310 toFetch->decodeInfo[tid].branchTaken = inst->pcState().branching(); 311 toFetch->decodeInfo[tid].squashInst = inst; 312 if (toFetch->decodeInfo[tid].mispredictInst->isUncondCtrl()) { 313 toFetch->decodeInfo[tid].branchTaken = true; 314 } 315 316 InstSeqNum squash_seq_num = inst->seqNum; 317 318 // Might have to tell fetch to unblock. 319 if (decodeStatus[tid] == Blocked || 320 decodeStatus[tid] == Unblocking) { 321 toFetch->decodeUnblock[tid] = 1; 322 } 323 324 // Set status to squashing. 325 decodeStatus[tid] = Squashing; 326 327 for (int i=0; i<fromFetch->size; i++) { 328 if (fromFetch->insts[i]->threadNumber == tid && 329 fromFetch->insts[i]->seqNum > squash_seq_num) { 330 fromFetch->insts[i]->setSquashed(); 331 } 332 } 333 334 // Clear the instruction list and skid buffer in case they have any 335 // insts in them. 336 while (!insts[tid].empty()) { 337 insts[tid].pop(); 338 } 339 340 while (!skidBuffer[tid].empty()) { 341 skidBuffer[tid].pop(); 342 } 343 344 // Squash instructions up until this one 345 cpu->removeInstsUntil(squash_seq_num, tid); 346} 347 348template<class Impl> 349unsigned 350DefaultDecode<Impl>::squash(ThreadID tid) 351{ 352 DPRINTF(Decode, "[tid:%i]: Squashing.\n",tid); 353 354 if (decodeStatus[tid] == Blocked || 355 decodeStatus[tid] == Unblocking) { 356 if (FullSystem) { 357 toFetch->decodeUnblock[tid] = 1; 358 } else { 359 // In syscall emulation, we can have both a block and a squash due 360 // to a syscall in the same cycle. This would cause both signals 361 // to be high. This shouldn't happen in full system. 362 // @todo: Determine if this still happens. 363 if (toFetch->decodeBlock[tid]) 364 toFetch->decodeBlock[tid] = 0; 365 else 366 toFetch->decodeUnblock[tid] = 1; 367 } 368 } 369 370 // Set status to squashing. 371 decodeStatus[tid] = Squashing; 372 373 // Go through incoming instructions from fetch and squash them. 374 unsigned squash_count = 0; 375 376 for (int i=0; i<fromFetch->size; i++) { 377 if (fromFetch->insts[i]->threadNumber == tid) { 378 fromFetch->insts[i]->setSquashed(); 379 squash_count++; 380 } 381 } 382 383 // Clear the instruction list and skid buffer in case they have any 384 // insts in them. 385 while (!insts[tid].empty()) { 386 insts[tid].pop(); 387 } 388 389 while (!skidBuffer[tid].empty()) { 390 skidBuffer[tid].pop(); 391 } 392 393 return squash_count; 394} 395 396template<class Impl> 397void 398DefaultDecode<Impl>::skidInsert(ThreadID tid) 399{ 400 DynInstPtr inst = NULL; 401 402 while (!insts[tid].empty()) { 403 inst = insts[tid].front(); 404 405 insts[tid].pop(); 406 407 assert(tid == inst->threadNumber); 408 409 skidBuffer[tid].push(inst); 410 411 DPRINTF(Decode,"Inserting [tid:%d][sn:%lli] PC: %s into decode skidBuffer %i\n", 412 inst->threadNumber, inst->seqNum, inst->pcState(), skidBuffer[tid].size()); 413 } 414 415 // @todo: Eventually need to enforce this by not letting a thread 416 // fetch past its skidbuffer 417 assert(skidBuffer[tid].size() <= skidBufferMax); 418} 419 420template<class Impl> 421bool 422DefaultDecode<Impl>::skidsEmpty() 423{ 424 list<ThreadID>::iterator threads = activeThreads->begin(); 425 list<ThreadID>::iterator end = activeThreads->end(); 426 427 while (threads != end) { 428 ThreadID tid = *threads++; 429 if (!skidBuffer[tid].empty()) 430 return false; 431 } 432 433 return true; 434} 435 436template<class Impl> 437void 438DefaultDecode<Impl>::updateStatus() 439{ 440 bool any_unblocking = false; 441 442 list<ThreadID>::iterator threads = activeThreads->begin(); 443 list<ThreadID>::iterator end = activeThreads->end(); 444 445 while (threads != end) { 446 ThreadID tid = *threads++; 447 448 if (decodeStatus[tid] == Unblocking) { 449 any_unblocking = true; 450 break; 451 } 452 } 453 454 // Decode will have activity if it's unblocking. 455 if (any_unblocking) { 456 if (_status == Inactive) { 457 _status = Active; 458 459 DPRINTF(Activity, "Activating stage.\n"); 460 461 cpu->activateStage(O3CPU::DecodeIdx); 462 } 463 } else { 464 // If it's not unblocking, then decode will not have any internal 465 // activity. Switch it to inactive. 466 if (_status == Active) { 467 _status = Inactive; 468 DPRINTF(Activity, "Deactivating stage.\n"); 469 470 cpu->deactivateStage(O3CPU::DecodeIdx); 471 } 472 } 473} 474 475template <class Impl> 476void 477DefaultDecode<Impl>::sortInsts() 478{ 479 int insts_from_fetch = fromFetch->size; 480 for (int i = 0; i < insts_from_fetch; ++i) { 481 insts[fromFetch->insts[i]->threadNumber].push(fromFetch->insts[i]); 482 } 483} 484 485template<class Impl> 486void 487DefaultDecode<Impl>::readStallSignals(ThreadID tid) 488{ 489 if (fromRename->renameBlock[tid]) { 490 stalls[tid].rename = true; 491 } 492 493 if (fromRename->renameUnblock[tid]) { 494 assert(stalls[tid].rename); 495 stalls[tid].rename = false; 496 } 497} 498 499template <class Impl> 500bool 501DefaultDecode<Impl>::checkSignalsAndUpdate(ThreadID tid) 502{ 503 // Check if there's a squash signal, squash if there is. 504 // Check stall signals, block if necessary. 505 // If status was blocked 506 // Check if stall conditions have passed 507 // if so then go to unblocking 508 // If status was Squashing 509 // check if squashing is not high. Switch to running this cycle. 510 511 // Update the per thread stall statuses. 512 readStallSignals(tid); 513 514 // Check squash signals from commit. 515 if (fromCommit->commitInfo[tid].squash) { 516 517 DPRINTF(Decode, "[tid:%u]: Squashing instructions due to squash " 518 "from commit.\n", tid); 519 520 squash(tid); 521 522 return true; 523 } 524 525 if (checkStall(tid)) { 526 return block(tid); 527 } 528 529 if (decodeStatus[tid] == Blocked) { 530 DPRINTF(Decode, "[tid:%u]: Done blocking, switching to unblocking.\n", 531 tid); 532 533 decodeStatus[tid] = Unblocking; 534 535 unblock(tid); 536 537 return true; 538 } 539 540 if (decodeStatus[tid] == Squashing) { 541 // Switch status to running if decode isn't being told to block or 542 // squash this cycle. 543 DPRINTF(Decode, "[tid:%u]: Done squashing, switching to running.\n", 544 tid); 545 546 decodeStatus[tid] = Running; 547 548 return false; 549 } 550 551 // If we've reached this point, we have not gotten any signals that 552 // cause decode to change its status. Decode remains the same as before. 553 return false; 554} 555 556template<class Impl> 557void 558DefaultDecode<Impl>::tick() 559{ 560 wroteToTimeBuffer = false; 561 562 bool status_change = false; 563 564 toRenameIndex = 0; 565 566 list<ThreadID>::iterator threads = activeThreads->begin(); 567 list<ThreadID>::iterator end = activeThreads->end(); 568 569 sortInsts(); 570 571 //Check stall and squash signals. 572 while (threads != end) { 573 ThreadID tid = *threads++; 574 575 DPRINTF(Decode,"Processing [tid:%i]\n",tid); 576 status_change = checkSignalsAndUpdate(tid) || status_change; 577 578 decode(status_change, tid); 579 } 580 581 if (status_change) { 582 updateStatus(); 583 } 584 585 if (wroteToTimeBuffer) { 586 DPRINTF(Activity, "Activity this cycle.\n"); 587 588 cpu->activityThisCycle(); 589 } 590} 591 592template<class Impl> 593void 594DefaultDecode<Impl>::decode(bool &status_change, ThreadID tid) 595{ 596 // If status is Running or idle, 597 // call decodeInsts() 598 // If status is Unblocking, 599 // buffer any instructions coming from fetch 600 // continue trying to empty skid buffer 601 // check if stall conditions have passed 602 603 if (decodeStatus[tid] == Blocked) { 604 ++decodeBlockedCycles; 605 } else if (decodeStatus[tid] == Squashing) { 606 ++decodeSquashCycles; 607 } 608 609 // Decode should try to decode as many instructions as its bandwidth 610 // will allow, as long as it is not currently blocked. 611 if (decodeStatus[tid] == Running || 612 decodeStatus[tid] == Idle) { 613 DPRINTF(Decode, "[tid:%u]: Not blocked, so attempting to run " 614 "stage.\n",tid); 615 616 decodeInsts(tid); 617 } else if (decodeStatus[tid] == Unblocking) { 618 // Make sure that the skid buffer has something in it if the 619 // status is unblocking. 620 assert(!skidsEmpty()); 621 622 // If the status was unblocking, then instructions from the skid 623 // buffer were used. Remove those instructions and handle 624 // the rest of unblocking. 625 decodeInsts(tid); 626 627 if (fetchInstsValid()) { 628 // Add the current inputs to the skid buffer so they can be 629 // reprocessed when this stage unblocks. 630 skidInsert(tid); 631 } 632 633 status_change = unblock(tid) || status_change; 634 } 635} 636 637template <class Impl> 638void 639DefaultDecode<Impl>::decodeInsts(ThreadID tid) 640{ 641 // Instructions can come either from the skid buffer or the list of 642 // instructions coming from fetch, depending on decode's status. 643 int insts_available = decodeStatus[tid] == Unblocking ? 644 skidBuffer[tid].size() : insts[tid].size(); 645 646 if (insts_available == 0) { 647 DPRINTF(Decode, "[tid:%u] Nothing to do, breaking out" 648 " early.\n",tid); 649 // Should I change the status to idle? 650 ++decodeIdleCycles; 651 return; 652 } else if (decodeStatus[tid] == Unblocking) { 653 DPRINTF(Decode, "[tid:%u] Unblocking, removing insts from skid " 654 "buffer.\n",tid); 655 ++decodeUnblockCycles; 656 } else if (decodeStatus[tid] == Running) { 657 ++decodeRunCycles; 658 } 659 660 std::queue<DynInstPtr> 661 &insts_to_decode = decodeStatus[tid] == Unblocking ? 662 skidBuffer[tid] : insts[tid]; 663 664 DPRINTF(Decode, "[tid:%u]: Sending instruction to rename.\n",tid); 665 666 while (insts_available > 0 && toRenameIndex < decodeWidth) { 667 assert(!insts_to_decode.empty()); 668 669 DynInstPtr inst = std::move(insts_to_decode.front()); 670 671 insts_to_decode.pop(); 672 673 DPRINTF(Decode, "[tid:%u]: Processing instruction [sn:%lli] with " 674 "PC %s\n", tid, inst->seqNum, inst->pcState()); 675 676 if (inst->isSquashed()) { 677 DPRINTF(Decode, "[tid:%u]: Instruction %i with PC %s is " 678 "squashed, skipping.\n", 679 tid, inst->seqNum, inst->pcState()); 680 681 ++decodeSquashedInsts; 682 683 --insts_available; 684 685 continue; 686 } 687 688 // Also check if instructions have no source registers. Mark 689 // them as ready to issue at any time. Not sure if this check 690 // should exist here or at a later stage; however it doesn't matter 691 // too much for function correctness. 692 if (inst->numSrcRegs() == 0) { 693 inst->setCanIssue(); 694 } 695 696 // This current instruction is valid, so add it into the decode 697 // queue. The next instruction may not be valid, so check to 698 // see if branches were predicted correctly. 699 toRename->insts[toRenameIndex] = inst; 700 701 ++(toRename->size); 702 ++toRenameIndex; 703 ++decodeDecodedInsts; 704 --insts_available; 705 706#if TRACING_ON 707 if (DTRACE(O3PipeView)) { 708 inst->decodeTick = curTick() - inst->fetchTick; 709 } 710#endif 711 712 // Ensure that if it was predicted as a branch, it really is a 713 // branch. 714 if (inst->readPredTaken() && !inst->isControl()) { 715 panic("Instruction predicted as a branch!"); 716 717 ++decodeControlMispred; 718 719 // Might want to set some sort of boolean and just do 720 // a check at the end 721 squash(inst, inst->threadNumber); 722 723 break; 724 } 725 726 // Go ahead and compute any PC-relative branches. 727 // This includes direct unconditional control and 728 // direct conditional control that is predicted taken. 729 if (inst->isDirectCtrl() && 730 (inst->isUncondCtrl() || inst->readPredTaken())) 731 { 732 ++decodeBranchResolved; 733 734 if (!(inst->branchTarget() == inst->readPredTarg())) { 735 ++decodeBranchMispred; 736 737 // Might want to set some sort of boolean and just do 738 // a check at the end 739 squash(inst, inst->threadNumber); 740 TheISA::PCState target = inst->branchTarget(); 741 742 DPRINTF(Decode, "[sn:%i]: Updating predictions: PredPC: %s\n", 743 inst->seqNum, target); 744 //The micro pc after an instruction level branch should be 0 745 inst->setPredTarg(target); 746 break; 747 } 748 } 749 } 750 751 // If we didn't process all instructions, then we will need to block 752 // and put all those instructions into the skid buffer. 753 if (!insts_to_decode.empty()) { 754 block(tid); 755 } 756 757 // Record that decode has written to the time buffer for activity 758 // tracking. 759 if (toRenameIndex) { 760 wroteToTimeBuffer = true; 761 } 762} 763 764#endif//__CPU_O3_DECODE_IMPL_HH__ 765