summaryrefslogtreecommitdiff
path: root/src/cpu/o3/decode_impl.hh
diff options
context:
space:
mode:
authorKorey Sewell <ksewell@umich.edu>2009-04-18 10:42:29 -0400
committerKorey Sewell <ksewell@umich.edu>2009-04-18 10:42:29 -0400
commit5c1742b822c1f4d640d30963a908386caf8c4a6e (patch)
tree9c4ac07248378ef4b12799d19ddc65e18d9a6f5a /src/cpu/o3/decode_impl.hh
parentcc9e834e931ff70b683b8a7010269d32c0de20fd (diff)
downloadgem5-5c1742b822c1f4d640d30963a908386caf8c4a6e.tar.xz
o3-delay-slot-bpred: fix decode stage handling of uncdtl. branches.\n decode stage was not setting the predicted PC correctly or passing that information back to fetch correctly
Diffstat (limited to 'src/cpu/o3/decode_impl.hh')
-rw-r--r--src/cpu/o3/decode_impl.hh29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/cpu/o3/decode_impl.hh b/src/cpu/o3/decode_impl.hh
index 015bc8d7f..d92e97f61 100644
--- a/src/cpu/o3/decode_impl.hh
+++ b/src/cpu/o3/decode_impl.hh
@@ -262,28 +262,30 @@ template<class Impl>
void
DefaultDecode<Impl>::squash(DynInstPtr &inst, unsigned tid)
{
- DPRINTF(Decode, "[tid:%i]: Squashing due to incorrect branch prediction "
- "detected at decode.\n", tid);
+ DPRINTF(Decode, "[tid:%i]: [sn:%i] Squashing due to incorrect branch prediction "
+ "detected at decode.\n", tid, inst->seqNum);
// Send back mispredict information.
toFetch->decodeInfo[tid].branchMispredict = true;
toFetch->decodeInfo[tid].predIncorrect = true;
- toFetch->decodeInfo[tid].doneSeqNum = inst->seqNum;
toFetch->decodeInfo[tid].squash = true;
- toFetch->decodeInfo[tid].nextPC = inst->branchTarget();
- ///FIXME There needs to be a way to set the nextPC and nextNPC
- ///explicitly for ISAs with delay slots.
- toFetch->decodeInfo[tid].nextNPC =
- inst->branchTarget() + sizeof(TheISA::MachInst);
+ toFetch->decodeInfo[tid].doneSeqNum = inst->seqNum;
toFetch->decodeInfo[tid].nextMicroPC = inst->readMicroPC();
+
#if ISA_HAS_DELAY_SLOT
+ toFetch->decodeInfo[tid].nextPC = inst->readPC() + sizeof(TheISA::MachInst);
+ toFetch->decodeInfo[tid].nextNPC = inst->branchTarget();
toFetch->decodeInfo[tid].branchTaken = inst->readNextNPC() !=
(inst->readNextPC() + sizeof(TheISA::MachInst));
#else
+ toFetch->decodeInfo[tid].nextPC = inst->branchTarget();
+ toFetch->decodeInfo[tid].nextNPC =
+ inst->branchTarget() + sizeof(TheISA::MachInst);
toFetch->decodeInfo[tid].branchTaken =
inst->readNextPC() != (inst->readPC() + sizeof(TheISA::MachInst));
#endif
+
InstSeqNum squash_seq_num = inst->seqNum;
// Might have to tell fetch to unblock.
@@ -738,8 +740,19 @@ DefaultDecode<Impl>::decodeInsts(unsigned tid)
// a check at the end
squash(inst, inst->threadNumber);
Addr target = inst->branchTarget();
+
+#if ISA_HAS_DELAY_SLOT
+ DPRINTF(Decode, "[sn:%i]: Updating predictions: PredPC: %#x PredNextPC: %#x\n",
+ inst->seqNum, inst->readPC() + sizeof(TheISA::MachInst), target);
+
+ //The micro pc after an instruction level branch should be 0
+ inst->setPredTarg(inst->readPC() + sizeof(TheISA::MachInst), target, 0);
+#else
+ DPRINTF(Decode, "[sn:%i]: Updating predictions: PredPC: %#x PredNextPC: %#x\n",
+ inst->seqNum, target, target + sizeof(TheISA::MachInst));
//The micro pc after an instruction level branch should be 0
inst->setPredTarg(target, target + sizeof(TheISA::MachInst), 0);
+#endif
break;
}
}