55#include "debug/Fetch.hh"
56#include "debug/LTage.hh"
77 bool uncond,
void * &bpHistory)
81 bpHistory = (
void*)(
bi);
89 branch_pc, cond_branch);
92 bool pred_taken =
tage->tagePredict(tid, branch_pc, cond_branch,
95 pred_taken =
loopPredictor->loopPredict(tid, branch_pc, cond_branch,
96 bi->lpBranchInfo, pred_taken,
99 if (
bi->lpBranchInfo->loopPredUsed) {
100 bi->tageBranchInfo->provider =
LOOP;
102 DPRINTF(LTage,
"Predict for %lx: taken?:%d, loopTaken?:%d, "
103 "loopValid?:%d, loopUseCounter:%d, tagePred:%d, altPred:%d\n",
104 branch_pc, pred_taken,
bi->lpBranchInfo->loopPred,
105 bi->lpBranchInfo->loopPredValid,
107 bi->tageBranchInfo->tagePred,
bi->tageBranchInfo->altTaken);
111 bi->lpBranchInfo->predTaken = pred_taken;
126 if (
tage->isSpeculativeUpdateEnabled()) {
129 tage->squash(tid, taken, target, inst,
bi->tageBranchInfo);
131 if (
bi->tageBranchInfo->condBranch) {
138 int nrand =
rng->random<
int>() & 3;
139 if (
bi->tageBranchInfo->condBranch) {
140 DPRINTF(LTage,
"Updating tables for branch:%lx; taken?:%d\n",
142 tage->updateStats(taken,
bi->tageBranchInfo);
149 tage->condBranchUpdate(tid,
pc, taken,
bi->tageBranchInfo,
150 nrand, target,
bi->lpBranchInfo->predTaken);
153 tage->updateHistories(tid,
pc,
false, taken, target,
154 inst,
bi->tageBranchInfo);
157 bp_history =
nullptr;
165 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.
void branchPlaceholder(ThreadID tid, Addr pc, bool uncond, void *&bp_history) override
Special function for the decoupled front-end.
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
TAGE(const TAGEParams ¶ms)
void squash(ThreadID tid, void *&bp_history) override
const Params & params() const
virtual void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
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