49 : numAtomicLocs(n_atomic_locs),
50 numLocsPerAtomic(n_normal_locs_per_atomic)
96 assert(loc < numAtomicLocs + numNormalLocs && loc >= 0);
106 return ret_atomic_loc;
149 assert(loc_begin <= loc_end);
181 assert(firstMark >= 0);
182 assert(firstMark <= secondMark);
183 assert(secondMark <= arraySize);
185 assert(loadStoreMap.empty());
191 expectedValues.insert(requestCount - 1);
192 expectedValues.insert(requestCount - 2);
198 assert(firstMark >= 0);
199 assert(firstMark <= secondMark);
200 assert(secondMark <= arraySize);
202 if (firstMark == arraySize) {
208 int range_size = arraySize - firstMark;
214 LdStMap::iterator it = loadStoreMap.find(ret_loc);
216 if (it == loadStoreMap.end()) {
223 (it->second).first =
true;
233 assert(firstMark >= 0);
234 assert(firstMark <= secondMark);
235 assert(secondMark <= arraySize);
237 if (firstMark == secondMark) {
242 int range_size = secondMark - firstMark;
248 LdStMap::iterator it = loadStoreMap.find(ret_loc);
250 if (it == loadStoreMap.end()) {
257 (it->second).second =
true;
274 assert(firstMark >= 0);
275 assert(firstMark <= secondMark);
276 assert(secondMark <= arraySize);
278 for (
auto& it : loadStoreMap) {
282 assert(loc >= locationBase && loc < locationBase + arraySize);
283 LocProperty& loc_prop = locProps[loc - locationBase];
285 if (
p.first && !
p.second) {
288 assert(inSecondRegion(loc_prop.first) ||
289 inThirdRegion(loc_prop.first));
291 if (inSecondRegion(loc_prop.first)) {
293 assert(loc_prop.second == 0);
296 Location swapped_loc = locArray[secondMark - 1];
298 locProps[swapped_loc - locationBase];
301 swap(loc_prop, swapped_loc_prop);
309 }
else if (
p.second) {
312 assert(inSecondRegion(loc_prop.first) && loc_prop.second == 0);
315 Location swapped_loc = locArray[firstMark];
317 locProps[swapped_loc - locationBase];
320 swap(loc_prop, swapped_loc_prop);
328 panic(
"Location in loadStoreMap but wasn't picked in any"
334 loadStoreMap.clear();
340 assert(loc >= locationBase && loc < locationBase + arraySize);
342 LocProperty& loc_prop = locProps[loc - locationBase];
344 if (inFirstRegion(loc_prop.first)) {
346 assert(loc_prop.second == 1);
349 Location swapped_loc = locArray[firstMark - 1];
350 LocProperty& swapped_loc_prop = locProps[swapped_loc - locationBase];
353 swap(loc_prop, swapped_loc_prop);
360 }
else if (inThirdRegion(loc_prop.first)) {
362 assert(loc_prop.second >= 1);
364 if (loc_prop.second == 1) {
366 Location swapped_loc = locArray[secondMark];
368 locProps[swapped_loc - locationBase];
371 swap(loc_prop, swapped_loc_prop);
380 assert(inSecondRegion(loc_prop.first) && loc_prop.second == 0);
387 ExpectedValueSet::iterator it = expectedValues.find(
val);
389 if (it == expectedValues.end()) {
390 std::stringstream exp_val_ss;
391 for (
auto&
val : expectedValues) {
392 exp_val_ss <<
" " <<
val;
395 warn(
"Expected return values are:\n\t%s\n", exp_val_ss.str());
401 expectedValues.erase(it);
409 int new_idx_1 = prop_2.first;
410 int new_idx_2 = prop_1.first;
413 Location tmp = locArray[prop_1.first];
414 locArray[prop_1.first] = locArray[prop_2.first];
415 locArray[prop_2.first] = tmp;
418 prop_1.first = new_idx_1;
419 prop_2.first = new_idx_2;
425 Value new_value,
Tick cur_tick,
int cu_id)
428 logTable[loc]->update(thread_id, cu_id, episode_id, new_value, cur_tick);
435 return logTable[loc]->getLastStoredValue();
void releaseLoc(Location loc)
std::pair< int, int > LocProperty
AtomicStruct(Location atom_loc, Location loc_begin, Location loc_end)
bool isExpectedValue(Value val)
void swap(LocProperty &prop_1, LocProperty &prop_2)
Addr getAddress(Location loc)
AtomicStructTable atomicStructs
Location getStoreLoc(Location atomic_loc)
Value getLoggedValue(Location loc) const
AddressManager(int n_atomic_locs, int numNormalLocsPerAtomic)
AddressMap randAddressMap
std::string printLastWriter(Location loc) const
void updateLogTable(Location loc, int threadId, int episodeId, Value new_value, Tick curTick, int cuId=-1)
static const int INVALID_LOCATION
Location getLoadLoc(Location atomic_loc)
static const int INVALID_VALUE
void finishLocSelection(Location atomic_loc)
void releaseLocation(Location atomic_loc, Location loc)
bool validateAtomicResp(Location loc, Value ret_val)
static constexpr std::enable_if_t< std::is_integral_v< T >, int > floorLog2(T x)
std::enable_if_t< std::is_integral_v< T >, T > random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
#define panic(...)
This implements a cprintf based panic() function.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
uint64_t Tick
Tick count type.