47namespace branch_prediction
51 const TAGE_SC_L_64KB_StatisticalCorrectorParams &
p)
53 numEntriesSecondLocalHistories(
p.numEntriesSecondLocalHistories),
54 numEntriesThirdLocalHistories(
p.numEntriesThirdLocalHistories),
80 sh->setNumOrdinalHistories(3);
85 sh->imHist.resize(1 <<
im[0]);
93 return (
bi->predBeforeSC + (((hitBank+1)/4)<<4) + (
bi->highConf<<1) +
94 (
bi->lowConf <<2) + ((altBank!=0)<<3) +
95 ((branch_pc^(branch_pc>>2))<<7)) & ((1<<
logBias) -1);
106 (branch_pc << 1) +
bi->predBeforeSC,
sh->bwHist,
bwm,
113 branch_pc,
sh->getLocalHistory(1, branch_pc),
lm,
117 branch_pc,
sh->getLocalHistory(2, branch_pc),
sm,
121 branch_pc,
sh->getLocalHistory(3, branch_pc),
tm,
143 return (
i >= (nbr - 2)) ? 1 : 0;
160 sh->imHist[imliCount] = (
sh->imHist[imliCount] << 1)
162 sh->updateLocalHistory(2, branch_pc, taken, branch_pc & 15);
163 sh->updateLocalHistory(3, branch_pc, taken);
224 int numAllocated = 0;
225 bool maxAllocReached =
false;
229 for (
int j = 0; j < 2; ++j) {
230 int i = ((j == 0) ? I : (I ^ 1)) + 1;
234 if (abs (2 * ctr + 1) <= 3) {
253 if (maxAllocReached) {
258 tCounter += (penalty - 2 * numAllocated);
267 if (
bi->hitBank > 0) {
268 if (abs (2 *
gtable[
bi->hitBank][
bi->hitBankIndex].
ctr + 1) == 1) {
269 if (
bi->longestMatchPred != taken) {
271 if (
bi->altBank > 0) {
275 if (
bi->altBank == 0){
285 if (abs (2 *
gtable[
bi->hitBank][
bi->hitBankIndex].
ctr + 1) == 1) {
289 if (
bi->altTaken == taken) {
290 if (
bi->altBank > 0) {
292 if (abs (2 * ctr + 1) == 7) {
293 if (
gtable[
bi->hitBank][
bi->hitBankIndex].
u == 1) {
294 if (
bi->longestMatchPred == taken) {
305 if ((
bi->longestMatchPred !=
bi->altTaken) &&
306 (
bi->longestMatchPred == taken) &&
bool isDirectCtrl() const
bool isUncondCtrl() const
void initGEHLTable(unsigned numLenghts, std::vector< int > lengths, std::vector< int8_t > *&table, unsigned logNumEntries, std::vector< int8_t > &w, int8_t wInitValue)
std::vector< int8_t > * lgehl
virtual void scHistoryUpdate(Addr branch_pc, const StaticInstPtr &inst, bool taken, BranchInfo *tage_bi, Addr corrTarget)
int gPredict(Addr branch_pc, int64_t hist, std::vector< int > &length, std::vector< int8_t > *tab, int nbr, int logs, std::vector< int8_t > &w)
const unsigned numEntriesFirstLocalHistories
virtual unsigned getIndUpd(Addr branch_pc) const
SCThreadHistory * scHistory
virtual 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, BranchInfo *bi)
std::vector< int8_t > * bwgehl
std::vector< int > pUpdateThreshold
unsigned getIndUpds(Addr branch_pc) const
std::vector< int8_t > wbw
std::vector< int8_t > * igehl
const unsigned tagTableUBits
static void ctrUpdate(T &ctr, bool taken, int nbits)
Updates a direction counter based on the actual branch outcome.
const unsigned nHistoryTables
std::vector< ThreadHistory > threadHistory
void baseUpdate(Addr pc, bool taken, BranchInfo *bi)
Updates the bimodal predictor.
std::vector< bool > noSkip
std::vector< unsigned > tagTableTagWidths
const unsigned tagTableCounterBits
void scHistoryUpdate(Addr branch_pc, const StaticInstPtr &inst, bool taken, BranchInfo *tage_bi, Addr corrTarget) override
void gUpdates(ThreadID tid, Addr pc, bool taken, BranchInfo *bi, int64_t phist) override
std::vector< int8_t > * sgehl
SCThreadHistory * makeThreadHistory() override
std::vector< int8_t > wim
std::vector< int8_t > * imgehl
std::vector< int8_t > * pgehl
int gIndexLogsSubstr(int nbr, int i) override
std::vector< int8_t > * tgehl
int gPredictions(ThreadID tid, Addr branch_pc, BranchInfo *bi, int &lsum, int64_t phist) override
const unsigned numEntriesSecondLocalHistories
const unsigned numEntriesThirdLocalHistories
unsigned getIndBiasBank(Addr branch_pc, BranchInfo *bi, int hitBank, int altBank) const override
TAGE_SC_L_64KB_StatisticalCorrector(const TAGE_SC_L_64KB_StatisticalCorrectorParams &p)
TAGE_SC_L_64KB(const TAGE_SC_L_64KBParams ¶ms)
void handleTAGEUpdate(Addr branch_pc, bool taken, TAGEBase::BranchInfo *bi) override
Handles the update of the TAGE entries.
uint16_t gtag(ThreadID tid, Addr pc, int bank) const override
Computes the partial tag of a tagged table.
int gindex_ext(int index, int bank) const override
void handleAllocAndUReset(bool alloc, bool taken, TAGEBase::BranchInfo *bi, int nrand) override
Handles Allocation and U bits reset on an update.
int calcDep(TAGEBase::BranchInfo *bi)
void handleUReset() override
Handles the U bits reset.
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.