50 : numAtomicLocs(n_atomic_locs),
51 numLocsPerAtomic(n_normal_locs_per_atomic)
97 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;
212 LdStMap::iterator it = loadStoreMap.find(ret_loc);
214 if (it == loadStoreMap.end()) {
221 (it->second).first =
true;
231 assert(firstMark >= 0);
232 assert(firstMark <= secondMark);
233 assert(secondMark <= arraySize);
235 if (firstMark == secondMark) {
240 int range_size = secondMark - firstMark;
244 LdStMap::iterator it = loadStoreMap.find(ret_loc);
246 if (it == loadStoreMap.end()) {
253 (it->second).second =
true;
270 assert(firstMark >= 0);
271 assert(firstMark <= secondMark);
272 assert(secondMark <= arraySize);
274 for (
auto& it : loadStoreMap) {
278 assert(loc >= locationBase && loc < locationBase + arraySize);
279 LocProperty& loc_prop = locProps[loc - locationBase];
281 if (
p.first && !
p.second) {
284 assert(inSecondRegion(loc_prop.first) ||
285 inThirdRegion(loc_prop.first));
287 if (inSecondRegion(loc_prop.first)) {
289 assert(loc_prop.second == 0);
292 Location swapped_loc = locArray[secondMark - 1];
294 locProps[swapped_loc - locationBase];
297 swap(loc_prop, swapped_loc_prop);
305 }
else if (
p.second) {
308 assert(inSecondRegion(loc_prop.first) && loc_prop.second == 0);
311 Location swapped_loc = locArray[firstMark];
313 locProps[swapped_loc - locationBase];
316 swap(loc_prop, swapped_loc_prop);
324 panic(
"Location in loadStoreMap but wasn't picked in any"
330 loadStoreMap.clear();
336 assert(loc >= locationBase && loc < locationBase + arraySize);
338 LocProperty& loc_prop = locProps[loc - locationBase];
340 if (inFirstRegion(loc_prop.first)) {
342 assert(loc_prop.second == 1);
345 Location swapped_loc = locArray[firstMark - 1];
346 LocProperty& swapped_loc_prop = locProps[swapped_loc - locationBase];
349 swap(loc_prop, swapped_loc_prop);
356 }
else if (inThirdRegion(loc_prop.first)) {
358 assert(loc_prop.second >= 1);
360 if (loc_prop.second == 1) {
362 Location swapped_loc = locArray[secondMark];
364 locProps[swapped_loc - locationBase];
367 swap(loc_prop, swapped_loc_prop);
376 assert(inSecondRegion(loc_prop.first) && loc_prop.second == 0);
383 ExpectedValueSet::iterator it = expectedValues.find(
val);
385 if (it == expectedValues.end()) {
386 std::stringstream exp_val_ss;
387 for (
auto&
val : expectedValues) {
388 exp_val_ss <<
" " <<
val;
391 warn(
"Expected return values are:\n\t%s\n", exp_val_ss.str());
397 expectedValues.erase(it);
405 int new_idx_1 = prop_2.first;
406 int new_idx_2 = prop_1.first;
409 Location tmp = locArray[prop_1.first];
410 locArray[prop_1.first] = locArray[prop_2.first];
411 locArray[prop_2.first] = tmp;
414 prop_1.first = new_idx_1;
415 prop_2.first = new_idx_2;
421 Value new_value,
Tick cur_tick,
int cu_id)
424 logTable[loc]->update(thread_id, cu_id, episode_id, new_value, cur_tick);
431 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.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
uint64_t Tick
Tick count type.