36#include "debug/ProtocolTest.hh"
59 assert(
ep !=
nullptr);
148 int num_reg_loads = \
149 rng->random<
unsigned int>() %
tester->getEpisodeLength();
150 int num_reg_stores =
tester->getEpisodeLength() - num_reg_loads;
164 int tokens_needed = 0;
173 for (
int lane = 0; lane <
numLanes; ++lane) {
185 return tokens_needed;
198 bool haveTokens =
true;
251 for (
int lane = 0; lane <
numLanes; ++lane) {
284 panic(
"The tester got an invalid action\n");
318 panic(
"The tester got an invalid action\n");
336 OutstandingReqTable::iterator it = req_table.find(address);
339 if (it == req_table.end()) {
345 (it->second).push_back(req);
352 OutstandingReqTable::iterator it = req_table.find(
addr);
355 assert(it != req_table.end());
359 assert(!req_list.empty());
368 if (req_list.empty()) {
378 if (!
addrManager->validateAtomicResp(loc, ret_val)) {
379 std::stringstream
ss;
383 ss <<
threadName <<
": Atomic Op returned unexpected value\n"
384 <<
"\tEpisode " <<
curEpisode->getEpisodeId() <<
"\n"
385 <<
"\tLane ID " << lane <<
"\n"
387 <<
"\tAtomic Op's return value " << ret_val <<
"\n";
403 std::stringstream
ss;
407 ss <<
threadName <<
": Loaded value is not consistent with "
408 <<
"the last stored value\n"
409 <<
"\tTesterThread " <<
threadId <<
"\n"
410 <<
"\tEpisode " <<
curEpisode->getEpisodeId() <<
"\n"
411 <<
"\tLane ID " << lane <<
"\n"
413 <<
"\tLoaded value " << ret_val <<
"\n"
414 <<
"\tLast writer " <<
addrManager->printLastWriter(loc) <<
"\n";
442 std::stringstream
ss;
446 <<
"\tCurrent cycle: " <<
curCycle() <<
"\n"
454 }
else if (!
tester->checkExit()) {
464 std::stringstream&
ss)
const
468 for (
const auto&
m : table) {
469 for (
const auto& req :
m.second) {
471 <<
": delta (curCycle - issueCycle) = "
472 << (cur_cycle - req.issueCycle) << std::endl;
481 ss <<
"\t\tOutstanding Loads:\n";
483 ss <<
"\t\tOutstanding Stores:\n";
485 ss <<
"\t\tOutstanding Atomics:\n";
487 ss <<
"\t\tNumber of outstanding acquires & releases: "
static const int INVALID_LOCATION
ClockedObject(const ClockedObjectParams &p)
Cycles curCycle() const
Determine the current cycle, corresponding to a tick aligned to a clock edge.
Tick nextCycle() const
Based on the clock of the object, determine the start tick of the first cycle that is at least one cy...
Cycles is a wrapper class for representing cycle counts, i.e.
TesterThread(const Params &p)
AddressManager * addrManager
AddressManager::Value Value
void attachTesterThreadToPorts(ProtocolTester *_tester, ProtocolTester::SeqPort *_port, ProtocolTester::GMTokenPort *_tokenPort=nullptr, ProtocolTester::SeqPort *_sqcPort=nullptr, ProtocolTester::SeqPort *_scalarPort=nullptr)
virtual void issueReleaseOp()=0
OutstandingReqTable outstandingAtomics
AddressManager::Location Location
void scheduleDeadlockCheckEvent()
void validateAtomicResp(Location loc, int lane, Value ret_val)
ProtocolTester::SeqPort * port
bool checkDRF(Location atomic_loc, Location loc, bool isStore) const
void printAllOutstandingReqs(std::stringstream &ss) const
DeadlockCheckEvent deadlockCheckEvent
virtual void issueAcquireOp()=0
ProtocolTester::SeqPort * scalarPort
OutstandingReqTable outstandingStores
void addOutstandingReqs(OutstandingReqTable &req_table, Addr addr, int lane, Location loc, Value stored_val=AddressManager::INVALID_VALUE)
virtual void issueStoreOps()=0
OutstandingReqTable outstandingLoads
ProtocolTester::GMTokenPort * tokenPort
EpisodeHistory episodeHistory
OutstandingReq popOutstandingReq(OutstandingReqTable &req_table, Addr address)
const Episode::Action * curAction
virtual void issueAtomicOps()=0
ProtocolTester::SeqPort * sqcPort
void printOutstandingReqs(const OutstandingReqTable &table, std::stringstream &ss) const
TesterThreadParams Params
virtual void issueLoadOps()=0
std::unordered_map< Addr, OutstandingReqList > OutstandingReqTable
TesterThreadEvent threadEvent
std::vector< OutstandingReq > OutstandingReqList
std::string printAddress(Addr addr) const
void validateLoadResp(Location loc, int lane, Value ret_val)
static constexpr std::enable_if_t< std::is_integral_v< T >, int > floorLog2(T x)
void schedule(Event &event, Tick when)
#define panic(...)
This implements a cprintf based panic() function.
std::string printAddress(Addr addr, int cacheLineBits)
Copyright (c) 2024 Arm Limited All rights reserved.
Tick curTick()
The universal simulation clock.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.