gem5 v25.0.0.1
Loading...
Searching...
No Matches
gem5::branch_prediction::BPredUnit::PredictorHistory Struct Reference

Branch Predictor Unit (BPU) history object PredictorHistory This class holds all information needed to manage the speculative state of a in-flight branch prediction. More...

Public Member Functions

 PredictorHistory (ThreadID _tid, InstSeqNum sn, Addr _pc, const StaticInstPtr &inst)
 Makes a predictor history struct that contains any information needed to update the predictor, BTB, and RAS.
 ~PredictorHistory ()
 PredictorHistory (const PredictorHistory &)=delete
PredictorHistoryoperator= (const PredictorHistory &)=delete
bool operator== (const PredictorHistory &entry) const

Public Attributes

const InstSeqNum seqNum
 The sequence number for the predictor history entry.
const ThreadID tid
 The thread id.
const Addr pc
 The PC associated with the sequence number.
const StaticInstPtr inst
 The branch instrction.
const BranchType type
 The type of the branch.
const bool call
 Whether or not the instruction was a call.
const bool uncond
 Was unconditional control.
bool predTaken
 Whether or not it was predicted taken.
bool actuallyTaken
 To record the actual outcome of the branch.
bool condPred
 The prediction of the conditional predictor.
bool btbHit
 Was BTB hit at prediction time.
TargetProvider targetProvider
 Which component provided the target.
bool resteered
 Resteered.
bool mispredict
 The branch was corrected hence was mispredicted.
std::unique_ptr< PCStateBasetarget
 The predicted target.
void * bpHistory = nullptr
 Pointer to the history objects passed back from the branch predictor subcomponents.
void * indirectHistory = nullptr
void * rasHistory = nullptr

Detailed Description

Branch Predictor Unit (BPU) history object PredictorHistory This class holds all information needed to manage the speculative state of a in-flight branch prediction.

In case of the default (coupled/synchronous) front-end, the branch predictor is queried whenever the a branch is decoded by the fetch unit. In case of the decoupled front-end, the branch predictor is queried whenever a branch is detected using the BTB.

Lifetime of a PredictorHistory (coupled front-end):

  • ----------------------------------------— + | FETCH: | | - The fetch unit pre-decodes a branch. | | - The BPU is queried to make a prediction | | using the predict function | | - A PredictorHistory object is created. |
  • ----------------------------------------— + | |
  • ----------------------------------------— + | DECODE: | | - The branch is decoded and the target for | | direct branches is available. |
  • ----------------------------------------— + | ( target correct ? ) -------------—+ | | +----------------------------------—+ | | Squash all predictions made AFTER | | | this branch using squashHistories.| | | Will revert all speculative history | | | updates and delete the history | | | history updates of those branches. | | | It also corrects the target of the | | | mispredicted branch using the | | | squash function. | | +----------------------------------—+ | | | | <----------------------—+ |

-----------------------------------------—+ | COMMIT: | | - The branch is resolved and the correct | | branch direction and target is known. |

  • -----------------------------------------—+ | ( prediction correct ? ) -------------—+ | | +----------------------------------—+ | | Squash all predictions made AFTER | | | this branch using squashHistories.| | | Will revert all speculative history | | | updates and delete the history | | | history updates of those branches. | | | It also corrects the target and | | | the direction of the mispredicted | | | branch using the squash function. | | +----------------------------------—+ | | | | <----------------------—+ | +----------------------------------—+ | Update the internal state (counter) | | of the BPU using the update | | function. | +----------------------------------—+

Definition at line 341 of file bpred_unit.hh.

Constructor & Destructor Documentation

◆ PredictorHistory() [1/2]

gem5::branch_prediction::BPredUnit::PredictorHistory::PredictorHistory ( ThreadID _tid,
InstSeqNum sn,
Addr _pc,
const StaticInstPtr & inst )
inline

Makes a predictor history struct that contains any information needed to update the predictor, BTB, and RAS.

Definition at line 347 of file bpred_unit.hh.

References actuallyTaken, bpHistory, btbHit, call, condPred, gem5::branch_prediction::getBranchType(), indirectHistory, inst, mispredict, pc, predTaken, rasHistory, resteered, seqNum, target, targetProvider, tid, type, and uncond.

Referenced by operator=(), operator==(), and PredictorHistory().

◆ ~PredictorHistory()

gem5::branch_prediction::BPredUnit::PredictorHistory::~PredictorHistory ( )
inline

Definition at line 359 of file bpred_unit.hh.

References bpHistory, indirectHistory, and rasHistory.

