gem5  v22.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 namespace gem5
41 {
42 
43 namespace o3
44 {
45 
46 struct ltseqnum
47 {
48  bool
49  operator()(const InstSeqNum &lhs, const InstSeqNum &rhs) const
50  {
51  return lhs > rhs;
52  }
53 };
54 
62 class StoreSet
63 {
64  public:
65  typedef unsigned SSID;
66 
67  public:
69  StoreSet() { };
70 
72  StoreSet(uint64_t clear_period, int SSIT_size, int LFST_size);
73 
75  ~StoreSet();
76 
78  void init(uint64_t clear_period, int SSIT_size, int LFST_size);
79 
82  void violation(Addr store_PC, Addr load_PC);
83 
88  void checkClear();
89 
93  void insertLoad(Addr load_PC, InstSeqNum load_seq_num);
94 
97  void insertStore(Addr store_PC, InstSeqNum store_seq_num, ThreadID tid);
98 
104 
106  void issued(Addr issued_PC, InstSeqNum issued_seq_num, bool is_store);
107 
109  void squash(InstSeqNum squashed_num, ThreadID tid);
110 
112  void clear();
113 
115  void dump();
116 
117  private:
119  inline int calcIndex(Addr PC)
120  { return (PC >> offsetBits) & indexMask; }
121 
123  inline SSID calcSSID(Addr PC)
124  { return ((PC ^ (PC >> 10)) % LFSTSize); }
125 
128 
131 
134 
137 
141  std::map<InstSeqNum, int, ltseqnum> storeList;
142 
143  typedef std::map<InstSeqNum, int, ltseqnum>::iterator SeqNumMapIt;
144 
148  uint64_t clearPeriod;
149 
151  int SSITSize;
152 
154  int LFSTSize;
155 
158 
159  // HACK: Hardcoded for now.
161 
164 };
165 
166 } // namespace o3
167 } // namespace gem5
168 
169 #endif // __CPU_O3_STORE_SET_HH__
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
Implements a store set predictor for determining if memory instructions are dependent upon each other...
Definition: store_set.hh:63
void insertLoad(Addr load_PC, InstSeqNum load_seq_num)
Inserts a load into the store set predictor.
Definition: store_set.cc:205
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:193
std::vector< InstSeqNum > LFST
Last Fetched Store Table.
Definition: store_set.hh:133
void squash(InstSeqNum squashed_num, ThreadID tid)
Squashes for a specific thread until the given sequence number.
Definition: store_set.cc:315
uint64_t clearPeriod
Number of loads/stores to process before wiping predictor so all entries don't get saturated.
Definition: store_set.hh:148
std::vector< bool > validSSIT
Bit vector to tell if the SSIT has a valid entry.
Definition: store_set.hh:130
void dump()
Debug function to dump the contents of the store list.
Definition: store_set.cc:359
std::map< InstSeqNum, int, ltseqnum >::iterator SeqNumMapIt
Definition: store_set.hh:143
int indexMask
Mask to obtain the index.
Definition: store_set.hh:157
void clear()
Resets all tables.
Definition: store_set.cc:345
void insertStore(Addr store_PC, InstSeqNum store_seq_num, ThreadID tid)
Inserts a store into the store set predictor.
Definition: store_set.cc:213
~StoreSet()
Default destructor.
Definition: store_set.cc:80
std::vector< SSID > SSIT
The Store Set ID Table.
Definition: store_set.hh:127
SSID calcSSID(Addr PC)
Calculates a Store Set ID based on the PC.
Definition: store_set.hh:123
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:85
std::vector< bool > validLFST
Bit vector to tell if the LFST has a valid entry.
Definition: store_set.hh:136
int LFSTSize
Last Fetched Store Table size, in entries.
Definition: store_set.hh:154
void issued(Addr issued_PC, InstSeqNum issued_seq_num, bool is_store)
Records this PC/sequence number as issued.
Definition: store_set.cc:278
int calcIndex(Addr PC)
Calculates the index into the SSIT based on the PC.
Definition: store_set.hh:119
InstSeqNum checkInst(Addr PC)
Checks if the instruction with the given PC is dependent upon any store.
Definition: store_set.cc:243
int SSITSize
Store Set ID Table size, in entries.
Definition: store_set.hh:151
StoreSet()
Default constructor.
Definition: store_set.hh:69
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:120
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:141
int memOpsPred
Number of memory operations predicted since last clear of predictor.
Definition: store_set.hh:163
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:235
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
uint64_t InstSeqNum
Definition: inst_seq.hh:40
bool operator()(const InstSeqNum &lhs, const InstSeqNum &rhs) const
Definition: store_set.hh:49

Generated on Wed Dec 21 2022 10:22:31 for gem5 by doxygen 1.9.1