52#include "params/CheckerCPU.hh"
67 systemPtr(NULL), icachePort(NULL), dcachePort(NULL),
68 tc(NULL), thread(NULL),
69 unverifiedReq(nullptr),
70 unverifiedMemData(nullptr)
108 mmu,
p.isa[0],
p.decoder[0]);
143 int& frag_size,
int& size_left)
const
145 frag_size = std::min(
148 size_left -= frag_size;
153 auto it_start = byte_enable.cbegin() + (size - (frag_size +
155 auto it_end = byte_enable.cbegin() + (size - size_left);
157 mem_req = std::make_shared<Request>(frag_addr, frag_size,
171 assert(byte_enable.size() == size);
174 bool checked_flags =
false;
175 bool flags_match =
true;
180 int size_left = size;
186 byte_enable, frag_size,
189 predicate = (mem_req !=
nullptr);
198 mem_req->getPaddr(), mem_req->getFlags());
199 pAddr = mem_req->getPaddr();
200 checked_flags =
true;
204 if (predicate && fault ==
NoFault &&
210 if (!(mem_req->isUncacheable() || mem_req->isLocalAccess())) {
222 if (mem_req->isPrefetch()) {
235 frag_addr += frag_size;
241 warn(
"%lli: Flags do not match CPU:%#x %#x %#x Checker:%#x %#x %#x\n",
255 assert(byte_enable.size() == size);
258 bool checked_flags =
false;
259 bool flags_match =
true;
261 static uint8_t zero_data[64] = {};
265 int size_left = size;
271 byte_enable, frag_size,
274 predicate = (mem_req !=
nullptr);
282 mem_req->getPaddr(), mem_req->getFlags());
283 pAddr = mem_req->getPaddr();
284 checked_flags =
true;
294 bool was_prefetch = mem_req->isPrefetch();
297 if (fault !=
NoFault || size_left == 0)
299 if (fault !=
NoFault && was_prefetch) {
305 frag_addr += frag_size;
309 warn(
"%lli: Flags do not match CPU:%#x %#x Checker:%#x %#x %#x\n",
326 bool extraData =
false;
337 assert(
sizeof(zero_data) <= size);
343 warn(
"%lli: Store value does not match value sent to memory! "
359 Addr unverifiedVAddr = unverified_req->getVaddr();
360 Addr unverifiedPAddr = unverified_req->getPaddr();
361 int unverifiedFlags = unverified_req->getFlags();
363 if (unverifiedVAddr != vAddr ||
364 unverifiedPAddr != pAddr ||
365 unverifiedFlags !=
flags) {
375 warn(
"%lli: Checker PC:%s",
377 panic(
"Checker found an error!");
Addr cacheLineSize() const
Get the cache line size of the system.
std::vector< ThreadContext * > threadContexts
virtual void setThreadContext(ThreadContext *_tc)
virtual Fault translateFunctional(const RequestPtr &req, ThreadContext *tc, Mode mode)
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Fault readMem(Addr addr, uint8_t *data, unsigned size, Request::Flags flags, const std::vector< bool > &byte_enable) override
StaticInstPtr curStaticInst
void serialize(CheckpointOut &cp) const override
Serialize this object to the given output stream.
void setIcachePort(RequestPort *icache_port)
CheckerCPU(const Params &p)
void setSystem(System *system)
std::vector< Process * > workload
Fault writeMem(uint8_t *data, unsigned size, Addr addr, Request::Flags flags, uint64_t *res, const std::vector< bool > &byte_enable) override
RequestorID requestorId
id attached to all issued requests
void unserialize(CheckpointIn &cp) override
Reconstruct the state of this object from a checkpoint.
bool checkFlags(const RequestPtr &unverified_req, Addr vAddr, Addr pAddr, int flags)
Checks if the flags set by the Checker and Checkee match.
uint8_t * unverifiedMemData
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.
void setDcachePort(RequestPort *dcache_port)
StaticInstPtr curMacroStaticInst
ClockedObjectParams Params
Parameters of ClockedObject.
Addr instAddr() const
Returns the memory address of the instruction this PC points to.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
void dataStatic(T *p)
Set the data pointer to the following value that should not be freed.
static PacketPtr createRead(const RequestPtr &req)
Constructor-like methods that return Packets based on Request objects.
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
void sendFunctional(PacketPtr pkt) const
Send a functional request packet, where the data is instantly updated everywhere in the memory system...
@ NO_ACCESS
The request should not cause a memory access.
static const FlagsType STORE_NO_DATA
The SimpleThread object provides a combination of the ThreadState object and the ThreadContext interf...
const PCStateBase & pcState() const override
ThreadContext * getTC()
Returns the pointer to this SimpleThread's ThreadContext.
RequestorID getRequestorId(const SimObject *requestor, std::string subrequestor={})
Request an id used to create a request object in the system.
virtual BaseISA * getIsaPtr() const =0
virtual ContextID contextId() const =0
#define panic(...)
This implements a cprintf based panic() function.
const Params & params() const
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::shared_ptr< FaultBase > Fault
std::shared_ptr< Request > RequestPtr
Tick curTick()
The universal simulation clock.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Addr addrBlockOffset(Addr addr, Addr block_size)
Calculates the offset of a given address wrt aligned fixed-size blocks.
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
constexpr decltype(nullptr) NoFault
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.