gem5  v20.1.0.0
store_set.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2004-2005 The Regents of The University of Michigan
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_O3_STORE_SET_HH__
30 #define __CPU_O3_STORE_SET_HH__
31 
32 #include <list>
33 #include <map>
34 #include <utility>
35 #include <vector>
36 
37 #include "base/types.hh"
38 #include "cpu/inst_seq.hh"
39 
40 struct ltseqnum {
41  bool operator()(const InstSeqNum &lhs, const InstSeqNum &rhs) const
42  {
43  return lhs > rhs;
44  }
45 };
46 
54 class StoreSet
55 {
56  public:
57  typedef unsigned SSID;
58 
59  public:
61  StoreSet() { };
62 
64  StoreSet(uint64_t clear_period, int SSIT_size, int LFST_size);
65 
67  ~StoreSet();
68 
70  void init(uint64_t clear_period, int SSIT_size, int LFST_size);
71 
74  void violation(Addr store_PC, Addr load_PC);
75 
80  void checkClear();
81 
85  void insertLoad(Addr load_PC, InstSeqNum load_seq_num);
86 
89  void insertStore(Addr store_PC, InstSeqNum store_seq_num, ThreadID tid);
90 
96 
98  void issued(Addr issued_PC, InstSeqNum issued_seq_num, bool is_store);
99 
101  void squash(InstSeqNum squashed_num, ThreadID tid);
102 
104  void clear();
105 
107  void dump();
108 
109  private:
111  inline int calcIndex(Addr PC)
112  { return (PC >> offsetBits) & indexMask; }
113 
115  inline SSID calcSSID(Addr PC)
116  { return ((PC ^ (PC >> 10)) % LFSTSize); }
117 
120 
123 
126 
129 
133  std::map<InstSeqNum, int, ltseqnum> storeList;
134 
135  typedef std::map<InstSeqNum, int, ltseqnum>::iterator SeqNumMapIt;
136 
140  uint64_t clearPeriod;
141 
143  int SSITSize;
144 
146  int LFSTSize;
147 
150 
151  // HACK: Hardcoded for now.
153 
156 };
157 
158 #endif // __CPU_O3_STORE_SET_HH__
StoreSet::LFST
std::vector< InstSeqNum > LFST
Last Fetched Store Table.
Definition: store_set.hh:125
StoreSet::dump
void dump()
Debug function to dump the contents of the store list.
Definition: store_set.cc:353
StoreSet::insertStore
void insertStore(Addr store_PC, InstSeqNum store_seq_num, ThreadID tid)
Inserts a store into the store set predictor.
Definition: store_set.cc:207
ThreadID
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:227
StoreSet::offsetBits
int offsetBits
Definition: store_set.hh:152
ltseqnum
Definition: store_set.hh:40
StoreSet::insertLoad
void insertLoad(Addr load_PC, InstSeqNum load_seq_num)
Inserts a load into the store set predictor.
Definition: store_set.cc:199
StoreSet::checkInst
InstSeqNum checkInst(Addr PC)
Checks if the instruction with the given PC is dependent upon any store.
Definition: store_set.cc:237
StoreSet::indexMask
int indexMask
Mask to obtain the index.
Definition: store_set.hh:149
std::vector< SSID >
StoreSet::SeqNumMapIt
std::map< InstSeqNum, int, ltseqnum >::iterator SeqNumMapIt
Definition: store_set.hh:135
StoreSet::init
void init(uint64_t clear_period, int SSIT_size, int LFST_size)
Initializes the store set predictor with the given table sizes.
Definition: store_set.cc:79
StoreSet::calcIndex
int calcIndex(Addr PC)
Calculates the index into the SSIT based on the PC.
Definition: store_set.hh:111
inst_seq.hh
StoreSet::validSSIT
std::vector< bool > validSSIT
Bit vector to tell if the SSIT has a valid entry.
Definition: store_set.hh:122
StoreSet::StoreSet
StoreSet()
Default constructor.
Definition: store_set.hh:61
StoreSet::SSID
unsigned SSID
Definition: store_set.hh:57
ltseqnum::operator()
bool operator()(const InstSeqNum &lhs, const InstSeqNum &rhs) const
Definition: store_set.hh:41
StoreSet
Implements a store set predictor for determining if memory instructions are dependent upon each other...
Definition: store_set.hh:54
StoreSet::SSITSize
int SSITSize
Store Set ID Table size, in entries.
Definition: store_set.hh:143
StoreSet::squash
void squash(InstSeqNum squashed_num, ThreadID tid)
Squashes for a specific thread until the given sequence number.
Definition: store_set.cc:309
StoreSet::checkClear
void checkClear()
Clears the store set predictor every so often so that all the entries aren't used and stores are cons...
Definition: store_set.cc:187
InstSeqNum
uint64_t InstSeqNum
Definition: inst_seq.hh:37
StoreSet::issued
void issued(Addr issued_PC, InstSeqNum issued_seq_num, bool is_store)
Records this PC/sequence number as issued.
Definition: store_set.cc:272
StoreSet::validLFST
std::vector< bool > validLFST
Bit vector to tell if the LFST has a valid entry.
Definition: store_set.hh:128
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
StoreSet::clearPeriod
uint64_t clearPeriod
Number of loads/stores to process before wiping predictor so all entries don't get saturated.
Definition: store_set.hh:140
StoreSet::violation
void violation(Addr store_PC, Addr load_PC)
Records a memory ordering violation between the younger load and the older store.
Definition: store_set.cc:114
StoreSet::storeList
std::map< InstSeqNum, int, ltseqnum > storeList
Map of stores that have been inserted into the store set, but not yet issued or squashed.
Definition: store_set.hh:133
StoreSet::LFSTSize
int LFSTSize
Last Fetched Store Table size, in entries.
Definition: store_set.hh:146
types.hh
StoreSet::clear
void clear()
Resets all tables.
Definition: store_set.cc:339
StoreSet::memOpsPred
int memOpsPred
Number of memory operations predicted since last clear of predictor.
Definition: store_set.hh:155
StoreSet::SSIT
std::vector< SSID > SSIT
The Store Set ID Table.
Definition: store_set.hh:119
StoreSet::calcSSID
SSID calcSSID(Addr PC)
Calculates a Store Set ID based on the PC.
Definition: store_set.hh:115
StoreSet::~StoreSet
~StoreSet()
Default destructor.
Definition: store_set.cc:74

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