34#include "debug/StoreSet.hh"
43 : clearPeriod(clear_period), SSITSize(_SSIT_size), LFSTSize(_LFST_size)
50 fatal(
"Invalid SSIT size!\n");
61 fatal(
"Invalid LFST size!\n");
127 bool valid_load_SSID =
validSSIT[load_index];
128 bool valid_store_SSID =
validSSIT[store_index];
130 if (!valid_load_SSID && !valid_store_SSID) {
136 SSIT[load_index] = new_set;
140 SSIT[store_index] = new_set;
145 "storeset, creating a new one: %i for load %#x, store %#x\n",
146 new_set, load_PC, store_PC);
147 }
else if (valid_load_SSID && !valid_store_SSID) {
152 SSIT[store_index] = load_SSID;
157 "store to that set: %i for load %#x, store %#x\n",
158 load_SSID, load_PC, store_PC);
159 }
else if (!valid_load_SSID && valid_store_SSID) {
160 SSID store_SSID =
SSIT[store_index];
164 SSIT[load_index] = store_SSID;
167 "load %#x, store %#x\n",
168 store_SSID, load_PC, store_PC);
171 SSID store_SSID =
SSIT[store_index];
176 if (store_SSID > load_SSID) {
177 SSIT[store_index] = load_SSID;
180 "for load %#x, store %#x\n",
181 load_SSID, load_PC, store_PC);
183 SSIT[load_index] = store_SSID;
186 "for load %#x, store %#x\n",
187 store_SSID, load_PC, store_PC);
197 DPRINTF(
StoreSet,
"Wiping predictor state beacuse %d ld/st executed\n",
231 LFST[store_SSID] = store_seq_num;
238 store_PC, store_SSID);
265 "dependency\n", PC,
index, inst_SSID);
270 "inum of %i\n", PC,
index, inst_SSID,
LFST[inst_SSID]);
272 return LFST[inst_SSID];
308 if (
validLFST[store_SSID] &&
LFST[store_SSID] == issued_seq_num) {
325 idx = (*store_list_it).second;
327 if ((*store_list_it).first <= squashed_num) {
331 bool younger =
LFST[idx] > squashed_num;
366 while (store_list_it !=
storeList.end()) {
367 cprintf(
"%i: [sn:%lli] SSID:%i\n",
368 num, (*store_list_it).first, (*store_list_it).second);
Implements a store set predictor for determining if memory instructions are dependent upon each other...
void insertLoad(Addr load_PC, InstSeqNum load_seq_num)
Inserts a load into the store set predictor.
void checkClear()
Clears the store set predictor every so often so that all the entries aren't used and stores are cons...
std::vector< InstSeqNum > LFST
Last Fetched Store Table.
void squash(InstSeqNum squashed_num, ThreadID tid)
Squashes for a specific thread until the given sequence number.
uint64_t clearPeriod
Number of loads/stores to process before wiping predictor so all entries don't get saturated.
std::vector< bool > validSSIT
Bit vector to tell if the SSIT has a valid entry.
void dump()
Debug function to dump the contents of the store list.
int indexMask
Mask to obtain the index.
void clear()
Resets all tables.
void insertStore(Addr store_PC, InstSeqNum store_seq_num, ThreadID tid)
Inserts a store into the store set predictor.
~StoreSet()
Default destructor.
std::vector< SSID > SSIT
The Store Set ID Table.
SSID calcSSID(Addr PC)
Calculates a Store Set ID based on the PC.
void init(uint64_t clear_period, int SSIT_size, int LFST_size)
Initializes the store set predictor with the given table sizes.
std::vector< bool > validLFST
Bit vector to tell if the LFST has a valid entry.
int LFSTSize
Last Fetched Store Table size, in entries.
void issued(Addr issued_PC, InstSeqNum issued_seq_num, bool is_store)
Records this PC/sequence number as issued.
int calcIndex(Addr PC)
Calculates the index into the SSIT based on the PC.
InstSeqNum checkInst(Addr PC)
Checks if the instruction with the given PC is dependent upon any store.
std::map< InstSeqNum, int, ltseqnum >::iterator SeqNumMapIt
int SSITSize
Store Set ID Table size, in entries.
StoreSet()
Default constructor.
void violation(Addr store_PC, Addr load_PC)
Records a memory ordering violation between the younger load and the older store.
std::map< InstSeqNum, int, ltseqnum > storeList
Map of stores that have been inserted into the store set, but not yet issued or squashed.
int memOpsPred
Number of memory operations predicted since last clear of predictor.
static constexpr bool isPowerOf2(const T &n)
#define fatal(...)
This implements a cprintf based fatal() function.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
int16_t ThreadID
Thread index/ID type.
void cprintf(const char *format, const Args &...args)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.