47 #ifndef __CPU_PRED_BPRED_UNIT_HH__
48 #define __CPU_PRED_BPRED_UNIT_HH__
59 #include "params/BranchPredictor.hh"
70 typedef BranchPredictorParams
Params;
181 void *bp_history,
bool squashed) = 0;
202 bool pred_taken,
void *bp_history,
338 #endif // __CPU_PRED_BPRED_UNIT_HH__
IndirectPredictor iPred
The indirect target predictor.
Stats::Scalar indirectHits
Stat for the number of indirect target hits.
Stats::Scalar BTBHits
Stat for number of BTB hits.
ThreadID tid
The thread id.
bool operator==(const PredictorHistory &entry) const
Stats::Scalar usedRAS
Stat for number of times the RAS is used to get a target.
bool wasReturn
Whether or not the instruction was a return.
BranchPredictorParams Params
std::vector< History > predHist
The per-thread predictor history.
void update(const InstSeqNum &done_sn, ThreadID tid)
Tells the branch predictor to commit any updates until the given sequence number. ...
Stats::Scalar condIncorrect
Stat for number of conditional branches predicted incorrectly.
Stats::Scalar BTBCorrect
Stat for number of times the BTB is correct.
void * bpHistory
Pointer to the history object passed back from the branch predictor.
const bool useIndirect
Option to disable indirect predictor.
Declaration of Statistics objects.
bool BTBValid(Addr instPC)
Looks up a given PC in the BTB to see if a matching entry exists.
This is a simple scalar statistic, like a counter.
TheISA::PCState RASTarget
The RAS target (only valid if a return).
void regProbePoints() override
Register probe points for this object.
PredictorHistory(const InstSeqNum &seq_num, Addr instPC, bool pred_taken, void *bp_history, ThreadID _tid)
Makes a predictor history struct that contains any information needed to update the predictor...
bool usedRAS
Whether or not the RAS was used.
void drainSanityCheck() const
Perform sanity checks after a drain.
unsigned RASIndex
The RAS index of the instruction (only valid if a call).
TheISA::PCState BTBLookup(Addr instPC)
Looks up a given PC in the BTB to get the predicted target.
Stats::Formula BTBHitPct
Stat for percent times an entry in BTB found.
Stats::Scalar indirectMisses
Stat for the number of indirect target misses.
std::unique_ptr< PMU > PMUUPtr
virtual void uncondBranch(ThreadID tid, Addr pc, void *&bp_history)=0
Stats::Scalar condPredicted
Stat for number of conditional branches predicted.
std::deque< PredictorHistory > History
virtual void btbUpdate(ThreadID tid, Addr instPC, void *&bp_history)=0
If a branch is not taken, because the BTB address is invalid or missing, this function sets the appro...
Stats::Scalar BTBLookups
Stat for number of BTB lookups.
bool predict(const StaticInstPtr &inst, const InstSeqNum &seqNum, TheISA::PCState &pc, ThreadID tid)
Predicts whether or not the instruction is a taken branch, and the target of the branch if it is take...
ProbePoints::PMUUPtr pmuProbePoint(const char *name)
Helper method to instantiate probe points belonging to this object.
void update(Addr instPC, const TheISA::PCState &targetPC, ThreadID tid)
Updates the BTB with the target of a branch.
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
TheISA::PCState lookup(Addr instPC, ThreadID tid)
Looks up an address in the BTB.
ProbePoints::PMUUPtr ppMisses
Miss-predicted branches.
void regStats() override
Registers statistics.
bool wasIndirect
Wether this instruction was an indirect branch.
virtual bool lookup(ThreadID tid, Addr instPC, void *&bp_history)=0
Looks up a given PC in the BP to see if it is taken or not taken.
std::vector< ReturnAddrStack > RAS
The per-thread return address stack.
Stats::Scalar RASIncorrect
Stat for number of times the RAS is incorrect.
Basically a wrapper class to hold both the branch predictor and the BTB.
int16_t ThreadID
Thread index/ID type.
Addr pc
The PC associated with the sequence number.
InstSeqNum seqNum
The sequence number for the predictor history entry.
virtual const std::string name() const
bool predTaken
Whether or not it was predicted taken.
bool valid(Addr instPC, ThreadID tid)
Checks if a branch is in the BTB.
GenericISA::SimplePCState< MachInst > PCState
Stats::Scalar indirectMispredicted
Stat for the number of indirect target mispredictions.
BPredUnit(const Params *p)
const unsigned instShiftAmt
Number of bits to shift instructions by for predictor addresses.
void squash(const InstSeqNum &squashed_sn, ThreadID tid)
Squashes all outstanding updates until a given sequence number.
const unsigned numThreads
Number of the threads for which the branch history is maintained.
bool wasCall
Whether or not the instruction was a call.
Stats::Scalar indirectLookups
Stat for the number of indirect target lookups.
virtual unsigned getGHR(ThreadID tid, void *bp_history) const
ProbePoints::PMUUPtr ppBranches
Branches seen by the branch predictor.
Abstract superclass for simulation objects.
Stats::Scalar lookups
Stat for number of BP lookups.
void BTBUpdate(Addr instPC, const TheISA::PCState &target)
Updates the BTB with the target of a branch.