42#ifndef __CPU_PRED_BPRED_UNIT_HH__
43#define __CPU_PRED_BPRED_UNIT_HH__
56#include "enums/TargetProvider.hh"
57#include "params/BranchPredictor.hh"
73 typedef BranchPredictorParams
Params;
128 bool actually_taken,
ThreadID tid,
bool from_commit=
true);
138 return btb->valid(tid,
pc);
152 return btb->lookup(tid,
pc.instAddr());
168 return btb->getInst(tid,
pc);
181 return btb->update(tid,
pc, target);
200 bool uncond,
void * &bp_history);
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
const StaticInstPtr BTBGetInst(ThreadID tid, Addr pc)
Looks up a given PC in the BTB to get current static instruction information.
std::vector< std::deque< PredictorHistory * > > predHist
The per-thread predictor history.
probing::PMUUPtr pmuProbePoint(const char *name)
Helper method to instantiate probe points belonging to this object.
void update(const InstSeqNum &done_sn, ThreadID tid)
Tells the branch predictor to commit any updates until the given sequence number.
BPredUnit(const Params &p)
Branch Predictor Unit (BPU) interface functions.
bool predict(const StaticInstPtr &inst, const InstSeqNum &seqNum, PCStateBase &pc, ThreadID tid)
Predicts whether or not the instruction is a taken branch, and the target of the branch if it is take...
ConditionalPredictor * cPred
The conditional branch predictor.
void branchPlaceholder(ThreadID tid, Addr pc, bool uncond, void *&bp_history)
Special function for the decoupled front-end.
void BTBUpdate(ThreadID tid, Addr pc, const PCStateBase &target)
Updates the BTB with the target of a branch.
probing::PMUUPtr ppMisses
Miss-predicted branches.
const bool requiresBTBHit
Requires the BTB to hit for returns and indirect branches.
void drainSanityCheck() const
Perform sanity checks after a drain.
IndirectPredictor * iPred
The indirect target predictor.
const PCStateBase * BTBLookup(ThreadID tid, PCStateBase &pc)
Looks up a given PC in the BTB to get the predicted target.
void commitBranch(ThreadID tid, PredictorHistory *&bpu_history)
Commit a particular branch.
probing::PMUUPtr ppBranches
Branches seen by the branch predictor.
void regProbePoints() override
Register probe points for this object.
enums::TargetProvider TargetProvider
void insertPredictorHistory(ThreadID tid, PredictorHistory *&bpu_history)
Pushes a PredictorHistory object into the branch predictor history queue.
const unsigned numThreads
Number of the threads for which the branch history is maintained.
const unsigned instShiftAmt
Number of bits to shift instructions by for predictor addresses.
BranchPredictorParams Params
void squashHistory(ThreadID tid, PredictorHistory *&bpu_history)
Squashes a particular branch instance.
const bool updateBTBAtSquash
Update the BTB at squash time instead of commit.
ReturnAddrStack * ras
The return address stack.
void squash(const InstSeqNum &squashed_sn, ThreadID tid)
Squashes all outstanding updates until a given sequence number.
gem5::branch_prediction::BPredUnit::BPredUnitStats stats
BranchTargetBuffer * btb
The BTB.
void updateBTB(ThreadID tid, PredictorHistory *&bpu_history)
Update the BTB with the correct target of a branch.
bool BTBValid(ThreadID tid, Addr pc)
Looks up a given PC in the BTB to see if a matching entry exists.
Return address stack class, implements a simple RAS.
This is a simple scalar statistic, like a counter.
A 2-Dimensional vecto of scalar stats.
SimObject(const Params &p)
BranchType getBranchType(StaticInstPtr inst)
enums::BranchType BranchType
std::unique_ptr< PMU > PMUUPtr
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
Declaration of Statistics objects.
statistics::Vector2d corrected
statistics::Scalar BTBUpdates
statistics::Scalar indirectMispredicted
statistics::Scalar BTBLookups
BTB stats.
statistics::Scalar condIncorrect
statistics::Vector2d squashes
statistics::Vector2d committed
statistics::Scalar BTBMispredicted
statistics::Scalar indirectLookups
Indirect stats.
statistics::Vector2d lookups
Stats per branch type.
statistics::Scalar indirectHits
statistics::Vector2d targetProvider
Target prediction per branch type.
statistics::Scalar condPredictedTaken
statistics::Scalar condPredicted
Additional scalar stats for conditional branches.
statistics::Vector2d mispredictDueToBTBMiss
statistics::Vector2d mispredicted
statistics::Vector2d earlyResteers
BPredUnitStats(BPredUnit *bp)
statistics::Formula BTBHitRatio
statistics::Scalar predTakenBTBMiss
statistics::Scalar indirectMisses
statistics::Vector2d targetWrong
statistics::Scalar BTBHits
statistics::Vector2d mispredictDueToPredictor
Branch Predictor Unit (BPU) history object PredictorHistory This class holds all information needed t...
InstSeqNum seqNum
The sequence number for the predictor history entry.
bool predTaken
Whether or not it was predicted taken.
bool condPred
The prediction of the conditional predictor.
void * bpHistory
Pointer to the history objects passed back from the branch predictor subcomponents.
const Addr pc
The PC associated with the sequence number.
const bool call
Whether or not the instruction was a call.
PredictorHistory & operator=(const PredictorHistory &)=delete
const ThreadID tid
The thread id.
bool operator==(const PredictorHistory &entry) const
PredictorHistory(const PredictorHistory &)=delete
const StaticInstPtr inst
The branch instrction.
bool actuallyTaken
To record the actual outcome of the branch.
bool mispredict
The branch was corrected hence was mispredicted.
PredictorHistory(ThreadID _tid, InstSeqNum sn, Addr _pc, const StaticInstPtr &inst)
Makes a predictor history struct that contains any information needed to update the predictor,...
const bool uncond
Was unconditional control.
const BranchType type
The type of the branch.
bool btbHit
Was BTB hit at prediction time.
std::unique_ptr< PCStateBase > target
The predicted target.
TargetProvider targetProvider
Which component provided the target.
const std::string & name()