Deleted Added
sdiff udiff text old ( 3958:58d09260d073 ) new ( 3969:77957f66c1d5 )
full compact
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;

--- 466 unchanged lines hidden (view full) ---

475 DPRINTF(IEW, "[tid:%i]: Squashing from a specific instruction, PC: %#x "
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;

--- 4 unchanged lines hidden (view full) ---

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
515 wroteToTimeBuffer = true;
516}
517
518template<class Impl>
519void
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

--- 4 unchanged lines hidden (view full) ---

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->readNextPC();
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

--- 792 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 }

--- 258 unchanged lines hidden ---