gem5  v20.1.0.0
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 "config/the_isa.hh"
35 #include "cpu/inst_seq.hh"
36 #include "cpu/pred/indirect.hh"
37 #include "params/SimpleIndirectPredictor.hh"
38 
40 {
41  public:
42  SimpleIndirectPredictor(const SimpleIndirectPredictorParams * params);
43 
44  bool lookup(Addr br_addr, TheISA::PCState& br_target, ThreadID tid);
45  void recordIndirect(Addr br_addr, Addr tgt_addr, InstSeqNum seq_num,
46  ThreadID tid);
47  void commit(InstSeqNum seq_num, ThreadID tid, void * indirect_history);
48  void squash(InstSeqNum seq_num, ThreadID tid);
49  void recordTarget(InstSeqNum seq_num, void * indirect_history,
50  const TheISA::PCState& target, ThreadID tid);
51  void genIndirectInfo(ThreadID tid, void* & indirect_history);
52  void updateDirectionInfo(ThreadID tid, bool actually_taken);
53  void deleteIndirectInfo(ThreadID tid, void * indirect_history);
54  void changeDirectionPrediction(ThreadID tid, void * indirect_history,
55  bool actually_taken);
56 
57  private:
58  const bool hashGHR;
59  const bool hashTargets;
60  const unsigned numSets;
61  const unsigned numWays;
62  const unsigned tagBits;
63  const unsigned pathLength;
64  const unsigned instShift;
65  const unsigned ghrNumBits;
66  const unsigned ghrMask;
67 
68  struct IPredEntry
69  {
70  IPredEntry() : tag(0), target(0) { }
73  };
74 
76 
77  Addr getSetIndex(Addr br_addr, unsigned ghr, ThreadID tid);
78  Addr getTag(Addr br_addr);
79 
80  struct HistoryEntry
81  {
82  HistoryEntry(Addr br_addr, Addr tgt_addr, InstSeqNum seq_num)
83  : pcAddr(br_addr), targetAddr(tgt_addr), seqNum(seq_num) { }
87  };
88 
89 
90  struct ThreadInfo {
91  ThreadInfo() : headHistEntry(0), ghr(0) { }
92 
94  unsigned headHistEntry;
95  unsigned ghr;
96  };
97 
99 };
100 
101 #endif // __CPU_PRED_INDIRECT_HH__
SimpleIndirectPredictor::IPredEntry::target
TheISA::PCState target
Definition: simple_indirect.hh:72
SimpleIndirectPredictor::ghrNumBits
const unsigned ghrNumBits
Definition: simple_indirect.hh:65
SimpleIndirectPredictor::ThreadInfo
Definition: simple_indirect.hh:90
SimpleIndirectPredictor::getTag
Addr getTag(Addr br_addr)
Definition: simple_indirect.cc:232
SimpleIndirectPredictor::numSets
const unsigned numSets
Definition: simple_indirect.hh:60
SimpleIndirectPredictor::getSetIndex
Addr getSetIndex(Addr br_addr, unsigned ghr, ThreadID tid)
Definition: simple_indirect.cc:212
SimpleIndirectPredictor::HistoryEntry
Definition: simple_indirect.hh:80
ThreadID
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:227
SimpleIndirectPredictor::instShift
const unsigned instShift
Definition: simple_indirect.hh:64
SimpleIndirectPredictor::targetCache
std::vector< std::vector< IPredEntry > > targetCache
Definition: simple_indirect.hh:75
SimpleIndirectPredictor::ThreadInfo::ThreadInfo
ThreadInfo()
Definition: simple_indirect.hh:91
IndirectPredictor
Definition: indirect.hh:38
std::vector
STL vector class.
Definition: stl.hh:37
SimpleIndirectPredictor::tagBits
const unsigned tagBits
Definition: simple_indirect.hh:62
SimpleIndirectPredictor::hashTargets
const bool hashTargets
Definition: simple_indirect.hh:59
SimpleIndirectPredictor::genIndirectInfo
void genIndirectInfo(ThreadID tid, void *&indirect_history)
Definition: simple_indirect.cc:62
SimpleIndirectPredictor::HistoryEntry::targetAddr
Addr targetAddr
Definition: simple_indirect.hh:85
SimpleIndirectPredictor::commit
void commit(InstSeqNum seq_num, ThreadID tid, void *indirect_history)
Definition: simple_indirect.cc:121
SimpleIndirectPredictor::ThreadInfo::ghr
unsigned ghr
Definition: simple_indirect.hh:95
SimpleIndirectPredictor::ghrMask
const unsigned ghrMask
Definition: simple_indirect.hh:66
inst_seq.hh
SimpleIndirectPredictor::hashGHR
const bool hashGHR
Definition: simple_indirect.hh:58
SimpleIndirectPredictor::lookup
bool lookup(Addr br_addr, TheISA::PCState &br_target, ThreadID tid)
Definition: simple_indirect.cc:90
SimpleIndirectPredictor::threadInfo
std::vector< ThreadInfo > threadInfo
Definition: simple_indirect.hh:98
SimpleIndirectPredictor::IPredEntry::IPredEntry
IPredEntry()
Definition: simple_indirect.hh:70
indirect.hh
SimpleIndirectPredictor::HistoryEntry::HistoryEntry
HistoryEntry(Addr br_addr, Addr tgt_addr, InstSeqNum seq_num)
Definition: simple_indirect.hh:82
SimpleIndirectPredictor::ThreadInfo::headHistEntry
unsigned headHistEntry
Definition: simple_indirect.hh:94
SimpleIndirectPredictor::HistoryEntry::seqNum
InstSeqNum seqNum
Definition: simple_indirect.hh:86
InstSeqNum
uint64_t InstSeqNum
Definition: inst_seq.hh:37
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
SimObject::params
const Params * params() const
Definition: sim_object.hh:119
SimpleIndirectPredictor::updateDirectionInfo
void updateDirectionInfo(ThreadID tid, bool actually_taken)
Definition: simple_indirect.cc:72
SimpleIndirectPredictor::numWays
const unsigned numWays
Definition: simple_indirect.hh:61
SimpleIndirectPredictor::recordTarget
void recordTarget(InstSeqNum seq_num, void *indirect_history, const TheISA::PCState &target, ThreadID tid)
Definition: simple_indirect.cc:173
SimpleIndirectPredictor::deleteIndirectInfo
void deleteIndirectInfo(ThreadID tid, void *indirect_history)
Definition: simple_indirect.cc:163
MipsISA::PCState
GenericISA::DelaySlotPCState< MachInst > PCState
Definition: types.hh:41
SimpleIndirectPredictor::IPredEntry
Definition: simple_indirect.hh:68
SimpleIndirectPredictor::recordIndirect
void recordIndirect(Addr br_addr, Addr tgt_addr, InstSeqNum seq_num, ThreadID tid)
Definition: simple_indirect.cc:112
SimpleIndirectPredictor::IPredEntry::tag
Addr tag
Definition: simple_indirect.hh:71
SimpleIndirectPredictor::HistoryEntry::pcAddr
Addr pcAddr
Definition: simple_indirect.hh:84
std::deque
STL deque class.
Definition: stl.hh:44
SimpleIndirectPredictor::SimpleIndirectPredictor
SimpleIndirectPredictor(const SimpleIndirectPredictorParams *params)
Definition: simple_indirect.cc:34
SimpleIndirectPredictor::squash
void squash(InstSeqNum seq_num, ThreadID tid)
Definition: simple_indirect.cc:144
SimpleIndirectPredictor::changeDirectionPrediction
void changeDirectionPrediction(ThreadID tid, void *indirect_history, bool actually_taken)
Definition: simple_indirect.cc:81
SimpleIndirectPredictor::ThreadInfo::pathHist
std::deque< HistoryEntry > pathHist
Definition: simple_indirect.hh:93
SimpleIndirectPredictor::pathLength
const unsigned pathLength
Definition: simple_indirect.hh:63
SimpleIndirectPredictor
Definition: simple_indirect.hh:39

Generated on Wed Sep 30 2020 14:02:09 for gem5 by doxygen 1.8.17