42 globalHistoryReg(params->numThreads, 0),
43 globalHistoryBits(
ceilLog2(params->globalPredictorSize)),
44 choicePredictorSize(params->choicePredictorSize),
45 choiceCtrBits(params->choiceCtrBits),
46 globalPredictorSize(params->globalPredictorSize),
47 globalCtrBits(params->globalCtrBits)
50 fatal(
"Invalid choice predictor size.\n");
52 fatal(
"Invalid global history predictor size.\n");
89 bpHistory =
static_cast<void*
>(history);
114 unsigned choiceHistoryIdx = ((branchAddr >>
instShiftAmt)
116 unsigned globalHistoryIdx = (((branchAddr >>
instShiftAmt)
125 bool takenGHBPrediction =
takenCounters[globalHistoryIdx].read()
129 bool finalPrediction;
137 if (choicePrediction) {
138 finalPrediction = takenGHBPrediction;
140 finalPrediction = notTakenGHBPrediction;
144 bpHistory =
static_cast<void*
>(history);
147 return finalPrediction;
177 unsigned choiceHistoryIdx = ((branchAddr >>
instShiftAmt)
179 unsigned globalHistoryIdx = (((branchAddr >>
instShiftAmt)
247 BiModeBPParams::create()
unsigned globalHistoryBits
void squash(ThreadID tid, void *bp_history)
void btbUpdate(ThreadID tid, Addr branch_addr, void *&bp_history)
If a branch is not taken, because the BTB address is invalid or missing, this function sets the appro...
bool lookup(ThreadID tid, Addr branch_addr, void *&bp_history)
Looks up a given PC in the BP to see if it is taken or not taken.
void updateGlobalHistReg(ThreadID tid, bool taken)
std::vector< SatCounter > choiceCounters
unsigned globalPredictorSize
std::vector< unsigned > globalHistoryReg
unsigned globalHistoryReg
unsigned choiceHistoryMask
unsigned historyRegisterMask
bool isPowerOf2(const T &n)
unsigned choicePredictorSize
std::vector< SatCounter > notTakenCounters
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
#define ULL(N)
uint64_t constant
Basically a wrapper class to hold both the branch predictor and the BTB.
int16_t ThreadID
Thread index/ID type.
unsigned getGHR(ThreadID tid, void *bp_history) const
std::vector< SatCounter > takenCounters
unsigned globalHistoryMask
void update(ThreadID tid, Addr branch_addr, bool taken, void *bp_history, bool squashed)
Updates the BP with taken/not taken information.
const unsigned instShiftAmt
Number of bits to shift instructions by for predictor addresses.
BiModeBP(const BiModeBPParams *params)
Implements a bi-mode branch predictor.
void uncondBranch(ThreadID tid, Addr pc, void *&bp_history)
unsigned notTakenThreshold