| 
    gem5
    
   | 
 
#include <ltage.hh>
  
 Classes | |
| struct | BimodalEntry | 
| struct | BranchInfo | 
| struct | FoldedHistory | 
| struct | LoopEntry | 
| struct | TageEntry | 
| struct | ThreadHistory | 
Public Member Functions | |
| LTAGE (const LTAGEParams *params) | |
| void | uncondBranch (ThreadID tid, Addr br_pc, void *&bp_history) override | 
| bool | lookup (ThreadID tid, Addr branch_addr, void *&bp_history) override | 
| Looks up a given PC in the BP to see if it is taken or not taken.  More... | |
| void | btbUpdate (ThreadID tid, Addr branch_addr, void *&bp_history) override | 
| If a branch is not taken, because the BTB address is invalid or missing, this function sets the appropriate counter in the global and local predictors to not taken.  More... | |
| void | update (ThreadID tid, Addr branch_addr, bool taken, void *bp_history, bool squashed) override | 
| Updates the BP with taken/not taken information.  More... | |
| void | squash (ThreadID tid, void *bp_history) override | 
| unsigned | getGHR (ThreadID tid, void *bp_history) const override | 
  Public Member Functions inherited from BPredUnit | |
| BPredUnit (const Params *p) | |
| void | regStats () override | 
| Registers statistics.  More... | |
| void | regProbePoints () override | 
| Register probe points for this object.  More... | |
| void | drainSanityCheck () const | 
| Perform sanity checks after a drain.  More... | |
| 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 taken.  More... | |
| void | update (const InstSeqNum &done_sn, ThreadID tid) | 
| Tells the branch predictor to commit any updates until the given sequence number.  More... | |
| void | squash (const InstSeqNum &squashed_sn, ThreadID tid) | 
| Squashes all outstanding updates until a given sequence number.  More... | |
| void | squash (const InstSeqNum &squashed_sn, const TheISA::PCState &corr_target, bool actually_taken, ThreadID tid) | 
| Squashes all outstanding updates until a given sequence number, and corrects that sn's update with the proper address and taken/not taken.  More... | |
| bool | BTBValid (Addr instPC) | 
| Looks up a given PC in the BTB to see if a matching entry exists.  More... | |
| TheISA::PCState | BTBLookup (Addr instPC) | 
| Looks up a given PC in the BTB to get the predicted target.  More... | |
| void | BTBUpdate (Addr instPC, const TheISA::PCState &target) | 
| Updates the BTB with the target of a branch.  More... | |
| void | dump () | 
  Public Member Functions inherited from SimObject | |
| const Params * | params () const | 
| SimObject (const Params *_params) | |
| virtual | ~SimObject () | 
| virtual const std::string | name () const | 
| virtual void | init () | 
| init() is called after all C++ SimObjects have been created and all ports are connected.  More... | |
| virtual void | loadState (CheckpointIn &cp) | 
| loadState() is called on each SimObject when restoring from a checkpoint.  More... | |
| virtual void | initState () | 
| initState() is called on each SimObject when not restoring from a checkpoint.  More... | |
| virtual void | resetStats () | 
| Reset statistics associated with this object.  More... | |
| virtual void | regProbeListeners () | 
| Register probe listeners for this object.  More... | |
| ProbeManager * | getProbeManager () | 
| Get the probe manager for this object.  More... | |
| virtual void | startup () | 
| startup() is the final initialization call before simulation.  More... | |
| DrainState | drain () override | 
| Provide a default implementation of the drain interface for objects that don't need draining.  More... | |
| virtual void | memWriteback () | 
| Write back dirty buffers to memory using functional writes.  More... | |
| virtual void | memInvalidate () | 
| Invalidate the contents of memory buffers.  More... | |
| void | serialize (CheckpointOut &cp) const override | 
| Serialize an object.  More... | |
| void | unserialize (CheckpointIn &cp) override | 
| Unserialize an object.  More... | |
  Public Member Functions inherited from EventManager | |
