48#ifndef __CPU_PRED_TAGE_BASE_HH__
49#define __CPU_PRED_TAGE_BASE_HH__
56#include "params/TAGEBase.hh"
62namespace branch_prediction
99 void init(
int original_length,
int compressed_length)
103 outpoint = original_length % compressed_length;
212 virtual int F(
int phist,
int size,
int bank)
const;
231 static void ctrUpdate(T & ctr,
bool taken,
int nbits);
268 void updateGHist(uint8_t * &h,
bool dir, uint8_t * tab,
int &PT);
330 int nrand,
Addr corrTarget,
bool pred,
bool preAdjustAlloc =
false);
380 virtual void adjustAlloc(
bool & alloc,
bool taken,
bool pred_taken);
417 int8_t
getCtr(
int hitBank,
int hitBankIndex)
const;
Abstract superclass for simulation objects.
TAGEBase(const TAGEBaseParams &p)
virtual void updateHistories(ThreadID tid, Addr branch_pc, bool taken, BranchInfo *b, bool speculative, const StaticInstPtr &inst=nullStaticInstPtr, Addr target=MaxAddr)
(Speculatively) updates global histories (path and direction).
const unsigned tagTableUBits
virtual void handleAllocAndUReset(bool alloc, bool taken, BranchInfo *bi, int nrand)
Handles Allocation and U bits reset on an update.
@ LAST_TAGE_PROVIDER_TYPE
void update(ThreadID tid, Addr branch_pc, bool taken, BranchInfo *bi)
Update TAGE.
virtual void initFoldedHistories(ThreadHistory &history)
Initialization of the folded histories.
static void ctrUpdate(T &ctr, bool taken, int nbits)
Updates a direction counter based on the actual branch outcome.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
bool isSpeculativeUpdateEnabled() const
virtual unsigned getUseAltIdx(BranchInfo *bi, Addr branch_pc)
Calculation of the index for useAltPredForNewlyAllocated On this base TAGE implementation it is alway...
virtual void resetUctr(uint8_t &u)
Algorithm for resetting a single U counter.
virtual BranchInfo * makeBranchInfo()
virtual void extraAltCalc(BranchInfo *bi)
Extra steps for calculating altTaken For this base TAGE class it does nothing.
static void unsignedCtrUpdate(uint8_t &ctr, bool up, unsigned nbits)
Updates an unsigned counter based on up/down parameter.
unsigned getTageCtrBits() const
virtual void handleUReset()
Handles the U bits reset.
virtual void updateStats(bool taken, BranchInfo *bi)
Update the stats.
virtual void calculateParameters()
Calculates the history lengths and some other paramters in derived classes.
const unsigned logRatioBiModalHystEntries
std::vector< bool > btableHysteresis
void updateGHist(uint8_t *&h, bool dir, uint8_t *tab, int &PT)
(Speculatively) updates the global branch history.
unsigned getGHR(ThreadID tid, BranchInfo *bi) const
std::vector< bool > btablePrediction
const unsigned histBufferSize
void btbUpdate(ThreadID tid, Addr branch_addr, BranchInfo *&bi)
const unsigned nHistoryTables
virtual void adjustAlloc(bool &alloc, bool taken, bool pred_taken)
Extra calculation to tell whether TAGE allocaitons may happen or not on an update For this base TAGE ...
std::vector< ThreadHistory > threadHistory
virtual void calculateIndicesAndTags(ThreadID tid, Addr branch_pc, BranchInfo *bi)
On a prediction, calculates the TAGE indices and tags for all the different history lengths.
virtual bool getBimodePred(Addr pc, BranchInfo *bi) const
Get a branch prediction from the bimodal predictor.
const unsigned pathHistBits
int8_t getCtr(int hitBank, int hitBankIndex) const
virtual uint16_t gtag(ThreadID tid, Addr pc, int bank) const
Computes the partial tag of a tagged table.
std::vector< int > logTagTableSizes
void baseUpdate(Addr pc, bool taken, BranchInfo *bi)
Updates the bimodal predictor.
const unsigned instShiftAmt
virtual void squash(ThreadID tid, bool taken, BranchInfo *bi, Addr target)
Restores speculatively updated path and direction histories.
virtual bool isHighConfidence(BranchInfo *bi) const
virtual int F(int phist, int size, int bank) const
Utility function to shuffle the path history depending on which tagged table we are accessing.
bool tagePredict(ThreadID tid, Addr branch_pc, bool cond_branch, BranchInfo *bi)
TAGE prediction called from TAGE::predict.
std::vector< int8_t > useAltPredForNewlyAllocated
std::vector< bool > noSkip
const bool speculativeHistUpdate
int getPathHist(ThreadID tid) const
std::vector< unsigned > tagTableTagWidths
const unsigned tagTableCounterBits
gem5::branch_prediction::TAGEBase::TAGEBaseStats stats
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.
virtual void buildTageTables()
Instantiates the TAGE table entries.
const int64_t initialTCounterValue
virtual int gindex(ThreadID tid, Addr pc, int bank) const
Computes the index used to access a partially tagged table.
virtual void handleTAGEUpdate(Addr branch_pc, bool taken, BranchInfo *bi)
Handles the update of the TAGE entries.
size_t getSizeInBits() const
virtual int bindex(Addr pc_in) const
Computes the index used to access the bimodal table.
This is a simple scalar statistic, like a counter.
A vector of scalar stats.
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.
const StaticInstPtr nullStaticInstPtr
Statically allocated null StaticInstPtr.
Declaration of Statistics objects.
BranchInfo(const TAGEBase &tage)
void init(int original_length, int compressed_length)
statistics::Scalar longestMatchProviderCorrect
statistics::Vector longestMatchProvider
statistics::Scalar altMatchProviderCorrect
statistics::Scalar bimodalAltMatchProviderCorrect
statistics::Scalar bimodalAltMatchProviderWrong
statistics::Scalar longestMatchProviderWouldHaveHit
statistics::Scalar longestMatchProviderWrong
statistics::Scalar bimodalProviderWrong
statistics::Vector altMatchProvider
TAGEBaseStats(statistics::Group *parent, unsigned nHistoryTables)
statistics::Scalar bimodalProviderCorrect
statistics::Scalar altMatchProviderWouldHaveHit
statistics::Scalar altMatchProviderWrong
FoldedHistory * computeIndices
FoldedHistory * computeTags[2]