33#include "debug/StoreSet.hh"
44 size_t _SSIT_entries,
int _SSIT_assoc,
48 SSIT(
"SSIT", _SSIT_entries, _SSIT_assoc,
49 _replPolicy, _indexingPolicy,
59 fatal(
"Invalid SSIT size!\n");
63 fatal(
"Invalid LFST size!\n");
95 SSIT.init(
SSITSize, _SSIT_assoc, _replPolicy, _indexingPolicy,
114 auto ld_entry =
SSIT.findEntry({load_PC});
115 auto st_entry =
SSIT.findEntry({store_PC});
117 bool valid_load_SSID = ld_entry && ld_entry->isValid();
118 bool valid_store_SSID = st_entry && st_entry->isValid();
120 if (!valid_load_SSID && !valid_store_SSID) {
128 SSIT.insertEntry({load_PC}, ld_entry);
132 SSIT.insertEntry({store_PC}, st_entry);
135 "storeset, creating a new one: %i for load %#x, store %#x\n",
136 new_set, load_PC, store_PC);
137 }
else if (valid_load_SSID && !valid_store_SSID) {
138 SSID load_SSID = ld_entry->getSSID();
141 SSIT.insertEntry({store_PC}, st_entry);
146 "store to that set: %i for load %#x, store %#x\n",
147 load_SSID, load_PC, store_PC);
148 }
else if (!valid_load_SSID && valid_store_SSID) {
149 SSID store_SSID = st_entry->getSSID();
152 SSIT.insertEntry({load_PC}, ld_entry);
155 "load %#x, store %#x\n",
156 store_SSID, load_PC, store_PC);
158 SSID load_SSID = ld_entry->getSSID();
159 SSID store_SSID = st_entry->getSSID();
164 if (store_SSID > load_SSID) {
165 st_entry->setSSID(load_SSID);
168 "for load %#x, store %#x\n",
169 load_SSID, load_PC, store_PC);
171 ld_entry->setSSID(store_SSID);
174 "for load %#x, store %#x\n",
175 store_SSID, load_PC, store_PC);
185 DPRINTF(
StoreSet,
"Wiping predictor state beacuse %d ld/st executed\n",
203 auto st_entry =
SSIT.findEntry({store_PC});
205 bool valid_entry = st_entry && st_entry->isValid();
215 store_SSID = st_entry->getSSID();
220 LFST[store_SSID] = store_seq_num;
227 store_PC, store_SSID);
234 auto entry =
SSIT.findEntry({PC});
235 bool valid_ssit = entry && entry->isValid();
245 inst_SSID = entry->getSSID();
252 "dependency\n", PC, inst_SSID);
257 "inum of %i\n", PC, inst_SSID,
LFST[inst_SSID]);
259 return LFST[inst_SSID];
272 auto entry =
SSIT.findEntry({issued_PC});
273 bool valid_ssit = entry && entry->isValid();
288 store_SSID = entry->getSSID();
294 if (
validLFST[store_SSID] &&
LFST[store_SSID] == issued_seq_num) {
311 idx = (*store_list_it).second;
313 if ((*store_list_it).first <= squashed_num) {
317 bool younger =
LFST[idx] > squashed_num;
350 while (store_list_it !=
storeList.end()) {
351 cprintf(
"%i: [sn:%lli] SSID:%i\n",
352 num, (*store_list_it).first, (*store_list_it).second);
Named(std::string_view name_)
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.
void dump()
Debug function to dump the contents of the store list.
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.
SSID calcSSID(Addr PC)
Calculates a Store Set ID based on the PC.
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.
InstSeqNum checkInst(Addr PC)
Checks if the instruction with the given PC is dependent upon any store.
AssociativeCache< SSITEntry > SSIT
The Store Set ID Table.
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.
void init(uint64_t clear_period, size_t SSIT_entries, int SSIT_assoc, replacement_policy::Base *_replPolicy, BaseIndexingPolicy *_indexingPolicy, int LFST_size)
Initializes the store set predictor with the given table sizes.
int memOpsPred
Number of memory operations predicted since last clear of predictor.
A common base class of cache replacement policy objects.
static constexpr bool isPowerOf2(const T &n)
#define fatal(...)
This implements a cprintf based fatal() function.
Copyright (c) 2024 Arm Limited 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.
IndexingPolicyTemplate< AddrTypes > BaseIndexingPolicy
static constexpr auto genTagExtractor(BTBIndexingPolicy *ip)
This helper generates a tag extractor function object which will be typically used by Replaceable ent...