34 #ifndef __CPU_PRED_LOOP_PREDICTOR_HH__ 35 #define __CPU_PRED_LOOP_PREDICTOR_HH__ 41 struct LoopPredictorParams;
69 LoopEntry() : numIter(0), currentIter(0), currentIterSpec(0),
70 confidence(0), tag(0), age(0), dir(0) { }
99 assert(nbits <=
sizeof(uint8_t) << 3);
101 if (ctr < ((1 << nbits) - 1))
111 if (ctr < ((1 << (nbits - 1)) - 1))
114 if (ctr > -(1 << (nbits - 1)))
134 : loopTag(0), currentIter(0),
136 loopPredValid(false), loopIndex(0), loopIndexB(0), loopHit(0),
147 int lindex(
Addr pc_in,
unsigned instShiftAmt)
const;
157 int finallindex(
int lindex,
int lowPcBits,
int way)
const;
171 unsigned instShiftAmt)
const;
202 bool tage_pred,
BranchInfo* bi,
unsigned instShiftAmt);
219 BranchInfo* bi,
bool prev_pred_taken,
unsigned instShiftAmt);
251 void init()
override;
262 #endif//__CPU_PRED_LOOP_PREDICTOR_HH__ bool getLoop(Addr pc, BranchInfo *bi, bool speculative, unsigned instShiftAmt) const
Get a branch prediction from the loop predictor.
void squashLoop(BranchInfo *bi)
const bool optionalAgeReset
void squash(ThreadID tid, BranchInfo *bi)
Stats::Scalar loopPredictorCorrect
void condBranchUpdate(ThreadID tid, Addr branch_pc, bool taken, bool tage_pred, BranchInfo *bi, unsigned instShiftAmt)
Update LTAGE for conditional branches.
virtual BranchInfo * makeBranchInfo()
const unsigned loopTableAgeBits
const bool useDirectionBit
Declaration of Statistics objects.
This is a simple scalar statistic, like a counter.
void init() override
Initialize the loop predictor.
Stats::Scalar loopPredictorWrong
const uint16_t loopNumIterMask
const unsigned loopTableConfidenceBits
const unsigned logLoopTableAssoc
static void unsignedCtrUpdate(uint8_t &ctr, bool up, unsigned nbits)
Updates an unsigned counter based on up/down parameter.
virtual bool calcConf(int index) const
int lindex(Addr pc_in, unsigned instShiftAmt) const
Computes the index used to access the loop predictor.
int finallindex(int lindex, int lowPcBits, int way) const
Computes the index used to access the ltable structures.
size_t getSizeInBits() const
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
static void signedCtrUpdate(int8_t &ctr, bool up, unsigned nbits)
const unsigned loopTableIterBits
int16_t ThreadID
Thread index/ID type.
const uint8_t confidenceThreshold
void specLoopUpdate(bool taken, BranchInfo *bi)
Speculatively updates the loop predictor iteration count (only for useSpeculation).
void regStats() override
Register stats for this object.
LoopPredictor(LoopPredictorParams *p)
const unsigned loopTableTagBits
const unsigned initialLoopAge
const uint16_t loopTagMask
const unsigned logSizeLoopPred
const unsigned initialLoopIter
const bool useSpeculation
int8_t getLoopUseCounter() const
Gets the value of the loop use counter.
bool loopPredict(ThreadID tid, Addr branch_pc, bool cond_branch, BranchInfo *bi, bool prev_pred_taken, unsigned instShiftAmt)
Get the loop prediction.
Abstract superclass for simulation objects.
void loopUpdate(Addr pc, bool Taken, BranchInfo *bi, bool tage_pred)
Updates the loop predictor.
const bool restrictAllocation
void updateStats(bool taken, BranchInfo *bi)
Update the stats.
virtual bool optionalAgeInc() const