gem5  v20.0.0.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
simple_indirect.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 ARM Limited
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef __CPU_PRED_INDIRECT_HH__
30 #define __CPU_PRED_INDIRECT_HH__
31 
32 #include <deque>
33 
34 #include "arch/isa_traits.hh"
35 #include "config/the_isa.hh"
36 #include "cpu/inst_seq.hh"
37 #include "cpu/pred/indirect.hh"
38 #include "params/SimpleIndirectPredictor.hh"
39 
41 {
42  public:
43  SimpleIndirectPredictor(const SimpleIndirectPredictorParams * params);
44 
45  bool lookup(Addr br_addr, TheISA::PCState& br_target, ThreadID tid);
46  void recordIndirect(Addr br_addr, Addr tgt_addr, InstSeqNum seq_num,
47  ThreadID tid);
48  void commit(InstSeqNum seq_num, ThreadID tid, void * indirect_history);
49  void squash(InstSeqNum seq_num, ThreadID tid);
50  void recordTarget(InstSeqNum seq_num, void * indirect_history,
51  const TheISA::PCState& target, ThreadID tid);
52  void genIndirectInfo(ThreadID tid, void* & indirect_history);
53  void updateDirectionInfo(ThreadID tid, bool actually_taken);
54  void deleteIndirectInfo(ThreadID tid, void * indirect_history);
55  void changeDirectionPrediction(ThreadID tid, void * indirect_history,
56  bool actually_taken);
57 
58  private:
59  const bool hashGHR;
60  const bool hashTargets;
61  const unsigned numSets;
62  const unsigned numWays;
63  const unsigned tagBits;
64  const unsigned pathLength;
65  const unsigned instShift;
66  const unsigned ghrNumBits;
67  const unsigned ghrMask;
68 
69  struct IPredEntry
70  {
71  IPredEntry() : tag(0), target(0) { }
74  };
75 
77 
78  Addr getSetIndex(Addr br_addr, unsigned ghr, ThreadID tid);
79  Addr getTag(Addr br_addr);
80 
81  struct HistoryEntry
82  {
83  HistoryEntry(Addr br_addr, Addr tgt_addr, InstSeqNum seq_num)
84  : pcAddr(br_addr), targetAddr(tgt_addr), seqNum(seq_num) { }
88  };
89 
90 
91  struct ThreadInfo {
92  ThreadInfo() : headHistEntry(0), ghr(0) { }
93 
95  unsigned headHistEntry;
96  unsigned ghr;
97  };
98 
100 };
101 
102 #endif // __CPU_PRED_INDIRECT_HH__
void changeDirectionPrediction(ThreadID tid, void *indirect_history, bool actually_taken)
std::vector< std::vector< IPredEntry > > targetCache
Addr getSetIndex(Addr br_addr, unsigned ghr, ThreadID tid)
std::vector< ThreadInfo > threadInfo
STL vector class.
Definition: stl.hh:37
bool lookup(Addr br_addr, TheISA::PCState &br_target, ThreadID tid)
void commit(InstSeqNum seq_num, ThreadID tid, void *indirect_history)
void genIndirectInfo(ThreadID tid, void *&indirect_history)
uint64_t InstSeqNum
Definition: inst_seq.hh:37
const Params * params() const
Definition: sim_object.hh:118
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:140
std::deque< HistoryEntry > pathHist
STL deque class.
Definition: stl.hh:44
void deleteIndirectInfo(ThreadID tid, void *indirect_history)
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:225
void recordIndirect(Addr br_addr, Addr tgt_addr, InstSeqNum seq_num, ThreadID tid)
void squash(InstSeqNum seq_num, ThreadID tid)
void updateDirectionInfo(ThreadID tid, bool actually_taken)
HistoryEntry(Addr br_addr, Addr tgt_addr, InstSeqNum seq_num)
void recordTarget(InstSeqNum seq_num, void *indirect_history, const TheISA::PCState &target, ThreadID tid)
GenericISA::DelaySlotPCState< MachInst > PCState
Definition: types.hh:41
Addr getTag(Addr br_addr)
SimpleIndirectPredictor(const SimpleIndirectPredictorParams *params)

Generated on Mon Jun 8 2020 15:45:09 for gem5 by doxygen 1.8.13