| EventManager (EventManager &em) | |
| EventManager (EventManager *em) | |
| EventManager (EventQueue *eq) | |
| EventQueue * | eventQueue () const | 
| void | schedule (Event &event, Tick when) | 
| void | deschedule (Event &event) | 
| void | reschedule (Event &event, Tick when, bool always=false) | 
| void | schedule (Event *event, Tick when) | 
| void | deschedule (Event *event) | 
| void | reschedule (Event *event, Tick when, bool always=false) | 
| void | wakeupEventQueue (Tick when=(Tick)-1) | 
| void | setCurTick (Tick newVal) | 
  Public Member Functions inherited from Serializable | |
| Serializable () | |
| virtual | ~Serializable () | 
| void | serializeSection (CheckpointOut &cp, const char *name) const | 
| Serialize an object into a new section.  More... | |
| void | serializeSection (CheckpointOut &cp, const std::string &name) const | 
| void | unserializeSection (CheckpointIn &cp, const char *name) | 
| Unserialize an a child object.  More... | |
| void | unserializeSection (CheckpointIn &cp, const std::string &name) | 
  Public Member Functions inherited from Drainable | |
| DrainState | drainState () const | 
| Return the current drain state of an object.  More... | |
| virtual void | notifyFork () | 
| Notify a child process of a fork.  More... | |
Private Member Functions | |
| int | bindex (Addr pc_in) const | 
| Computes the index used to access the bimodal table.  More... | |
| int | lindex (Addr pc_in) const | 
| Computes the index used to access the loop predictor.  More... | |
| int | gindex (ThreadID tid, Addr pc, int bank) const | 
| Computes the index used to access a partially tagged table.  More... | |
| int | F (int phist, int size, int bank) const | 
| Utility function to shuffle the path history depending on which tagged table we are accessing.  More... | |
| uint16_t | gtag (ThreadID tid, Addr pc, int bank) const | 
| Computes the partial tag of a tagged table.  More... | |
| void | ctrUpdate (int8_t &ctr, bool taken, int nbits) | 
| Updates a direction counter based on the actual branch outcome.  More... | |
| bool | getBimodePred (Addr pc, BranchInfo *bi) const | 
| Get a branch prediction from the bimodal predictor.  More... | |
| void | baseUpdate (Addr pc, bool taken, BranchInfo *bi) | 
| Updates the bimodal predictor.  More... | |
| bool | getLoop (Addr pc, BranchInfo *bi) const | 
| Get a branch prediction from the loop predictor.  More... | |
| void | loopUpdate (Addr pc, bool Taken, BranchInfo *bi) | 
| Updates the loop predictor.  More... | |
| void | updateGHist (uint8_t *&h, bool dir, uint8_t *tab, int &PT) | 
| (Speculatively) updates the global branch history.  More... | |
| bool | predict (ThreadID tid, Addr branch_pc, bool cond_branch, void *&b) | 
| Get a branch prediction from L-TAGE.  More... | |
| void | update (ThreadID tid, Addr branch_pc, bool taken, BranchInfo *bi) | 
| Update L-TAGE.  More... | |
| void | updateHistories (ThreadID tid, Addr branch_pc, bool taken, void *b) | 
| (Speculatively) updates global histories (path and direction).  More... | |
| void | squash (ThreadID tid, bool taken, void *bp_history) | 
| Restores speculatively updated path and direction histories.  More... | |
| void | specLoopUpdate (Addr pc, bool taken, BranchInfo *bi) | 
| Speculatively updates the loop predictor iteration count.  More... | |
Private Attributes | |
| const unsigned | logSizeBiMP | 
| const unsigned | logSizeTagTables | 
| const unsigned | logSizeLoopPred | 
| const unsigned | nHistoryTables | 
| const unsigned | tagTableCounterBits | 
| const unsigned | histBufferSize | 
| const unsigned | minHist | 
| const unsigned | maxHist | 
| const unsigned | minTagWidth | 
| BimodalEntry * | btable | 
| TageEntry ** | gtable | 
| LoopEntry * | ltable | 
| std::vector< ThreadHistory > | threadHistory | 
| int | tagWidths [15] | 
| int | tagTableSizes [15] | 
| int * | histLengths | 
| int * | tableIndices | 
| int * | tableTags | 
| int8_t | loopUseCounter | 
| int8_t | useAltPredForNewlyAllocated | 
| int | tCounter | 
| int | logTick | 
Additional Inherited Members | |
  Public Types inherited from BPredUnit | |
