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; --- 6 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 532 toCommit->includeSquashInst[tid] = false; 533 534 wroteToTimeBuffer = true; 535} 536 537template<class Impl> 538void 539DefaultIEW<Impl>::squashDueToMemBlocked(DynInstPtr &inst, unsigned tid) 540{ 541 DPRINTF(IEW, "[tid:%i]: Memory blocked, squashing load and younger insts, " 542 "PC: %#x [sn:%i].\n", tid, inst->readPC(), inst->seqNum); 543 544 toCommit->squash[tid] = true; 545 toCommit->squashedSeqNum[tid] = inst->seqNum; 546 toCommit->nextPC[tid] = inst->readPC(); |
547#if ISA_HAS_DELAY_SLOT 548 toCommit->nextNPC[tid] = inst->readNextNPC(); 549#endif |
550 551 // Must include the broadcasted SN in the squash. 552 toCommit->includeSquashInst[tid] = true; 553 554 ldstQueue.setLoadBlockedHandled(tid); 555 556 wroteToTimeBuffer = true; 557} --- 788 unchanged lines hidden (view full) --- 1346 unsigned tid = inst->threadNumber; 1347 1348 if (!fetchRedirect[tid]) { 1349 1350 if (inst->mispredicted()) { 1351 fetchRedirect[tid] = true; 1352 1353 DPRINTF(IEW, "Execute: Branch mispredict detected.\n"); |
1354 DPRINTF(IEW, "Predicted target was %#x.\n", inst->predPC); |
1355#if ISA_HAS_DELAY_SLOT 1356 DPRINTF(IEW, "Execute: Redirecting fetch to PC: %#x.\n", 1357 inst->nextNPC); 1358#else 1359 DPRINTF(IEW, "Execute: Redirecting fetch to PC: %#x.\n", 1360 inst->nextPC); 1361#endif 1362 // If incorrect, then signal the ROB that it must be squashed. 1363 squashDueToBranch(inst, tid); 1364 |
1365 if (inst->readPredTaken()) { |
1366 predictedTakenIncorrect++; 1367 } else { 1368 predictedNotTakenIncorrect++; 1369 } 1370 } else if (ldstQueue.violation(tid)) { 1371 fetchRedirect[tid] = true; 1372 1373 // If there was an ordering violation, then get the --- 248 unchanged lines hidden --- |