Go to the documentation of this file.
46 #include "debug/TageSCL.hh"
62 TAGE_SC_L_LoopPredictorParams::create()
68 :
LTAGE(
p), statisticalCorrector(
p->statistical_corrector)
87 for (
int i = 2;
i <= numHistLengths;
i++) {
90 (
double) (
i - 1) / (
double) ((numHistLengths - 1))))
185 unsigned int shortPc =
pc;
203 a =
a & ((
ULL(1) << size) - 1);
234 int tmp = ((branch_pc ^ (branch_pc >>
instShiftAmt))) ^ taken;
237 if ((brtype == 3) & taken) {
243 int maxt = (brtype == 2) ? 3 : 2;
245 for (
int t = 0;
t < maxt;
t++) {
246 bool dir = (tmp & 1);
248 int pathbit = (
path & 127);
273 assert(! speculative);
283 DPRINTF(TageSCL,
"Updating global histories with branch:%lx; taken?:%d, "
284 "path Hist: %x; pointer:%d\n", branch_pc, taken, tHist.
pathHist,
292 fatal(
"Speculation is not implemented");
311 return ((((
bi->hitBank - 1 + 2 *
a) & 0xffe)) ^
348 bi->highConf = (bim == 0) || (bim == 3);
349 bi->lowConf = !
bi->highConf;
350 bi->altConf =
bi->highConf;
361 tage_scl_bi->
altConf = (abs(2*ctr + 1) > 1);
375 bi->lpBranchInfo, pred_taken,
378 if (
bi->lpBranchInfo->loopPredUsed) {
379 bi->tageBranchInfo->provider =
LOOP;
386 bi->scBranchInfo->lowConf = tage_scl_bi->
lowConf;
387 bi->scBranchInfo->highConf = tage_scl_bi->
highConf;
388 bi->scBranchInfo->altConf = tage_scl_bi->
altConf;
389 bi->scBranchInfo->medConf = tage_scl_bi->
medConf;
391 bool use_tage_ctr =
bi->tageBranchInfo->hitBank > 0;
392 int8_t tage_ctr = use_tage_ctr ?
394 bool bias = (
bi->tageBranchInfo->longestMatchPred !=
395 bi->tageBranchInfo->altTaken);
398 bi->scBranchInfo, pred_taken, bias, use_tage_ctr, tage_ctr,
402 if (
bi->scBranchInfo->usedScPred) {
403 bi->tageBranchInfo->provider =
SC;
407 bi->lpBranchInfo->predTaken = pred_taken;
426 tage->
squash(tid, taken, tage_bi, corrTarget);
427 if (
bi->tageBranchInfo->condBranch) {
436 DPRINTF(TageSCL,
"Updating tables for branch:%lx; taken?:%d\n",
444 bool bias = (
bi->tageBranchInfo->longestMatchPred !=
445 bi->tageBranchInfo->altTaken);
447 bi->scBranchInfo, corrTarget, bias,
bi->tageBranchInfo->hitBank,
454 nrand, corrTarget,
bi->lpBranchInfo->predTaken);
459 bi->scBranchInfo, corrTarget);
void buildTageTables() override
Instantiates the TAGE table entries.
#define fatal(...)
This implements a cprintf based fatal() function.
std::vector< unsigned > tagTableTagWidths
bool isDirectCtrl() const
virtual void regStats() override
Callback to set stat parameters.
const unsigned nHistoryTables
void updateStats(bool taken, BranchInfo *bi)
Update the stats.
const unsigned logTagTableSize
unsigned getTageCtrBits() const
int16_t ThreadID
Thread index/ID type.
const bool truncatePathHist
void regStats() override
Callback to set stat parameters.
const unsigned shortTagsTageFactor
int calcDep(TAGEBase::BranchInfo *bi)
FoldedHistory * computeTags[2]
void squash(ThreadID tid, bool taken, TAGEBase::BranchInfo *bi, Addr target) override
Restores speculatively updated path and direction histories.
StatisticalCorrector * statisticalCorrector
TAGE_SC_L(const TAGE_SC_LParams *params)
std::vector< bool > noSkip
virtual bool getBimodePred(Addr pc, BranchInfo *bi) const
Get a branch prediction from the bimodal predictor.
const unsigned instShiftAmt
Number of bits to shift instructions by for predictor addresses.
int bindex(Addr pc_in) const override
Computes the index used to access the bimodal table.
virtual bool calcConf(int index) const
int8_t getCtr(int hitBank, int hitBankIndex) const
void calculateParameters() override
Calculates the history lengths and some other paramters in derived classes.
std::vector< ThreadHistory > threadHistory
int gindex(ThreadID tid, Addr pc, int bank) const override
Computes the index used to access a partially tagged table.
std::vector< bool > btableHysteresis
virtual void condBranchUpdate(ThreadID tid, Addr branch_pc, bool taken, BranchInfo *bi, int nrand, Addr corrTarget, bool pred, bool preAdjustAlloc=false)
Update TAGE for conditional branches.
std::vector< bool > btablePrediction
const unsigned pathHistBits
bool getBimodePred(Addr branch_pc, TAGEBase::BranchInfo *tage_bi) const override
Get a branch prediction from the bimodal predictor.
void calculateIndicesAndTags(ThreadID tid, Addr branch_pc, TAGEBase::BranchInfo *bi) override
On a prediction, calculates the TAGE indices and tags for all the different history lengths.
void updateStats(bool taken, BranchInfo *bi)
int F(int phist, int size, int bank) const override
Utility function to shuffle the path history depending on which tagged table we are accessing.
bool predict(ThreadID tid, Addr branch_pc, bool cond_branch, void *&b) override
Get a branch prediction from LTAGE.
void squashLoop(BranchInfo *bi)
void handleUReset() override
Handles the U bits reset.
virtual bool optionalAgeInc() const override
virtual void resetUctr(uint8_t &u)
Algorithm for resetting a single U counter.
virtual void updateHistories(ThreadID tid, Addr branch_pc, bool taken, BranchInfo *b, bool speculative, const StaticInstPtr &inst=StaticInst::nullStaticInstPtr, Addr target=MaxAddr)
(Speculatively) updates global histories (path and direction).
virtual uint16_t gtag(ThreadID tid, Addr pc, int bank) const override=0
Computes the partial tag of a tagged table.
std::vector< int > logTagTableSizes
virtual void updateStats(bool taken, BranchInfo *bi)
Update the stats.
unsigned getUseAltIdx(TAGEBase::BranchInfo *bi, Addr branch_pc) override
Calculation of the index for useAltPredForNewlyAllocated On this base TAGE implementation it is alway...
bool loopPredict(ThreadID tid, Addr branch_pc, bool cond_branch, BranchInfo *bi, bool prev_pred_taken, unsigned instShiftAmt)
Get the loop prediction.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void updateHistories(ThreadID tid, Addr branch_pc, bool taken, TAGEBase::BranchInfo *b, bool speculative, const StaticInstPtr &inst, Addr target) override
(Speculatively) updates global histories (path and direction).
virtual void squash(ThreadID tid, bool taken, BranchInfo *bi, Addr target)
Restores speculatively updated path and direction histories.
virtual bool scPredict(ThreadID tid, Addr branch_pc, bool cond_branch, BranchInfo *bi, bool prev_pred_taken, bool bias_bit, bool use_conf_ctr, int8_t conf_ctr, unsigned conf_bits, int hitBank, int altBank, int64_t phist, int init_lsum=0)
virtual void scHistoryUpdate(Addr branch_pc, const StaticInstPtr &inst, bool taken, BranchInfo *tage_bi, Addr corrTarget)
const unsigned logRatioBiModalHystEntries
bool isSpeculativeUpdateEnabled() const
virtual int gindex_ext(int index, int bank) const =0
virtual bool calcConf(int index) const override
LoopPredictor * loopPredictor
The loop predictor object.
const unsigned instShiftAmt
const unsigned longTagsSize
const unsigned firstLongTagTable
void adjustAlloc(bool &alloc, bool taken, bool pred_taken) override
Extra calculation to tell whether TAGE allocaitons may happen or not on an update For this base TAGE ...
virtual void condBranchUpdate(ThreadID tid, Addr branch_pc, bool taken, BranchInfo *bi, Addr corrTarget, bool bias_bit, int hitBank, int altBank, int64_t phist)
const unsigned shortTagsSize
void condBranchUpdate(ThreadID tid, Addr branch_pc, bool taken, bool tage_pred, BranchInfo *bi, unsigned instShiftAmt)
Update LTAGE for conditional branches.
void extraAltCalc(TAGEBase::BranchInfo *bi) override
Extra steps for calculating altTaken For this base TAGE class it does nothing.
bool tagePredict(ThreadID tid, Addr branch_pc, bool cond_branch, BranchInfo *bi)
TAGE prediction called from TAGE::predict.
std::enable_if< std::is_integral< T >::value, T >::type random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
void updatePathAndGlobalHistory(ThreadHistory &tHist, int brtype, bool taken, Addr branch_pc, Addr target)
virtual TAGEBase::BranchInfo * makeBranchInfo() override
FoldedHistory * computeIndices
static std::stack< std::string > path
const unsigned longTagsTageFactor
void update(ThreadID tid, Addr branch_addr, bool taken, void *bp_history, bool squashed, const StaticInstPtr &inst, Addr corrTarget) override
Updates the BP with taken/not taken information.
#define ULL(N)
uint64_t constant
bool isUncondCtrl() const
void updateGHist(uint8_t *&h, bool dir, uint8_t *tab, int &PT)
(Speculatively) updates the global branch history.
int getPathHist(ThreadID tid) const
const bool speculativeHistUpdate
Generated on Wed Sep 30 2020 14:02:09 for gem5 by doxygen 1.8.17