diff options
author | Nilay Vaish ext:(%2C%20Timothy%20Jones%20%3Ctimothy.jones%40cl.cam.ac.uk%3E) <nilay@cs.wisc.edu> | 2013-01-24 12:28:51 -0600 |
---|---|---|
committer | Nilay Vaish ext:(%2C%20Timothy%20Jones%20%3Ctimothy.jones%40cl.cam.ac.uk%3E) <nilay@cs.wisc.edu> | 2013-01-24 12:28:51 -0600 |
commit | dbeabedaf0f8d9ec0ea3331db2e44b1add53f79f (patch) | |
tree | 568d3b6007adf1a8d3ba6568fc5635e56afd3d53 /src/cpu/o3/fetch_impl.hh | |
parent | 11d5ffa108983d5d9742f0aad23f80c691f285ee (diff) | |
download | gem5-dbeabedaf0f8d9ec0ea3331db2e44b1add53f79f.tar.xz |
branch predictor: move out of o3 and inorder cpus
This patch moves the branch predictor files in the o3 and inorder directories
to src/cpu/pred. This allows sharing the branch predictor across different
cpu models.
This patch was originally posted by Timothy Jones in July 2010
but never made it to the repository.
--HG--
rename : src/cpu/o3/bpred_unit.cc => src/cpu/pred/bpred_unit.cc
rename : src/cpu/o3/bpred_unit.hh => src/cpu/pred/bpred_unit.hh
rename : src/cpu/o3/bpred_unit_impl.hh => src/cpu/pred/bpred_unit_impl.hh
rename : src/cpu/o3/sat_counter.hh => src/cpu/pred/sat_counter.hh
Diffstat (limited to 'src/cpu/o3/fetch_impl.hh')
-rw-r--r-- | src/cpu/o3/fetch_impl.hh | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/cpu/o3/fetch_impl.hh b/src/cpu/o3/fetch_impl.hh index f531203d9..07033fc8a 100644 --- a/src/cpu/o3/fetch_impl.hh +++ b/src/cpu/o3/fetch_impl.hh @@ -73,7 +73,6 @@ using namespace std; template<class Impl> DefaultFetch<Impl>::DefaultFetch(O3CPU *_cpu, DerivO3CPUParams *params) : cpu(_cpu), - branchPred(params), decodeToFetchDelay(params->decodeToFetchDelay), renameToFetchDelay(params->renameToFetchDelay), iewToFetchDelay(params->iewToFetchDelay), @@ -129,6 +128,8 @@ DefaultFetch<Impl>::DefaultFetch(O3CPU *_cpu, DerivO3CPUParams *params) cacheData[i] = NULL; decoder[i] = new TheISA::Decoder; } + + branchPred = params->branchPred; } template <class Impl> @@ -259,8 +260,6 @@ DefaultFetch<Impl>::regStats() .desc("Number of inst fetches per cycle") .flags(Stats::total); fetchRate = fetchedInsts / cpu->numCycles; - - branchPred.regStats(); } template<class Impl> @@ -437,7 +436,7 @@ DefaultFetch<Impl>::drainSanityCheck() const assert(fetchStatus[i] == Idle || stalls[i].drain); } - branchPred.drainSanityCheck(); + branchPred->drainSanityCheck(); } template <class Impl> @@ -470,7 +469,6 @@ DefaultFetch<Impl>::takeOverFrom() assert(cpu->getInstPort().isConnected()); resetStage(); - branchPred.takeOverFrom(); } template <class Impl> @@ -537,7 +535,8 @@ DefaultFetch<Impl>::lookupAndUpdateNextPC( } ThreadID tid = inst->threadNumber; - predict_taken = branchPred.predict(inst, nextPC, tid); + predict_taken = branchPred->predict(inst->staticInst, inst->seqNum, + nextPC, tid); if (predict_taken) { DPRINTF(Fetch, "[tid:%i]: [sn:%i]: Branch predicted to be taken to %s.\n", @@ -990,12 +989,12 @@ DefaultFetch<Impl>::checkSignalsAndUpdate(ThreadID tid) // invalid state we generated in after sequence number if (fromCommit->commitInfo[tid].mispredictInst && fromCommit->commitInfo[tid].mispredictInst->isControl()) { - branchPred.squash(fromCommit->commitInfo[tid].doneSeqNum, + branchPred->squash(fromCommit->commitInfo[tid].doneSeqNum, fromCommit->commitInfo[tid].pc, fromCommit->commitInfo[tid].branchTaken, tid); } else { - branchPred.squash(fromCommit->commitInfo[tid].doneSeqNum, + branchPred->squash(fromCommit->commitInfo[tid].doneSeqNum, tid); } @@ -1003,7 +1002,7 @@ DefaultFetch<Impl>::checkSignalsAndUpdate(ThreadID tid) } else if (fromCommit->commitInfo[tid].doneSeqNum) { // Update the branch predictor if it wasn't a squashed instruction // that was broadcasted. - branchPred.update(fromCommit->commitInfo[tid].doneSeqNum, tid); + branchPred->update(fromCommit->commitInfo[tid].doneSeqNum, tid); } // Check ROB squash signals from commit. @@ -1023,12 +1022,12 @@ DefaultFetch<Impl>::checkSignalsAndUpdate(ThreadID tid) // Update the branch predictor. if (fromDecode->decodeInfo[tid].branchMispredict) { - branchPred.squash(fromDecode->decodeInfo[tid].doneSeqNum, + branchPred->squash(fromDecode->decodeInfo[tid].doneSeqNum, fromDecode->decodeInfo[tid].nextPC, fromDecode->decodeInfo[tid].branchTaken, tid); } else { - branchPred.squash(fromDecode->decodeInfo[tid].doneSeqNum, + branchPred->squash(fromDecode->decodeInfo[tid].doneSeqNum, tid); } |