45#include "debug/TageSCL.hh"
50namespace branch_prediction
54 const TAGE_SC_L_8KB_StatisticalCorrectorParams &
p)
67 sh->setNumOrdinalHistories(1);
76 return (
bi->predBeforeSC + (((hitBank+1)/4)<<4) + (
bi->highConf<<1) +
77 (
bi->lowConf <<2) +((altBank!=0)<<3)) & ((1<<
logBias) -1);
93 branch_pc,
sh->getLocalHistory(1, branch_pc),
lm,
158 DPRINTF(TageSCL,
"HistLength:%d, TTSize:%d, TTTWidth:%d\n",
173 int tag = (
threadHistory[tid].computeIndices[bank - 1].comp << 2) ^
pc ^
179 tag = (tag >> 1) ^ ((tag & 1) << 10) ^
198 int numAllocated = 0;
199 bool maxAllocReached =
false;
203 for (
int j = 0; j < 2; ++j) {
204 int i = ((j == 0) ? I : (I ^ 1)) + 1;
218 maxAllocReached =
true;
225 (abs (2 * ctr + 1) == 1)) {
238 if (maxAllocReached) {
243 tCounter += (truePen + penalty - 5 * numAllocated);
261 if (
bi->hitBank > 0) {
262 if (abs (2 *
gtable[
bi->hitBank][
bi->hitBankIndex].
ctr + 1) == 1) {
263 if (
bi->longestMatchPred != taken) {
264 if (
bi->altBank > 0) {
266 if (abs (2 * ctr + 1) == 1) {
274 if (abs (2 * ctr + 1) == 1) {
278 if (
bi->altBank == 0) {
285 if (abs (2 *
gtable[
bi->hitBank][
bi->hitBankIndex].
ctr + 1) == 1) {
293 if (abs (2 *
gtable[
bi->hitBank][
bi->hitBankIndex].
ctr + 1) == 1) {
297 if (
bi->altTaken == taken) {
298 if (
bi->altBank > 0) {
300 if (abs (2*ctr + 1) == 7) {
301 if (
gtable[
bi->hitBank][
bi->hitBankIndex].
u == 1) {
302 if (
bi->longestMatchPred == taken) {
313 if ((
bi->longestMatchPred !=
bi->altTaken) &&
314 (
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
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
const unsigned pathHistBits
std::vector< int > logTagTableSizes
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
int gIndexLogsSubstr(int nbr, int i) override
std::vector< int8_t > * ggehl
TAGE_SC_L_8KB_StatisticalCorrector(const TAGE_SC_L_8KB_StatisticalCorrectorParams &p)
void scHistoryUpdate(Addr branch_pc, const StaticInstPtr &inst, bool taken, BranchInfo *tage_bi, Addr corrTarget) override
unsigned getIndBiasBank(Addr branch_pc, BranchInfo *bi, int hitBank, int altBank) const override
SCThreadHistory * makeThreadHistory() override
int gPredictions(ThreadID tid, Addr branch_pc, BranchInfo *bi, int &lsum, int64_t phist) override
void gUpdates(ThreadID tid, Addr pc, bool taken, BranchInfo *bi, int64_t phist) override
TAGE_SC_L_8KB(const TAGE_SC_L_8KBParams ¶ms)
void handleAllocAndUReset(bool alloc, bool taken, TAGEBase::BranchInfo *bi, int nrand) override
Handles Allocation and U bits reset on an update.
uint16_t gtag(ThreadID tid, Addr pc, int bank) const override
Computes the partial tag of a tagged table.
void initFoldedHistories(ThreadHistory &history) override
Initialization of the folded histories.
int gindex_ext(int index, int bank) const override
void resetUctr(uint8_t &u) override
Algorithm for resetting a single U counter.
void handleTAGEUpdate(Addr branch_pc, bool taken, TAGEBase::BranchInfo *bi) override
Handles the update of the TAGE entries.
int calcDep(TAGEBase::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.
void handleUReset() override
Handles the U bits reset.
std::enable_if_t< std::is_integral_v< T >, T > random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
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.
void init(int original_length, int compressed_length)
FoldedHistory * computeIndices
FoldedHistory * computeTags[2]