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),
48 choiceCounters(choicePredictorSize,
SatCounter(choiceCtrBits)),
49 takenCounters(globalPredictorSize,
SatCounter(globalCtrBits)),
50 notTakenCounters(globalPredictorSize,
SatCounter(globalCtrBits))
53 fatal(
"Invalid choice predictor size.\n");
55 fatal(
"Invalid global history predictor size.\n");
80 bpHistory =
static_cast<void*
>(history);
105 unsigned choiceHistoryIdx = ((branchAddr >>
instShiftAmt)
107 unsigned globalHistoryIdx = (((branchAddr >>
instShiftAmt)
120 bool finalPrediction;
128 if (choicePrediction) {
129 finalPrediction = takenGHBPrediction;
131 finalPrediction = notTakenGHBPrediction;
135 bpHistory =
static_cast<void*
>(history);
138 return finalPrediction;
168 unsigned choiceHistoryIdx = ((branchAddr >>
instShiftAmt)
170 unsigned globalHistoryIdx = (((branchAddr >>
instShiftAmt)
232 BiModeBPParams::create()
unsigned globalHistoryBits
void squash(ThreadID tid, void *bp_history)
#define fatal(...)
This implements a cprintf based fatal() function.
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
Implements an n bit saturating counter and provides methods to increment, decrement, and read it.
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.
std::vector< SatCounter > takenCounters
unsigned globalHistoryMask
const unsigned instShiftAmt
Number of bits to shift instructions by for predictor addresses.
BiModeBP(const BiModeBPParams *params)
void update(ThreadID tid, Addr branch_addr, bool taken, void *bp_history, bool squashed, const StaticInstPtr &inst, Addr corrTarget)
Updates the BP with taken/not taken information.
Implements a bi-mode branch predictor.
void uncondBranch(ThreadID tid, Addr pc, void *&bp_history)
unsigned notTakenThreshold