gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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  * Authors: Vignyan Reddy, Dibakar Gope and Arthur Perais,
34  * from André Seznec's code.
35  */
36 
37 /* @file
38  * Implementation of a L-TAGE branch predictor. TAGE is a global-history based
39  * branch predictor. It features a PC-indexed bimodal predictor and N
40  * partially tagged tables, indexed with a hash of the PC and the global
41  * branch history. The different lengths of global branch history used to
42  * index the partially tagged tables grow geometrically. A small path history
43  * is also used in the hash. L-TAGE also features a loop predictor that records
44  * iteration count of loops and predicts accordingly.
45  *
46  * All TAGE tables are accessed in parallel, and the one using the longest
47  * history that matches provides the prediction (some exceptions apply).
48  * Entries are allocated in components using a longer history than the
49  * one that predicted when the prediction is incorrect.
50  */
51 
52 #ifndef __CPU_PRED_LTAGE
53 #define __CPU_PRED_LTAGE
54 
55 
56 #include <vector>
57 
58 #include "base/types.hh"
60 #include "cpu/pred/tage.hh"
61 #include "params/LTAGE.hh"
62 
63 class LTAGE : public TAGE
64 {
65  public:
66  LTAGE(const LTAGEParams *params);
67 
68  // Base class methods.
69  void squash(ThreadID tid, void *bp_history) override;
70  void update(ThreadID tid, Addr branch_addr, bool taken, void *bp_history,
71  bool squashed, const StaticInstPtr & inst,
72  Addr corrTarget = MaxAddr) override;
73 
74  void init() override;
75  virtual void regStats() override;
76 
77  protected:
80 
81  // more provider types
82  enum {
85  };
86 
87  // Primary branch history entry
89  {
92  : TageBranchInfo(tage), lpBranchInfo(lp.makeBranchInfo())
93  {}
94 
95  virtual ~LTageBranchInfo()
96  {
97  delete lpBranchInfo;
98  }
99  };
100 
111  bool predict(
112  ThreadID tid, Addr branch_pc, bool cond_branch, void* &b) override;
113 };
114 
115 #endif // __CPU_PRED_LTAGE
LoopPredictor::BranchInfo * lpBranchInfo
Definition: ltage.hh:90
LTAGE(const LTAGEParams *params)
Definition: ltage.cc:50
Definition: ltage.hh:63
const Addr MaxAddr
Definition: types.hh:166
virtual void regStats() override
Registers statistics.
Definition: ltage.cc:150
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: ltage.cc:56
Bitfield< 7 > b
void squash(ThreadID tid, void *bp_history) override
Definition: ltage.cc:138
const Params * params() const
Definition: sim_object.hh:114
virtual ~LTageBranchInfo()
Definition: ltage.hh:95
Definition: tage.hh:61
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.
Definition: types.hh:142
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:227
LTageBranchInfo(TAGEBase &tage, LoopPredictor &lp)
Definition: ltage.hh:91
bool predict(ThreadID tid, Addr branch_pc, bool cond_branch, void *&b) override
Get a branch prediction from LTAGE.
Definition: ltage.cc:63
void update(ThreadID tid, Addr branch_addr, bool taken, void *bp_history, bool squashed, const StaticInstPtr &inst, Addr corrTarget=MaxAddr) override
Updates the BP with taken/not taken information.
Definition: ltage.cc:94
LoopPredictor * loopPredictor
The loop predictor object.
Definition: ltage.hh:79
TAGEBase * tage
Definition: tage.hh:64

Generated on Fri Feb 28 2020 16:26:59 for gem5 by doxygen 1.8.13