35#include <unordered_set>
39#include "debug/EpisodeCount.hh"
103 while ((num_loads + num_stores) > 0) {
104 switch (
rng->random<
unsigned int>() % 2) {
113 if (num_stores > 0) {
131 for (
int lane = 0; lane <
numLanes; ++lane) {
145 switch (action->getType()) {
158 normal_loc,
false) ||
161 panic(
"TestTh %d - Data race detected. STOPPED!\n",
162 thread->getTesterThreadId());
166 action->setLocation(lane, normal_loc);
180 panic(
"TestTh %d - Data race detected. STOPPED!\n",
181 thread->getTesterThreadId());
185 action->setLocation(lane, normal_loc);
192 panic(
"Invalid action type\n");
205 for (
int lane = 0; lane <
numLanes; ++lane) {
209 std::unordered_set<Location> unique_loc_set;
214 if (action->isAtomicAction()) {
216 atomic_loc = action->getLocation(lane);
220 assert(atomic_loc == action->getLocation(lane));
222 }
else if (!action->isMemFenceAction()) {
223 assert(atomic_loc >= 0);
224 normal_loc = action->getLocation(lane);
227 unique_loc_set.insert(normal_loc);
248 for (
int lane = 0; lane < max_lane; ++lane) {
251 if (!action->isAtomicAction() &&
252 !action->isMemFenceAction()) {
253 if (isStore && loc == action->getLocation(lane)) {
254 warn(
"ST at location %d races against thread %d\n",
255 loc,
thread->getTesterThreadId());
257 }
else if (!isStore &&
259 loc == action->getLocation(lane)) {
260 warn(
"LD at location %d races against thread %d\n",
261 loc,
thread->getTesterThreadId());
285 assert(lane >= 0 && lane <
numLanes);
292 assert(lane >= 0 && lane <
numLanes);
322 panic(
"Invalid action type\n");
static const int INVALID_LOCATION
Action(Type t, int num_lanes)
Location getLocation(int lane) const
const std::string printType() const
bool isMemFenceAction() const
bool isAtomicAction() const
void setLocation(int lane, Location loc)
Episode(ProtocolTester *tester, TesterThread *thread, int num_loads, int num_stores)
AddressManager::Location Location
bool checkDRF(Location atomic_loc, Location loc, bool isStore, int max_lane) const
AddressManager * addrManager
const Action * peekCurAction() const
AtomicLocationList atomicLocs
#define panic(...)
This implements a cprintf based panic() function.
Copyright (c) 2024 Arm Limited All rights reserved.