gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  * Authors: Kevin Lim
29  */
30 
31 #ifndef __CPU_O3_STORE_SET_HH__
32 #define __CPU_O3_STORE_SET_HH__
33 
34 #include <list>
35 #include <map>
36 #include <utility>
37 #include <vector>
38 
39 #include "base/types.hh"
40 #include "cpu/inst_seq.hh"
41 
42 struct ltseqnum {
43  bool operator()(const InstSeqNum &lhs, const InstSeqNum &rhs) const
44  {
45  return lhs > rhs;
46  }
47 };
48 
56 class StoreSet
57 {
58  public:
59  typedef unsigned SSID;
60 
61  public:
63  StoreSet() { };
64 
66  StoreSet(uint64_t clear_period, int SSIT_size, int LFST_size);
67 
69  ~StoreSet();
70 
72  void init(uint64_t clear_period, int SSIT_size, int LFST_size);
73 
76  void violation(Addr store_PC, Addr load_PC);
77 
82  void checkClear();
83 
87  void insertLoad(Addr load_PC, InstSeqNum load_seq_num);
88 
91  void insertStore(Addr store_PC, InstSeqNum store_seq_num, ThreadID tid);
92 
98 
100  void issued(Addr issued_PC, InstSeqNum issued_seq_num, bool is_store);
101 
103  void squash(InstSeqNum squashed_num, ThreadID tid);
104 
106  void clear();
107 
109  void dump();
110 
111  private:
113  inline int calcIndex(Addr PC)
114  { return (PC >> offsetBits) & indexMask; }
115 
117  inline SSID calcSSID(Addr PC)
118  { return ((PC ^ (PC >> 10)) % LFSTSize); }
119 
122 
125 
128 
131 
135  std::map<InstSeqNum, int, ltseqnum> storeList;
136 
137  typedef std::map<InstSeqNum, int, ltseqnum>::iterator SeqNumMapIt;
138 
142  uint64_t clearPeriod;
143 
145  int SSITSize;
146 
148  int LFSTSize;
149 
152 
153  // HACK: Hardcoded for now.
155 
158 };
159 
160 #endif // __CPU_O3_STORE_SET_HH__
Implements a store set predictor for determining if memory instructions are dependent upon each other...
Definition: store_set.hh:56
SSID calcSSID(Addr PC)
Calculates a Store Set ID based on the PC.
Definition: store_set.hh:117
void insertLoad(Addr load_PC, InstSeqNum load_seq_num)
Inserts a load into the store set predictor.
Definition: store_set.cc:201
~StoreSet()
Default destructor.
Definition: store_set.cc:76
std::vector< bool > validSSIT
Bit vector to tell if the SSIT has a valid entry.
Definition: store_set.hh:124
int calcIndex(Addr PC)
Calculates the index into the SSIT based on the PC.
Definition: store_set.hh:113
std::map< InstSeqNum, int, ltseqnum >::iterator SeqNumMapIt
Definition: store_set.hh:137
int indexMask
Mask to obtain the index.
Definition: store_set.hh:151
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:81
std::vector< InstSeqNum > LFST
Last Fetched Store Table.
Definition: store_set.hh:127
InstSeqNum checkInst(Addr PC)
Checks if the instruction with the given PC is dependent upon any store.
Definition: store_set.cc:239
StoreSet()
Default constructor.
Definition: store_set.hh:63
void squash(InstSeqNum squashed_num, ThreadID tid)
Squashes for a specific thread until the given sequence number.
Definition: store_set.cc:311
uint64_t clearPeriod
Number of loads/stores to process before wiping predictor so all entries don't get saturated...
Definition: store_set.hh:142
void clear()
Resets all tables.
Definition: store_set.cc:341
uint64_t InstSeqNum
Definition: inst_seq.hh:40
int LFSTSize
Last Fetched Store Table size, in entries.
Definition: store_set.hh:148
unsigned SSID
Definition: store_set.hh:59
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:135
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
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:116
int memOpsPred
Number of memory operations predicted since last clear of predictor.
Definition: store_set.hh:157
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:189
int SSITSize
Store Set ID Table size, in entries.
Definition: store_set.hh:145
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:171
void issued(Addr issued_PC, InstSeqNum issued_seq_num, bool is_store)
Records this PC/sequence number as issued.
Definition: store_set.cc:274
std::vector< SSID > SSIT
The Store Set ID Table.
Definition: store_set.hh:121
std::vector< bool > validLFST
Bit vector to tell if the LFST has a valid entry.
Definition: store_set.hh:130
bool operator()(const InstSeqNum &lhs, const InstSeqNum &rhs) const
Definition: store_set.hh:43
int offsetBits
Definition: store_set.hh:154
void insertStore(Addr store_PC, InstSeqNum store_seq_num, ThreadID tid)
Inserts a store into the store set predictor.
Definition: store_set.cc:209
void dump()
Debug function to dump the contents of the store list.
Definition: store_set.cc:355

Generated on Fri Jun 9 2017 13:03:44 for gem5 by doxygen 1.8.6