O3: Fix corner cases where multiple squashes/fetch redirects overwrite timebuf.

This commit is contained in:
Matt Horsnell 2011-01-18 16:30:05 -06:00
parent 62f2097917
commit 11bef2ab38
2 changed files with 42 additions and 31 deletions

View file

@ -452,20 +452,24 @@ DefaultIEW<Impl>::squashDueToBranch(DynInstPtr &inst, ThreadID tid)
DPRINTF(IEW, "[tid:%i]: Squashing from a specific instruction, PC: %s " DPRINTF(IEW, "[tid:%i]: Squashing from a specific instruction, PC: %s "
"[sn:%i].\n", tid, inst->pcState(), inst->seqNum); "[sn:%i].\n", tid, inst->pcState(), inst->seqNum);
toCommit->squash[tid] = true; if (toCommit->squash[tid] == false ||
toCommit->squashedSeqNum[tid] = inst->seqNum; inst->seqNum < toCommit->squashedSeqNum[tid]) {
toCommit->mispredPC[tid] = inst->instAddr(); toCommit->squash[tid] = true;
toCommit->branchMispredict[tid] = true; toCommit->squashedSeqNum[tid] = inst->seqNum;
toCommit->mispredictInst[tid] = inst; toCommit->mispredPC[tid] = inst->instAddr();
toCommit->branchMispredict[tid] = true;
toCommit->branchTaken[tid] = inst->pcState().branching();
toCommit->branchTaken[tid] = inst->pcState().branching(); TheISA::PCState pc = inst->pcState();
TheISA::PCState pc = inst->pcState(); TheISA::advancePC(pc, inst->staticInst);
TheISA::advancePC(pc, inst->staticInst);
toCommit->pc[tid] = pc;
toCommit->includeSquashInst[tid] = false; toCommit->pc[tid] = pc;
toCommit->mispredictInst[tid] = inst;
toCommit->includeSquashInst[tid] = false;
wroteToTimeBuffer = true;
}
wroteToTimeBuffer = true;
} }
template<class Impl> template<class Impl>
@ -475,16 +479,19 @@ DefaultIEW<Impl>::squashDueToMemOrder(DynInstPtr &inst, ThreadID tid)
DPRINTF(IEW, "[tid:%i]: Squashing from a specific instruction, " DPRINTF(IEW, "[tid:%i]: Squashing from a specific instruction, "
"PC: %s [sn:%i].\n", tid, inst->pcState(), inst->seqNum); "PC: %s [sn:%i].\n", tid, inst->pcState(), inst->seqNum);
toCommit->squash[tid] = true; if (toCommit->squash[tid] == false ||
toCommit->squashedSeqNum[tid] = inst->seqNum; inst->seqNum < toCommit->squashedSeqNum[tid]) {
TheISA::PCState pc = inst->pcState(); toCommit->squash[tid] = true;
TheISA::advancePC(pc, inst->staticInst); toCommit->squashedSeqNum[tid] = inst->seqNum;
toCommit->pc[tid] = pc; TheISA::PCState pc = inst->pcState();
toCommit->branchMispredict[tid] = false; TheISA::advancePC(pc, inst->staticInst);
toCommit->pc[tid] = pc;
toCommit->branchMispredict[tid] = false;
toCommit->includeSquashInst[tid] = false; toCommit->includeSquashInst[tid] = false;
wroteToTimeBuffer = true; wroteToTimeBuffer = true;
}
} }
template<class Impl> template<class Impl>
@ -493,18 +500,21 @@ DefaultIEW<Impl>::squashDueToMemBlocked(DynInstPtr &inst, ThreadID tid)
{ {
DPRINTF(IEW, "[tid:%i]: Memory blocked, squashing load and younger insts, " DPRINTF(IEW, "[tid:%i]: Memory blocked, squashing load and younger insts, "
"PC: %s [sn:%i].\n", tid, inst->pcState(), inst->seqNum); "PC: %s [sn:%i].\n", tid, inst->pcState(), inst->seqNum);
if (toCommit->squash[tid] == false ||
inst->seqNum < toCommit->squashedSeqNum[tid]) {
toCommit->squash[tid] = true;
toCommit->squash[tid] = true; toCommit->squashedSeqNum[tid] = inst->seqNum;
toCommit->squashedSeqNum[tid] = inst->seqNum; toCommit->pc[tid] = inst->pcState();
toCommit->pc[tid] = inst->pcState(); toCommit->branchMispredict[tid] = false;
toCommit->branchMispredict[tid] = false;
// Must include the broadcasted SN in the squash. // Must include the broadcasted SN in the squash.
toCommit->includeSquashInst[tid] = true; toCommit->includeSquashInst[tid] = true;
ldstQueue.setLoadBlockedHandled(tid); ldstQueue.setLoadBlockedHandled(tid);
wroteToTimeBuffer = true; wroteToTimeBuffer = true;
}
} }
template<class Impl> template<class Impl>
@ -788,7 +798,6 @@ DefaultIEW<Impl>::checkSignalsAndUpdate(ThreadID tid)
} }
dispatchStatus[tid] = Squashing; dispatchStatus[tid] = Squashing;
fetchRedirect[tid] = false; fetchRedirect[tid] = false;
return; return;
} }
@ -797,7 +806,6 @@ DefaultIEW<Impl>::checkSignalsAndUpdate(ThreadID tid)
DPRINTF(IEW, "[tid:%i]: ROB is still squashing.\n", tid); DPRINTF(IEW, "[tid:%i]: ROB is still squashing.\n", tid);
dispatchStatus[tid] = Squashing; dispatchStatus[tid] = Squashing;
emptyRenameInsts(tid); emptyRenameInsts(tid);
wroteToTimeBuffer = true; wroteToTimeBuffer = true;
return; return;
@ -1286,6 +1294,7 @@ DefaultIEW<Impl>::executeInsts()
ThreadID tid = inst->threadNumber; ThreadID tid = inst->threadNumber;
if (!fetchRedirect[tid] || if (!fetchRedirect[tid] ||
!toCommit->squash[tid] ||
toCommit->squashedSeqNum[tid] > inst->seqNum) { toCommit->squashedSeqNum[tid] > inst->seqNum) {
if (inst->mispredicted()) { if (inst->mispredicted()) {
@ -1382,6 +1391,7 @@ DefaultIEW<Impl>::executeInsts()
// iew queue. That way the writeback event will write into the correct // iew queue. That way the writeback event will write into the correct
// spot in the queue. // spot in the queue.
wbNumInst = 0; wbNumInst = 0;
} }
template <class Impl> template <class Impl>
@ -1596,6 +1606,7 @@ DefaultIEW<Impl>::checkMisprediction(DynInstPtr &inst)
ThreadID tid = inst->threadNumber; ThreadID tid = inst->threadNumber;
if (!fetchRedirect[tid] || if (!fetchRedirect[tid] ||
!toCommit->squash[tid] ||
toCommit->squashedSeqNum[tid] > inst->seqNum) { toCommit->squashedSeqNum[tid] > inst->seqNum) {
if (inst->mispredicted()) { if (inst->mispredicted()) {

View file

@ -90,8 +90,8 @@ LSQUnit<Impl>::completeDataAccess(PacketPtr pkt)
{ {
LSQSenderState *state = dynamic_cast<LSQSenderState *>(pkt->senderState); LSQSenderState *state = dynamic_cast<LSQSenderState *>(pkt->senderState);
DynInstPtr inst = state->inst; DynInstPtr inst = state->inst;
DPRINTF(IEW, "Writeback event [sn:%lli]\n", inst->seqNum); DPRINTF(IEW, "Writeback event [sn:%lli].\n", inst->seqNum);
DPRINTF(Activity, "Activity: Writeback event [sn:%lli]\n", inst->seqNum); DPRINTF(Activity, "Activity: Writeback event [sn:%lli].\n", inst->seqNum);
//iewStage->ldstQueue.removeMSHR(inst->threadNumber,inst->seqNum); //iewStage->ldstQueue.removeMSHR(inst->threadNumber,inst->seqNum);