51#ifndef __CPU_PRED_MULTIPERSPECTIVE_PERCEPTRON_TAGE_HH__
52#define __CPU_PRED_MULTIPERSPECTIVE_PERCEPTRON_TAGE_HH__
59#include "params/MPP_LoopPredictor.hh"
60#include "params/MPP_StatisticalCorrector.hh"
61#include "params/MPP_TAGE.hh"
62#include "params/MultiperspectivePerceptronTAGE.hh"
67namespace branch_prediction
100 void adjustAlloc(
bool & alloc,
bool taken,
bool pred_taken)
override;
106 bool taken,
Addr branch_pc,
Addr target);
153 unsigned int truncated_target = target;
156 (truncated_target >> 5) ^ taken);
180 bool bias)
const override;
185 int altBank)
const override;
191 bool bias_bit,
bool use_conf_ctr, int8_t conf_ctr,
192 unsigned conf_bits,
int hitBank,
int altBank, int64_t phist,
193 int init_lsum)
override;
197 Addr target,
bool b,
int hitBank,
int altBank,
198 int64_t phist)
override;
242 const HistorySpec &spec,
int index)
const;
249 const MultiperspectivePerceptronTAGEParams &
p);
251 void init()
override;
256 void * &bp_history,
bool squashed,
259 Addr target,
void * &bp_history)
override;
std::shared_ptr< Random > RandomPtr
static RandomPtr genRandom()
bool optionalAgeInc() const override
MPP_LoopPredictor(const MPP_LoopPredictorParams &p)
bool calcConf(int index) const override
unsigned getIndUpd(Addr branch_pc) const override
void gUpdate(Addr branch_pc, bool taken, int64_t hist, std::vector< int > &length, std::vector< int8_t > *tab, int nbr, int logs, std::vector< int8_t > &w, StatisticalCorrector::BranchInfo *bi) override
unsigned getIndBiasSK(Addr branch_pc, StatisticalCorrector::BranchInfo *bi) const override
unsigned getIndBias(Addr branch_pc, StatisticalCorrector::BranchInfo *bi, bool bias) const override
bool scPredict(ThreadID tid, Addr branch_pc, bool cond_branch, StatisticalCorrector::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) override
std::vector< int8_t > * pgehl
unsigned getIndBiasBank(Addr branch_pc, StatisticalCorrector::BranchInfo *bi, int hitBank, int altBank) const override
int gIndexLogsSubstr(int nbr, int i) override
virtual void getBiasLSUM(Addr branch_pc, StatisticalCorrector::BranchInfo *bi, int &lsum) const =0
std::vector< int8_t > * ggehl
void condBranchUpdate(ThreadID tid, Addr branch_pc, bool taken, StatisticalCorrector::BranchInfo *bi, Addr target, bool b, int hitBank, int altBank, int64_t phist) override
void handleAllocAndUReset(bool alloc, bool taken, TAGEBase::BranchInfo *bi, int nrand) override
Handles Allocation and U bits reset on an update.
void resetUctr(uint8_t &u) override
Algorithm for resetting a single U counter.
int bindex(Addr pc_in) const override
Computes the index used to access the bimodal table.
MPP_TAGE(const MPP_TAGEParams &p)
std::vector< unsigned int > tunedHistoryLengths
void calculateParameters() override
Calculates the history lengths and some other paramters in derived classes.
void updatePathAndGlobalHistory(ThreadHistory &tHist, int brtype, bool taken, Addr branch_pc, Addr target)
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).
void handleTAGEUpdate(Addr branch_pc, bool taken, TAGEBase::BranchInfo *bi) override
Handles the update of the TAGE entries.
bool isHighConfidence(TAGEBase::BranchInfo *bi) const override
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 ...
unsigned getUseAltIdx(TAGEBase::BranchInfo *bi, Addr branch_pc) override
Calculation of the index for useAltPredForNewlyAllocated On this base TAGE implementation it is alway...
void handleUReset() override
Handles the U bits reset.
bool lookup(ThreadID tid, Addr instPC, void *&bp_history) override
Looks up a given conditional branch PC of in the BP to see if it is taken or not taken.
void squash(ThreadID tid, void *&bp_history) override
int computePartialSum(ThreadID tid, MPPTAGEBranchInfo &bi) const
LoopPredictor * loopPredictor
void update(ThreadID tid, Addr pc, bool taken, void *&bp_history, bool squashed, const StaticInstPtr &inst, Addr target) override
Updates the BP with taken/not taken information.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
StatisticalCorrector * statisticalCorrector
unsigned int getIndex(ThreadID tid, MPPTAGEBranchInfo &bi, const HistorySpec &spec, int index) const
void updatePartial(ThreadID tid, MPPTAGEBranchInfo &bi, bool taken)
void updateHistories(ThreadID tid, MPPTAGEBranchInfo &bi, bool taken)
const unsigned int pc
pc of the branch
std::vector< int8_t > bias
Copyright (c) 2024 Arm Limited 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.
unsigned int historyStackPointer
void updateHistoryStack(Addr target, bool taken, bool is_call, bool is_return)
unsigned int getPointer() const
int64_t getHistoryStackEntry() const
std::vector< int64_t > historyStack
BranchInfo(TAGEBase &tage)
Branch information data type.
virtual ~MPPTAGEBranchInfo()
MPPTAGEBranchInfo(Addr pc, int pcshift, bool cond, TAGEBase &tage, LoopPredictor &loopPredictor, StatisticalCorrector &statisticalCorrector)
StatisticalCorrector::BranchInfo * scBranchInfo
TAGEBase::BranchInfo * tageBranchInfo
LoopPredictor::BranchInfo * lpBranchInfo