56#include "debug/Fetch.hh"
57#include "debug/LTage.hh"
62namespace branch_prediction
66 :
TAGE(params), loopPredictor(params.loop_predictor)
87 bi->lpBranchInfo, pred_taken,
90 if (
bi->lpBranchInfo->loopPredUsed) {
91 bi->tageBranchInfo->provider =
LOOP;
93 DPRINTF(LTage,
"Predict for %lx: taken?:%d, loopTaken?:%d, "
94 "loopValid?:%d, loopUseCounter:%d, tagePred:%d, altPred:%d\n",
95 branch_pc, pred_taken,
bi->lpBranchInfo->loopPred,
96 bi->lpBranchInfo->loopPredValid,
98 bi->tageBranchInfo->tagePred,
bi->tageBranchInfo->altTaken);
102 bi->lpBranchInfo->predTaken = pred_taken;
122 if (
bi->tageBranchInfo->condBranch) {
130 if (
bi->tageBranchInfo->condBranch) {
131 DPRINTF(LTage,
"Updating tables for branch:%lx; taken?:%d\n",
141 nrand, target,
bi->lpBranchInfo->predTaken);
148 bp_history =
nullptr;
156 if (
bi->tageBranchInfo->condBranch) {
const unsigned instShiftAmt
Number of bits to shift instructions by for predictor addresses.
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.
LTAGE(const LTAGEParams ¶ms)
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
bool predict(ThreadID tid, Addr branch_pc, bool cond_branch, void *&b) override
Get a branch prediction from LTAGE.
LoopPredictor * loopPredictor
The loop predictor object.
void squash(ThreadID tid, void *&bp_history) override
void updateStats(bool taken, BranchInfo *bi)
Update the stats.
void condBranchUpdate(ThreadID tid, Addr branch_pc, bool taken, bool tage_pred, BranchInfo *bi, unsigned instShiftAmt)
Update LTAGE for conditional branches.
void squashLoop(BranchInfo *bi)
int8_t getLoopUseCounter() const
Gets the value of the loop use counter.
bool loopPredict(ThreadID tid, Addr branch_pc, bool cond_branch, BranchInfo *bi, bool prev_pred_taken, unsigned instShiftAmt)
Get the loop prediction.
void squash(ThreadID tid, BranchInfo *bi)
virtual void updateHistories(ThreadID tid, Addr branch_pc, bool taken, BranchInfo *b, bool speculative, const StaticInstPtr &inst=nullStaticInstPtr, Addr target=MaxAddr)
(Speculatively) updates global histories (path and direction).
bool isSpeculativeUpdateEnabled() const
virtual void updateStats(bool taken, BranchInfo *bi)
Update the stats.
virtual void squash(ThreadID tid, bool taken, BranchInfo *bi, Addr target)
Restores speculatively updated path and direction histories.
bool tagePredict(ThreadID tid, Addr branch_pc, bool cond_branch, BranchInfo *bi)
TAGE prediction called from TAGE::predict.
virtual void condBranchUpdate(ThreadID tid, Addr branch_pc, bool taken, BranchInfo *bi, int nrand, Addr corrTarget, bool pred, bool preAdjustAlloc=false)
Update TAGE for conditional branches.
virtual void squash(ThreadID tid, void *&bp_history) override
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...
virtual void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
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.