| typedef BranchPredictorParams | Params | 
  Public Types inherited from SimObject | |
| typedef SimObjectParams | Params | 
  Static Public Member Functions inherited from SimObject | |
| static void | serializeAll (CheckpointOut &cp) | 
| Serialize all SimObjects in the system.  More... | |
| static SimObject * | find (const char *name) | 
| Find the SimObject with the given name and return a pointer to it.  More... | |
  Static Public Member Functions inherited from Serializable | |
| static const std::string & | currentSection () | 
| Get the fully-qualified name of the active section.  More... | |
| static void | serializeAll (const std::string &cpt_dir) | 
| static void | unserializeGlobals (CheckpointIn &cp) | 
  Static Public Attributes inherited from Serializable | |
| static int | ckptCount = 0 | 
| static int | ckptMaxCount = 0 | 
| static int | ckptPrevCount = -1 | 
  Protected Member Functions inherited from BPredUnit | |
| ProbePoints::PMUUPtr | pmuProbePoint (const char *name) | 
| Helper method to instantiate probe points belonging to this object.  More... | |
  Protected Member Functions inherited from Drainable | |
| Drainable () | |
| virtual | ~Drainable () | 
| virtual void | drainResume () | 
| Resume execution after a successful drain.  More... | |
| void | signalDrainDone () const | 
| Signal that an object is drained.  More... | |
  Protected Attributes inherited from BPredUnit | |
| const unsigned | instShiftAmt | 
| Number of bits to shift instructions by for predictor addresses.  More... | |
| ProbePoints::PMUUPtr | ppBranches | 
| Branches seen by the branch predictor.  More... | |
| ProbePoints::PMUUPtr | ppMisses | 
| Miss-predicted branches.  More... | |
  Protected Attributes inherited from SimObject | |
| const SimObjectParams * | _params | 
| Cached copy of the object parameters.  More... | |
  Protected Attributes inherited from EventManager | |
| EventQueue * | eventq | 
| A pointer to this object's event queue.  More... | |
| LTAGE::LTAGE | ( | const LTAGEParams * | params | ) | 
Definition at line 50 of file ltage.cc.
References btable, DPRINTF, gtable, histBufferSize, histLengths, ArmISA::i, LTAGE::FoldedHistory::init(), logSizeBiMP, logSizeLoopPred, logSizeTagTables, logTick, loopUseCounter, ltable, maxHist, minHist, minTagWidth, nHistoryTables, tableIndices, tableTags, tagTableSizes, tagWidths, tCounter, threadHistory, ULL, and useAltPredForNewlyAllocated.
      
  | 
  private | 
Updates the bimodal predictor.
| pc | The unshifted branch PC. | 
| taken | The actual branch outcome. | 
| bi | Pointer to information on the prediction recorded at prediction time. | 
Definition at line 218 of file ltage.cc.
References LTAGE::BranchInfo::bimodalIndex, btable, DPRINTF, LTAGE::BimodalEntry::hyst, if(), and LTAGE::BimodalEntry::pred.
Referenced by update().
      
  | 
  private | 
Computes the index used to access the bimodal table.
| pc_in | The unshifted branch PC. | 
Definition at line 139 of file ltage.cc.
References logSizeBiMP, and ULL.
Referenced by predict().
If a branch is not taken, because the BTB address is invalid or missing, this function sets the appropriate counter in the global and local predictors to not taken.
| inst_PC | The PC to look up the local predictor. | 
| bp_history | Pointer that will be set to an object that has the branch predictor state associated with the lookup. | 
Implements BPredUnit.
Definition at line 715 of file ltage.cc.
References PowerISA::bi, LTAGE::BranchInfo::ci, LTAGE::FoldedHistory::comp, LTAGE::ThreadHistory::computeIndices, LTAGE::ThreadHistory::computeTags, LTAGE::BranchInfo::ct0, LTAGE::BranchInfo::ct1, DPRINTF, LTAGE::ThreadHistory::gHist, LTAGE::ThreadHistory::globalHistory, ArmISA::i, nHistoryTables, LTAGE::ThreadHistory::ptGhist, threadHistory, and LTAGE::FoldedHistory::update().
      
  | 
  private | 
      
  | 
  private | 
