34#ifndef __CPU_PRED_LOOP_PREDICTOR_HH__
35#define __CPU_PRED_LOOP_PREDICTOR_HH__
44struct LoopPredictorParams;
46namespace branch_prediction
108 assert(nbits <=
sizeof(uint8_t) << 3);
110 if (ctr < ((1 << nbits) - 1))
120 if (ctr < ((1 << (nbits - 1)) - 1))
123 if (ctr > -(1 << (nbits - 1)))
156 int lindex(
Addr pc_in,
unsigned instShiftAmt)
const;
180 unsigned instShiftAmt)
const;
211 bool tage_pred, BranchInfo*
bi,
unsigned instShiftAmt);
228 BranchInfo*
bi,
bool prev_pred_taken,
unsigned instShiftAmt);
260 void init()
override;
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
Abstract superclass for simulation objects.
virtual bool optionalAgeInc() const
size_t getSizeInBits() const
const unsigned loopTableAgeBits
virtual BranchInfo * makeBranchInfo()
void updateStats(bool taken, BranchInfo *bi)
Update the stats.
int finallindex(int lindex, int lowPcBits, int way) const
Computes the index used to access the ltable structures.
const unsigned initialLoopIter
static void unsignedCtrUpdate(uint8_t &ctr, bool up, unsigned nbits)
Updates an unsigned counter based on up/down parameter.
const uint16_t loopNumIterMask
static void signedCtrUpdate(int8_t &ctr, bool up, unsigned nbits)
const unsigned loopTableIterBits
const unsigned loopTableConfidenceBits
void specLoopUpdate(bool taken, BranchInfo *bi)
Speculatively updates the loop predictor iteration count (only for useSpeculation).
gem5::branch_prediction::LoopPredictor::LoopPredictorStats stats
const bool useDirectionBit
int lindex(Addr pc_in, unsigned instShiftAmt) const
Computes the index used to access the loop predictor.
const unsigned logLoopTableAssoc
void init() override
Initialize the loop predictor.
void condBranchUpdate(ThreadID tid, Addr branch_pc, bool taken, bool tage_pred, BranchInfo *bi, unsigned instShiftAmt)
Update LTAGE for conditional branches.
const bool optionalAgeReset
const uint8_t confidenceThreshold
void squashLoop(BranchInfo *bi)
const bool restrictAllocation
virtual bool calcConf(int index) const
const unsigned logSizeLoopPred
int8_t getLoopUseCounter() const
Gets the value of the loop use counter.
bool getLoop(Addr pc, BranchInfo *bi, bool speculative, unsigned instShiftAmt) const
Get a branch prediction from the loop predictor.
bool loopPredict(ThreadID tid, Addr branch_pc, bool cond_branch, BranchInfo *bi, bool prev_pred_taken, unsigned instShiftAmt)
Get the loop prediction.
void loopUpdate(Addr pc, bool Taken, BranchInfo *bi, bool tage_pred)
Updates the loop predictor.
const unsigned loopTableTagBits
void squash(ThreadID tid, BranchInfo *bi)
const unsigned initialLoopAge
const bool useSpeculation
const uint16_t loopTagMask
This is a simple scalar statistic, like a counter.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
int16_t ThreadID
Thread index/ID type.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Declaration of Statistics objects.
statistics::Scalar correct