◆ PredictorHistory() [2/2]

gem5::branch_prediction::BPredUnit::PredictorHistory::PredictorHistory ( const PredictorHistory & )
delete

References PredictorHistory().

Member Function Documentation

◆ operator=()

PredictorHistory & gem5::branch_prediction::BPredUnit::PredictorHistory::operator= ( const PredictorHistory & )
delete

References PredictorHistory().

◆ operator==()

bool gem5::branch_prediction::BPredUnit::PredictorHistory::operator== ( const PredictorHistory & entry) const
inline

Definition at line 370 of file bpred_unit.hh.

References PredictorHistory(), and seqNum.

Member Data Documentation

◆ actuallyTaken

bool gem5::branch_prediction::BPredUnit::PredictorHistory::actuallyTaken

◆ bpHistory

void* gem5::branch_prediction::BPredUnit::PredictorHistory::bpHistory = nullptr

Pointer to the history objects passed back from the branch predictor subcomponents.

It is used to update or restore state. Respectively for conditional, indirect and RAS.

Definition at line 426 of file bpred_unit.hh.

Referenced by gem5::branch_prediction::BPredUnit::commitBranch(), gem5::branch_prediction::BPredUnit::predict(), PredictorHistory(), gem5::branch_prediction::BPredUnit::squash(), gem5::branch_prediction::BPredUnit::squashHistory(), and ~PredictorHistory().

◆ btbHit

bool gem5::branch_prediction::BPredUnit::PredictorHistory::btbHit

◆ call

const bool gem5::branch_prediction::BPredUnit::PredictorHistory::call

Whether or not the instruction was a call.

Definition at line 391 of file bpred_unit.hh.

Referenced by PredictorHistory(), and gem5::branch_prediction::BPredUnit::squash().

◆ condPred

bool gem5::branch_prediction::BPredUnit::PredictorHistory::condPred

The prediction of the conditional predictor.

Definition at line 403 of file bpred_unit.hh.

Referenced by gem5::branch_prediction::BPredUnit::predict(), PredictorHistory(), and gem5::branch_prediction::BPredUnit::squash().

◆ indirectHistory

◆ inst

const StaticInstPtr gem5::branch_prediction::BPredUnit::PredictorHistory::inst

◆ mispredict

bool gem5::branch_prediction::BPredUnit::PredictorHistory::mispredict

The branch was corrected hence was mispredicted.

Definition at line 415 of file bpred_unit.hh.

Referenced by gem5::branch_prediction::BPredUnit::commitBranch(), PredictorHistory(), and gem5::branch_prediction::BPredUnit::squash().

◆ pc

const Addr gem5::branch_prediction::BPredUnit::PredictorHistory::pc

◆ predTaken

bool gem5::branch_prediction::BPredUnit::PredictorHistory::predTaken

Whether or not it was predicted taken.

Definition at line 397 of file bpred_unit.hh.

Referenced by gem5::branch_prediction::BPredUnit::commitBranch(), gem5::branch_prediction::BPredUnit::predict(), and PredictorHistory().

◆ rasHistory

◆ resteered

bool gem5::branch_prediction::BPredUnit::PredictorHistory::resteered

Resteered.

Definition at line 412 of file bpred_unit.hh.

Referenced by PredictorHistory().

◆ seqNum

const InstSeqNum gem5::branch_prediction::BPredUnit::PredictorHistory::seqNum

◆ target

std::unique_ptr<PCStateBase> gem5::branch_prediction::BPredUnit::PredictorHistory::target

◆ targetProvider

TargetProvider gem5::branch_prediction::BPredUnit::PredictorHistory::targetProvider

Which component provided the target.

Definition at line 409 of file bpred_unit.hh.

Referenced by gem5::branch_prediction::BPredUnit::predict(), PredictorHistory(), and gem5::branch_prediction::BPredUnit::squash().

◆ tid

const ThreadID gem5::branch_prediction::BPredUnit::PredictorHistory::tid

The thread id.

Definition at line 379 of file bpred_unit.hh.

Referenced by PredictorHistory().

◆ type

const BranchType gem5::branch_prediction::BPredUnit::PredictorHistory::type

◆ uncond

const bool gem5::branch_prediction::BPredUnit::PredictorHistory::uncond

Was unconditional control.

Definition at line 394 of file bpred_unit.hh.

Referenced by gem5::branch_prediction::BPredUnit::predict(), and PredictorHistory().


The documentation for this struct was generated from the following file:

Generated on Sat Oct 18 2025 08:06:58 for gem5 by doxygen 1.14.0