Utility function to shuffle the path history depending on which tagged table we are accessing.
| phist | The path history. | 
| size | Number of path history bits to use. | 
| bank | The partially tagged table to access. | 
Definition at line 151 of file ltage.cc.
References X86ISA::size(), tagTableSizes, and ULL.
Referenced by gindex().
      
  | 
  private | 
Get a branch prediction from the bimodal predictor.
| pc | The unshifted branch PC. | 
| bi | Pointer to information on the prediction. | 
Definition at line 209 of file ltage.cc.
References LTAGE::BranchInfo::bimodalIndex, btable, and LTAGE::BimodalEntry::pred.
Referenced by predict().
      
  | 
  overridevirtual | 
Reimplemented from BPredUnit.
Definition at line 386 of file ltage.cc.
References PowerISA::bi, histBufferSize, ArmISA::i, LTAGE::BranchInfo::ptGhist, threadHistory, and X86ISA::val.
      
  | 
  private | 
Get a branch prediction from the loop predictor.
| pc | The unshifted branch PC. | 
| bi | Pointer to information on the prediction. | 
Definition at line 237 of file ltage.cc.
References LTAGE::LoopEntry::confidence, LTAGE::BranchInfo::currentIter, LTAGE::LoopEntry::currentIterSpec, LTAGE::LoopEntry::dir, ArmISA::i, lindex(), logSizeLoopPred, LTAGE::BranchInfo::loopHit, LTAGE::BranchInfo::loopIndex, LTAGE::BranchInfo::loopPredValid, LTAGE::BranchInfo::loopTag, ltable, LTAGE::LoopEntry::numIter, pc, and LTAGE::LoopEntry::tag.
Referenced by predict().
Computes the index used to access a partially tagged table.
| tid | The thread ID used to select the global histories to use. | 
| pc | The unshifted branch PC. | 
| bank | The partially tagged table to access. | 
Definition at line 169 of file ltage.cc.
References F(), histLengths, MipsISA::index, pc, tagTableSizes, threadHistory, and ULL.
Referenced by predict().
Computes the partial tag of a tagged table.
| tid | the thread ID used to select the global histories to use. | 
| pc | The unshifted branch PC. | 
| bank | The partially tagged table to access. | 
Definition at line 184 of file ltage.cc.
References pc, tagWidths, threadHistory, and ULL.
Referenced by predict().
      
  | 
  private | 
Computes the index used to access the loop predictor.
| pc_in | The unshifted branch PC. | 
Definition at line 145 of file ltage.cc.
References logSizeLoopPred, and ULL.
Referenced by getLoop(), and specLoopUpdate().
Looks up a given PC in the BP to see if it is taken or not taken.
| inst_PC | The PC to look up. | 
| bp_history | Pointer that will be set to an object that has the branch predictor state associated with the lookup. | 
Implements BPredUnit.
Definition at line 702 of file ltage.cc.
References DPRINTF, predict(), threadHistory, and updateHistories().
      
  | 
  private | 
Updates the loop predictor.
| pc | The unshifted branch PC. | 
| taken | The actual branch outcome. | 
| bi | Pointer to information on the prediction recorded at prediction time. | 
Definition at line 274 of file ltage.cc.
References LTAGE::LoopEntry::age, LTAGE::LoopEntry::confidence, LTAGE::LoopEntry::currentIter, LTAGE::LoopEntry::dir, DPRINTF, ArmISA::i, LTAGE::BranchInfo::loopHit, LTAGE::BranchInfo::loopIndex, LTAGE::BranchInfo::loopPred, LTAGE::BranchInfo::loopPredValid, LTAGE::BranchInfo::loopTag, ltable, LTAGE::LoopEntry::numIter, Random::random(), random_mt, LTAGE::LoopEntry::tag, and LTAGE::BranchInfo::tagePred.
Referenced by update().
Get a branch prediction from L-TAGE.
NOT an override of BpredUnit::predict().
| tid | The thread ID to select the global histories to use. | 
| branch_pc | The unshifted branch PC. | 
| cond_branch | True if the branch is conditional. | 
| b | Reference to wrapping pointer to allow storing derived class prediction information in the base class. | 
Definition at line 403 of file ltage.cc.
References LTAGE::BranchInfo::altBank, LTAGE::BranchInfo::altBankIndex, LTAGE::BranchInfo::altTaken, PowerISA::bi, LTAGE::BranchInfo::bimodalIndex, bindex(), LTAGE::BranchInfo::branchPC, LTAGE::BranchInfo::condBranch, LTAGE::TageEntry::ctr, DPRINTF, getBimodePred(), getLoop(), gindex(), gtable, gtag(), LTAGE::BranchInfo::hitBank, LTAGE::BranchInfo::hitBankIndex, ArmISA::i, LTAGE::BranchInfo::longestMatchPred, LTAGE::BranchInfo::loopHit, LTAGE::BranchInfo::loopPred, LTAGE::BranchInfo::loopPredValid, loopUseCounter, nHistoryTables, pc, LTAGE::BranchInfo::pseudoNewAlloc, specLoopUpdate(), LTAGE::BranchInfo::tableIndices, tableIndices, LTAGE::BranchInfo::tableTags, tableTags, LTAGE::BranchInfo::tagePred, and useAltPredForNewlyAllocated.
Referenced by lookup(), and uncondBranch().
      
  | 
  private | 
