44#ifndef __CPU_PRED_LOOP_PREDICTOR_HH__
45#define __CPU_PRED_LOOP_PREDICTOR_HH__
54struct LoopPredictorParams;
56namespace branch_prediction
119 assert(nbits <=
sizeof(uint8_t) << 3);
121 if (ctr < ((1 << nbits) - 1))
131 if (ctr < ((1 << (nbits - 1)) - 1))
134 if (ctr > -(1 << (nbits - 1)))
167 int lindex(
Addr pc_in,
unsigned instShiftAmt)
const;
191 unsigned instShiftAmt)
const;
222 bool tage_pred, BranchInfo*
bi,
unsigned instShiftAmt);
239 BranchInfo*
bi,
bool prev_pred_taken,
unsigned instShiftAmt);
271 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()
LoopPredictor(const LoopPredictorParams &p)
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.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
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.
LoopPredictorStats(statistics::Group *parent)
statistics::Scalar correct