50 #include "debug/MemTest.hh"
63 memtest.completeRequest(pkt);
79 if (!port.sendTimingReq(pkt)) {
91 noResponseEvent(this),
95 interval(p->interval),
96 percentReads(p->percent_reads),
97 percentFunctional(p->percent_functional),
98 percentUncacheable(p->percent_uncacheable),
100 blockSize(p->
system->cacheLineSize()),
101 blockAddrMask(blockSize - 1),
102 progressInterval(p->progress_interval),
103 progressCheck(p->progress_check),
104 nextProgressMessage(p->progress_interval),
105 maxLoads(p->max_loads),
106 atomic(p->
system->isAtomicMode()),
107 suppressFuncWarnings(p->suppress_func_warnings)
130 if (if_name ==
"port")
148 pkt->
isWrite() ?
"write" :
"read",
150 pkt->
isError() ?
"error" :
"success");
152 const uint8_t *pkt_data = pkt->
getConstPtr<uint8_t>();
156 warn(
"%s access failed at %#x\n",
162 if (pkt_data[0] != ref_data) {
163 panic(
"%s: read of %x (blk %x) @ cycle %d "
164 "returns %x, expected %x\n",
name(),
166 pkt_data[0], ref_data);
173 ccprintf(cerr,
"%s: completed %d read, %d write accesses @%d\n",
204 using namespace Stats;
208 .
desc(
"number of read accesses completed")
213 .
desc(
"number of write accesses completed")
256 "Tester %s has more than 100 outstanding requests\n",
name());
259 uint8_t *pkt_data =
new uint8_t[1];
269 ref_data = ref->second;
273 "Initiating %sread at addr %x (blk %x) expecting %x\n",
274 do_functional ?
"functional " :
"", req->
getPaddr(),
278 pkt->dataDynamic(pkt_data);
280 DPRINTF(
MemTest,
"Initiating %swrite at addr %x (blk %x) value %x\n",
281 do_functional ?
"functional " :
"", req->
getPaddr(),
285 pkt->dataDynamic(pkt_data);
290 bool keep_ticking =
true;
292 pkt->setSuppressFuncError();
337 MemTestParams::create()
void ccprintf(cp::Print &print)
EventWrapper< MemTest,&MemTest::tick > tickEvent
bool sendPkt(PacketPtr pkt)
const std::string & name()
virtual BaseMasterPort & getMasterPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a master port with a given name and index.
const unsigned percentFunctional
void recvReqRetry()
Called by the slave port if sendTimingReq was called on this master port (causing recvTimingReq to be...
const unsigned progressInterval
panic_if(!root,"Invalid expression\n")
void setContext(ContextID context_id)
Set up Context numbers.
std::unordered_map< Addr, uint8_t > referenceData
bool sendTimingReq(PacketPtr pkt)
Attempt to send a timing request to the slave port by calling its corresponding receive function...
EventWrapper< MemTest,&MemTest::noResponse > noResponseEvent
Declaration of Statistics objects.
std::enable_if< std::is_integral< T >::value, T >::type random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
Addr blockAlign(Addr addr) const
Get the block aligned address.
MasterID masterId
Request id for all generated traffic.
Tick clockEdge(Cycles cycles=Cycles(0)) const
Determine the tick when a cycle begins, by default the current one, but the argument also enables the...
Tick curTick()
The current simulated tick.
The request is to an uncacheable address.
The MemTest class tests a cache coherent memory system by generating false sharing and verifying the ...
EventWrapper< MemTest,&MemTest::noRequest > noRequestEvent
const RequestPtr req
A pointer to the original request.
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the slave port.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Stats::Scalar numReadsStat
unsigned int TESTER_ALLOCATOR
std::set< Addr > outstandingAddrs
static const int NumArgumentRegs M5_VAR_USED
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
void reschedule(Event &event, Tick when, bool always=false)
void exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat, bool serialize)
Schedule an event to exit the simulation loop (returning to Python) at the end of the current cycle (...
virtual const std::string name() const
const unsigned percentUncacheable
const bool suppressFuncWarnings
const Cycles progressCheck
The MemObject class extends the ClockedObject with accessor functions to get its master and slave por...
A BaseMasterPort is a protocol-agnostic master port, responsible only for the structural connection t...
const unsigned percentReads
void schedule(Event &event, Tick when)
virtual void regStats()
Register statistics for this object.
Stats::Scalar numWritesStat
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
void completeRequest(PacketPtr pkt, bool functional=false)
Complete a request by checking the response.
const T * getConstPtr() const
fatal_if(p->js_features.size() > 16,"Too many job slot feature registers specified (%i)\n", p->js_features.size())
void regStats() override
Register statistics for this object.
virtual BaseMasterPort & getMasterPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a master port with a given name and index.
void sendFunctional(PacketPtr pkt)
Send a functional request packet, where the data is instantly updated everywhere in the memory system...
ProbePointArg< PacketInfo > Packet
Packet probe point.