gem5  v21.1.0.2
ltage.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 The University of Wisconsin
3  *
4  * Copyright (c) 2006 INRIA (Institut National de Recherche en
5  * Informatique et en Automatique / French National Research Institute
6  * for Computer Science and Applied Mathematics)
7  *
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions are
12  * met: redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer;
14  * redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution;
17  * neither the name of the copyright holders nor the names of its
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 /* @file
35  * Implementation of a L-TAGE branch predictor. TAGE is a global-history based
36  * branch predictor. It features a PC-indexed bimodal predictor and N
37  * partially tagged tables, indexed with a hash of the PC and the global
38  * branch history. The different lengths of global branch history used to
39  * index the partially tagged tables grow geometrically. A small path history
40  * is also used in the hash. L-TAGE also features a loop predictor that records
41  * iteration count of loops and predicts accordingly.
42  *
43  * All TAGE tables are accessed in parallel, and the one using the longest
44  * history that matches provides the prediction (some exceptions apply).
45  * Entries are allocated in components using a longer history than the
46  * one that predicted when the prediction is incorrect.
47  */
48 
49 #ifndef __CPU_PRED_LTAGE_HH__
50 #define __CPU_PRED_LTAGE_HH__
51 
52 
53 #include <vector>
54 
55 #include "base/types.hh"
57 #include "cpu/pred/tage.hh"
58 #include "params/LTAGE.hh"
59 
60 namespace gem5
61 {
62 
63 namespace branch_prediction
64 {
65 
66 class LTAGE : public TAGE
67 {
68  public:
69  LTAGE(const LTAGEParams &params);
70 
71  // Base class methods.
72  void squash(ThreadID tid, void *bp_history) override;
73  void update(ThreadID tid, Addr branch_addr, bool taken, void *bp_history,
74  bool squashed, const StaticInstPtr & inst,
75  Addr corrTarget) override;
76 
77  void init() override;
78 
79  protected:
82 
83  // more provider types
84  enum
85  {
88  };
89 
90  // Primary branch history entry
92  {
95  : TageBranchInfo(tage), lpBranchInfo(lp.makeBranchInfo())
96  {}
97 
98  virtual ~LTageBranchInfo()
99  {
100  delete lpBranchInfo;
101  }
102  };
103 
114  bool predict(
115  ThreadID tid, Addr branch_pc, bool cond_branch, void* &b) override;
116 };
117 
118 } // namespace branch_prediction
119 } // namespace gem5
120 
121 #endif // __CPU_PRED_LTAGE_HH__
gem5::branch_prediction::LTAGE::squash
void squash(ThreadID tid, void *bp_history) override
Definition: ltage.cc:139
gem5::branch_prediction::LTAGE::LTageBranchInfo::~LTageBranchInfo
virtual ~LTageBranchInfo()
Definition: ltage.hh:98
tage.hh
gem5::branch_prediction::LTAGE::update
void update(ThreadID tid, Addr branch_addr, bool taken, void *bp_history, bool squashed, const StaticInstPtr &inst, Addr corrTarget) override
Updates the BP with taken/not taken information.
Definition: ltage.cc:97
gem5::branch_prediction::LTAGE::LTageBranchInfo::LTageBranchInfo
LTageBranchInfo(TAGEBase &tage, LoopPredictor &lp)
Definition: ltage.hh:94
gem5::branch_prediction::LTAGE::LTAGE
LTAGE(const LTAGEParams &params)
Definition: ltage.cc:53
gem5::RefCountingPtr< StaticInst >
gem5::branch_prediction::TAGEBase
Definition: tage_base.hh:65
gem5::ArmISA::b
Bitfield< 7 > b
Definition: misc_types.hh:381
gem5::branch_prediction::LTAGE::init
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: ltage.cc:59
gem5::SimObject::params
const Params & params() const
Definition: sim_object.hh:176
gem5::branch_prediction::LTAGE::LOOP
@ LOOP
Definition: ltage.hh:86
gem5::branch_prediction::TAGE::TageBranchInfo
Definition: tage.hh:69
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::branch_prediction::LTAGE::predict
bool predict(ThreadID tid, Addr branch_pc, bool cond_branch, void *&b) override
Get a branch prediction from LTAGE.
Definition: ltage.cc:66
gem5::branch_prediction::TAGE
Definition: tage.hh:64
gem5::branch_prediction::LTAGE::LTageBranchInfo
Definition: ltage.hh:91
gem5::branch_prediction::LTAGE
Definition: ltage.hh:66
loop_predictor.hh
types.hh
gem5::branch_prediction::LTAGE::LTageBranchInfo::lpBranchInfo
LoopPredictor::BranchInfo * lpBranchInfo
Definition: ltage.hh:93
gem5::branch_prediction::TAGE::tage
TAGEBase * tage
Definition: tage.hh:67
gem5::branch_prediction::LTAGE::loopPredictor
LoopPredictor * loopPredictor
The loop predictor object.
Definition: ltage.hh:81
gem5::branch_prediction::LoopPredictor
Definition: loop_predictor.hh:49
gem5::branch_prediction::TAGEBase::LAST_TAGE_PROVIDER_TYPE
@ LAST_TAGE_PROVIDER_TYPE
Definition: tage_base.hh:124
gem5::branch_prediction::LTAGE::LAST_LTAGE_PROVIDER_TYPE
@ LAST_LTAGE_PROVIDER_TYPE
Definition: ltage.hh:87
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::branch_prediction::LoopPredictor::BranchInfo
Definition: loop_predictor.hh:129
gem5::ThreadID
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:242

Generated on Tue Sep 21 2021 12:25:05 for gem5 by doxygen 1.8.17