50 #include "arch/vtophys.hh" 56 #include "params/CheckerCPU.hh" 65 masterId = systemPtr->getMasterId(
this);
69 :
BaseCPU(p, true), systemPtr(NULL), icachePort(NULL), dcachePort(NULL),
70 tc(NULL), thread(NULL),
71 unverifiedReq(nullptr),
72 unverifiedMemData(nullptr)
147 int& frag_size,
int& size_left)
const 149 frag_size = std::min(
152 size_left -= frag_size;
156 if (!byte_enable.empty()) {
158 auto it_start = byte_enable.cbegin() + (size - (frag_size +
160 auto it_end = byte_enable.cbegin() + (size - size_left);
162 mem_req = std::make_shared<Request>(0, frag_addr, frag_size,
168 mem_req = std::make_shared<Request>(0, frag_addr, frag_size,
181 assert(byte_enable.empty() || byte_enable.size() == size);
184 bool checked_flags =
false;
185 bool flags_match =
true;
190 int size_left = size;
196 byte_enable, frag_size,
199 predicate = (mem_req !=
nullptr);
208 mem_req->getPaddr(), mem_req->getFlags());
209 pAddr = mem_req->getPaddr();
210 checked_flags =
true;
214 if (predicate && fault ==
NoFault &&
220 if (!(mem_req->isUncacheable() || mem_req->isMmappedIpr())) {
232 if (mem_req->isPrefetch()) {
245 frag_addr += frag_size;
251 warn(
"%lli: Flags do not match CPU:%#x %#x %#x Checker:%#x %#x %#x\n",
265 assert(byte_enable.empty() || byte_enable.size() == size);
268 bool checked_flags =
false;
269 bool flags_match =
true;
271 static uint8_t zero_data[64] = {};
275 int size_left = size;
281 byte_enable, frag_size,
284 predicate = (mem_req !=
nullptr);
292 mem_req->getPaddr(), mem_req->getFlags());
293 pAddr = mem_req->getPaddr();
294 checked_flags =
true;
304 bool was_prefetch = mem_req->isPrefetch();
307 if (fault !=
NoFault || size_left == 0)
309 if (fault !=
NoFault && was_prefetch) {
315 frag_addr += frag_size;
319 warn(
"%lli: Flags do not match CPU:%#x %#x Checker:%#x %#x %#x\n",
336 bool extraData =
false;
347 assert(
sizeof(zero_data) <= size);
353 warn(
"%lli: Store value does not match value sent to memory! " 354 "data: %#x inst_data: %#x",
curTick(), data,
373 Addr pAddr,
int flags)
375 Addr unverifiedVAddr = unverified_req->getVaddr();
376 Addr unverifiedPAddr = unverified_req->getPaddr();
377 int unverifiedFlags = unverified_req->getFlags();
379 if (unverifiedVAddr != vAddr ||
380 unverifiedPAddr != pAddr ||
381 unverifiedFlags != flags) {
391 warn(
"%lli: Checker PC:%s",
393 panic(
"Checker found an error!");
A MasterPort is a specialisation of a BaseMasterPort, which implements the default protocol for the t...
#define panic(...)
This implements a cprintf based panic() function.
Addr addrBlockOffset(Addr addr, Addr block_size)
Calculates the offset of a given address wrt aligned fixed-size blocks.
decltype(nullptr) constexpr NoFault
std::shared_ptr< Request > RequestPtr
bool checkFlags(const RequestPtr &unverified_req, Addr vAddr, Addr pAddr, int flags)
Checks if the flags set by the Checker and Checkee match.
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
TheISA::PCState pcState() const override
The SimpleThread object provides a combination of the ThreadState object and the ThreadContext interf...
Overload hash function for BasicBlockRange type.
StaticInstPtr curMacroStaticInst
void setDcachePort(MasterPort *dcache_port)
void dataStatic(T *p)
Set the data pointer to the following value that should not be freed.
std::vector< ThreadContext * > threadContexts
Tick curTick()
The current simulated tick.
MasterID masterId
id attached to all issued requests
RequestPtr genMemFragmentRequest(Addr frag_addr, int size, Request::Flags flags, const std::vector< bool > &byte_enable, int &frag_size, int &size_left) const
Helper function used to generate the request for a single fragment of a memory access.
Kernel::Statistics * kernelStats
uint8_t * unverifiedMemData
static const FlagsType STORE_NO_DATA
Fault writeMem(uint8_t *data, unsigned size, Addr addr, Request::Flags flags, uint64_t *res, const std::vector< bool > &byte_enable=std::vector< bool >()) override
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
ThreadContext * getTC()
Returns the pointer to this SimpleThread's ThreadContext.
static PacketPtr createRead(const RequestPtr &req)
Constructor-like methods that return Packets based on Request objects.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Addr dbg_vtophys(Addr addr)
Fault readMem(Addr addr, uint8_t *data, unsigned size, Request::Flags flags, const std::vector< bool > &byte_enable=std::vector< bool >()) override
void serialize(CheckpointOut &cp) const override
Serialize this object to the given output stream.
The request should not cause a memory access.
unsigned int cacheLineSize() const
Get the cache line size of the system.
void setIcachePort(MasterPort *icache_port)
std::vector< Process * > workload
void setSystem(System *system)
const SimObjectParams * _params
Cached copy of the object parameters.
virtual ContextID contextId() const =0
bool isAnyActiveElement(const std::vector< bool >::const_iterator &it_start, const std::vector< bool >::const_iterator &it_end)
Test if there is any active element in an enablement range.
void sendFunctional(PacketPtr pkt) const
Send a functional request packet, where the data is instantly updated everywhere in the memory system...
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
StaticInstPtr curStaticInst
std::shared_ptr< FaultBase > Fault
void unserialize(CheckpointIn &cp) override
Reconstruct the state of this object from a checkpoint.
virtual Fault translateFunctional(const RequestPtr &req, ThreadContext *tc, Mode mode)