51 const TAGE_SC_L_64KB_StatisticalCorrectorParams &
p)
80 sh->setNumOrdinalHistories(3);
85 sh->imHist.resize(1 <<
im[0]);
96 return (
bi->predBeforeSC
97 + (((hitBank + 1) / 4) << 4)
100 + ((altBank != 0) << 3)
101 + ((shifted_pc ^ (shifted_pc >> 2)) << 7))
117 branch_pc,
bi->localHistories[1],
lm,
121 branch_pc,
bi->localHistories[2],
sm,
125 branch_pc,
bi->localHistories[3],
tm,
129 branch_pc,
bi->imHist,
imm,
147 return (
i >= (nbr - 2)) ? 1 : 0;
153 bool taken,
Addr target,
164 int64_t imliCount =
sh->imliCount;
165 sh->imHist[imliCount] = (
sh->imHist[imliCount] << 1)
167 sh->updateLocalHistory(2, branch_pc, taken, branch_pc & 15);
168 sh->updateLocalHistory(3, branch_pc, taken);
181 bi->imHist =
sh->imHist[
sh->imliCount];
182 bi->localHistories[2] =
sh->getLocalHistory(2, branch_pc);
183 bi->localHistories[3] =
sh->getLocalHistory(3, branch_pc);
193 sh->imHist[
sh->imliCount] =
bi->imHist;
194 sh->setLocalHistory(2,
bi->pc,
bi->localHistories[2]);
195 sh->setLocalHistory(3,
bi->pc,
bi->localHistories[3]);
236 int tag = shifted_pc ^
threadHistory[tid].computeTags[0][bank].comp ^
251 int numAllocated = 0;
252 bool maxAllocReached =
false;
256 for (
int j = 0; j < 2; ++j) {
257 int i = ((j == 0) ? I : (I ^ 1)) + 1;
260 int8_t ctr =
gtable[
i][
bi->tableIndices[
i]].ctr;
261 if (abs (2 * ctr + 1) <= 3) {
263 gtable[
i][
bi->tableIndices[
i]].ctr = taken ? 0 : -1;
280 if (maxAllocReached) {
285 tCounter += (penalty - 2 * numAllocated);
294 if (
bi->hitBank > 0) {
295 if (abs (2 *
gtable[
bi->hitBank][
bi->hitBankIndex].ctr + 1) == 1) {
296 if (
bi->longestMatchPred != taken) {
298 if (
bi->altBank > 0) {
302 if (
bi->altBank == 0){
312 if (abs (2 *
gtable[
bi->hitBank][
bi->hitBankIndex].ctr + 1) == 1) {
316 if (
bi->altTaken == taken) {
317 if (
bi->altBank > 0) {
318 int8_t ctr =
gtable[
bi->altBank][
bi->altBankIndex].ctr;
319 if (abs (2 * ctr + 1) == 7) {
320 if (
gtable[
bi->hitBank][
bi->hitBankIndex].u == 1) {
321 if (
bi->longestMatchPred == taken) {
332 if ((
bi->longestMatchPred !=
bi->altTaken) &&
333 (
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 bool scRestoreHistState(BranchInfo *bi)
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 void scHistoryUpdate(Addr branch_pc, const StaticInstPtr &inst, bool taken, Addr target, int64_t phist)
virtual void scRecordHistState(Addr branch_pc, BranchInfo *bi)
StatisticalCorrector(const StatisticalCorrectorParams &p)
const unsigned instShiftAmt
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.
const unsigned instShiftAmt
std::vector< bool > noSkip
std::vector< unsigned > tagTableTagWidths
const unsigned tagTableCounterBits
void scRecordHistState(Addr branch_pc, BranchInfo *bi) override
std::vector< int8_t > * sgehl
SCThreadHistory * makeThreadHistory() override
bool scRestoreHistState(BranchInfo *bi) 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
void gUpdates(ThreadID tid, Addr pc, bool taken, BranchInfo *bi) override
void scHistoryUpdate(Addr branch_pc, const StaticInstPtr &inst, bool taken, Addr target, int64_t phist) override
int gPredictions(ThreadID tid, Addr branch_pc, BranchInfo *bi, int &lsum) 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.
TAGE_SC_L(const TAGE_SC_LParams ¶ms)
const Params & params() const
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.
RefCountingPtr< StaticInst > StaticInstPtr