Speculatively updates the loop predictor iteration count.
| pc | The unshifted branch PC. | 
| taken | The predicted branch outcome. | 
| bi | Pointer to information on the prediction recorded at prediction time. | 
Definition at line 261 of file ltage.cc.
References LTAGE::LoopEntry::currentIterSpec, MipsISA::index, lindex(), LTAGE::BranchInfo::loopHit, and ltable.
Referenced by predict().
      
  | 
  overridevirtual | 
| bp_history | Pointer to the history object. The predictor will need to update any state and delete the object. | 
Implements BPredUnit.
Definition at line 687 of file ltage.cc.
References PowerISA::bi, LTAGE::BranchInfo::branchPC, LTAGE::BranchInfo::condBranch, LTAGE::BranchInfo::currentIter, LTAGE::LoopEntry::currentIterSpec, DPRINTF, LTAGE::BranchInfo::loopHit, LTAGE::BranchInfo::loopIndex, and ltable.
Referenced by update().
      
  | 
  private | 
Restores speculatively updated path and direction histories.
Also recomputes compressed (folded) histories based on the correct branch outcome. This version of squash() is called once on a branch misprediction.
| tid | The Thread ID to select the histories to rollback. | 
| taken | The correct branch outcome. | 
| bp_history | Wrapping pointer to BranchInfo (to allow storing derived class prediction information in the base class). | 
Definition at line 658 of file ltage.cc.
References PowerISA::bi, LTAGE::BranchInfo::branchPC, LTAGE::BranchInfo::ci, LTAGE::FoldedHistory::comp, LTAGE::ThreadHistory::computeIndices, LTAGE::ThreadHistory::computeTags, LTAGE::BranchInfo::condBranch, LTAGE::BranchInfo::ct0, LTAGE::BranchInfo::ct1, LTAGE::BranchInfo::currentIter, LTAGE::LoopEntry::currentIterSpec, DPRINTF, LTAGE::ThreadHistory::gHist, LTAGE::ThreadHistory::globalHistory, ArmISA::i, LTAGE::BranchInfo::loopHit, LTAGE::BranchInfo::loopIndex, ltable, nHistoryTables, LTAGE::BranchInfo::pathHist, LTAGE::ThreadHistory::pathHist, LTAGE::BranchInfo::ptGhist, LTAGE::ThreadHistory::ptGhist, threadHistory, and LTAGE::FoldedHistory::update().
Implements BPredUnit.
Definition at line 733 of file ltage.cc.
References DPRINTF, predict(), threadHistory, and updateHistories().
      
  | 
  overridevirtual | 
