45#include "debug/TageSCL.hh"
54 const TAGE_SC_L_8KB_StatisticalCorrectorParams &
p)
67 sh->setNumOrdinalHistories(1);
78 return (
bi->predBeforeSC
79 + (((hitBank + 1) / 4) << 4)
82 + ((altBank != 0) << 3))
98 branch_pc,
bi->localHistories[1],
lm,
117 bool taken,
Addr target,
128 sh->globalHist = (
sh->globalHist << 1) + taken;
141 bi->globalHist =
sh->globalHist;
151 sh->globalHist =
bi->globalHist;
183 DPRINTF(TageSCL,
"HistLength:%d, TTSize:%d, TTTWidth:%d\n",
199 int tag = (
threadHistory[tid].computeIndices[bank - 1].comp << 2)
200 ^ shifted_pc ^ (shifted_pc >> 2) ^
205 tag = (tag >> 1) ^ ((tag & 1) << 10) ^
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;
237 ((
rng->random<
int>() & 31) == 0);
240 gtable[
i][
bi->tableIndices[
i]].ctr = taken ? 0 : -1;
244 maxAllocReached =
true;
249 int8_t ctr =
gtable[
i][
bi->tableIndices[
i]].ctr;
251 (abs (2 * ctr + 1) == 1)) {
252 if ((
rng->random<
int>() & 7) == 0) {
264 if (maxAllocReached) {
269 tCounter += (truePen + penalty - 5 * numAllocated);
287 if (
bi->hitBank > 0) {
288 if (abs (2 *
gtable[
bi->hitBank][
bi->hitBankIndex].ctr + 1) == 1) {
289 if (
bi->longestMatchPred != taken) {
290 if (
bi->altBank > 0) {
291 int8_t ctr =
gtable[
bi->altBank][
bi->altBankIndex].ctr;
292 if (abs (2 * ctr + 1) == 1) {
299 ctr =
gtable[
bi->altBank][
bi->altBankIndex].ctr;
300 if (abs (2 * ctr + 1) == 1) {
304 if (
bi->altBank == 0) {
311 if (abs (2 *
gtable[
bi->hitBank][
bi->hitBankIndex].ctr + 1) == 1) {
319 if (abs (2 *
gtable[
bi->hitBank][
bi->hitBankIndex].ctr + 1) == 1) {
323 if (
bi->altTaken == taken) {
324 if (
bi->altBank > 0) {
325 int8_t ctr =
gtable[
bi->altBank][
bi->altBankIndex].ctr;
326 if (abs (2*ctr + 1) == 7) {
327 if (
gtable[
bi->hitBank][
bi->hitBankIndex].u == 1) {
328 if (
bi->longestMatchPred == taken) {
339 if ((
bi->longestMatchPred !=
bi->altTaken) &&
340 (
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
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
void scRecordHistState(Addr branch_pc, BranchInfo *bi) override
std::vector< int8_t > * ggehl
TAGE_SC_L_8KB_StatisticalCorrector(const TAGE_SC_L_8KB_StatisticalCorrectorParams &p)
unsigned getIndBiasBank(Addr branch_pc, BranchInfo *bi, int hitBank, int altBank) const override
int gPredictions(ThreadID tid, Addr branch_pc, BranchInfo *bi, int &lsum) override
SCThreadHistory * makeThreadHistory() override
void scHistoryUpdate(Addr branch_pc, const StaticInstPtr &inst, bool taken, Addr target, int64_t phist) override
void gUpdates(ThreadID tid, Addr pc, bool taken, BranchInfo *bi) override
bool scRestoreHistState(BranchInfo *bi) 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.
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
void init(int original_length, int compressed_length)
FoldedHistory * computeIndices
FoldedHistory * computeTags[2]