Updates the BP with taken/not taken information.
| inst_PC | The branch's PC that will be updated. | 
| taken | Whether the branch was taken or not taken. | 
| bp_history | Pointer to the branch predictor state that is associated with the branch lookup that is being updated. | 
| squashed | Set to true when this function is called during a squash operation. | 
Implements BPredUnit.
Definition at line 489 of file ltage.cc.
References LTAGE::BranchInfo::altBank, LTAGE::BranchInfo::altBankIndex, LTAGE::BranchInfo::altTaken, baseUpdate(), PowerISA::bi, LTAGE::BranchInfo::condBranch, LTAGE::TageEntry::ctr, ctrUpdate(), DPRINTF, gtable, LTAGE::BranchInfo::hitBank, LTAGE::BranchInfo::hitBankIndex, ArmISA::i, ArmISA::j, logTick, LTAGE::BranchInfo::longestMatchPred, LTAGE::BranchInfo::loopPred, LTAGE::BranchInfo::loopPredValid, loopUpdate(), loopUseCounter, nHistoryTables, pc, LTAGE::BranchInfo::pseudoNewAlloc, Random::random(), random_mt, squash(), LTAGE::BranchInfo::tableIndices, LTAGE::BranchInfo::tableTags, LTAGE::TageEntry::tag, LTAGE::BranchInfo::tagePred, tagTableCounterBits, tagTableSizes, tCounter, LTAGE::TageEntry::u, ULL, useAltPredForNewlyAllocated, and X86ISA::X.
      
  | 
  private | 
Update L-TAGE.
Called at execute to repair histories on a misprediction and at commit to update the tables.
| tid | The thread ID to select the global histories to use. | 
| branch_pc | The unshifted branch PC. | 
| taken | Actual branch outcome. | 
| bi | Pointer to information on the prediction recorded at prediction time. | 
      
  | 
  private | 
(Speculatively) updates the global branch history.
| h | Reference to pointer to global branch history. | 
| dir | (Predicted) outcome to update the histories with. | 
| tab | |
| PT | Reference to path history. | 
Definition at line 365 of file ltage.cc.
References DPRINTF, histBufferSize, ArmISA::i, and maxHist.
Referenced by updateHistories().
(Speculatively) updates global histories (path and direction).
Also recomputes compressed (folded) histories based on the branch direction.
| tid | The thread ID to select the histories to update. | 
| branch_pc | The unshifted branch PC. | 
| taken | (Predicted) branch direction. | 
| b | Wrapping pointer to BranchInfo (to allow storing derived class prediction information in the base class). | 
Definition at line 628 of file ltage.cc.
References PowerISA::bi, LTAGE::BranchInfo::ci, LTAGE::FoldedHistory::comp, LTAGE::ThreadHistory::computeIndices, LTAGE::ThreadHistory::computeTags, LTAGE::BranchInfo::ct0, LTAGE::BranchInfo::ct1, DPRINTF, LTAGE::ThreadHistory::gHist, LTAGE::ThreadHistory::globalHistory, ArmISA::i, nHistoryTables, LTAGE::BranchInfo::pathHist, LTAGE::ThreadHistory::pathHist, LTAGE::BranchInfo::ptGhist, LTAGE::ThreadHistory::ptGhist, threadHistory, ULL, LTAGE::FoldedHistory::update(), and updateGHist().
Referenced by lookup(), and uncondBranch().
      
  | 
  private | 
Definition at line 367 of file ltage.hh.
Referenced by baseUpdate(), getBimodePred(), and LTAGE().
      
  | 
  private | 
      
  | 
  private | 
Definition at line 362 of file ltage.hh.
Referenced by getGHR(), LTAGE(), and updateGHist().
      
  | 
  private | 
      
  | 
  private | 
      
  | 
  private | 
      
  | 
  private | 
      
  | 
  private | 
      
  | 
  private | 
      
  | 
  private | 
Definition at line 369 of file ltage.hh.
Referenced by getLoop(), loopUpdate(), LTAGE(), specLoopUpdate(), and squash().
      
  | 
  private | 
Definition at line 364 of file ltage.hh.
Referenced by LTAGE(), and updateGHist().
      
  | 
  private | 
      
  | 
  private | 
      
  | 
  private | 
Definition at line 360 of file ltage.hh.
Referenced by btbUpdate(), LTAGE(), predict(), squash(), update(), and updateHistories().
      
  | 
  private | 
      
  | 
  private | 
      
  | 
  private | 
      
  | 
  private | 
      
  | 
  private | 
      
  | 
  private | 
      
  | 
  private | 
Definition at line 394 of file ltage.hh.
Referenced by btbUpdate(), getGHR(), gindex(), gtag(), lookup(), LTAGE(), squash(), uncondBranch(), and updateHistories().
      
  | 
  private |