49 #include "debug/MemCheckerMonitor.hh" 53 masterPort(
name() +
"-master", *this),
54 slavePort(
name() +
"-slave", *this),
55 warnOnly(params->warn_only),
56 memchecker(params->memchecker)
63 MemCheckerMonitorParams::create()
73 fatal(
"Communication monitor is not connected on both sides.\n");
79 if (if_name ==
"master" || if_name ==
"mem_side") {
81 }
else if (if_name ==
"slave" || if_name ==
"cpu_side") {
102 "Forwarded functional access: addr = %#llx, size = %d\n",
110 unsigned size = pkt->
getSize();
118 "Received functional snoop: addr = %#llx, size = %d\n",
125 panic(
"Atomic not supported");
131 panic(
"Atomic not supported");
145 bool is_read = pkt->
isRead() && !pkt->
req->isPrefetch();
146 bool is_write = pkt->
isWrite();
147 unsigned size = pkt->
getSize();
150 std::unique_ptr<uint8_t[]> pkt_data;
153 if (expects_response && is_write) {
157 pkt_data.reset(
new uint8_t[size]);
165 if (expects_response && (is_read || is_write)) {
174 if (!successful && expects_response && (is_read || is_write)) {
178 if (successful && expects_response) {
198 "Forwarded read request: serial = %d, addr = %#llx, " 201 }
else if (is_write) {
210 "Forwarded write request: serial = %d, addr = %#llx, " 215 "Forwarded non read/write request: addr = %#llx\n", addr);
217 }
else if (successful) {
219 "Forwarded request marked for cache response: addr = %#llx\n",
234 bool is_read = pkt->
isRead() && !pkt->
req->isPrefetch();
235 bool is_write = pkt->
isWrite();
236 bool is_failed_LLSC = pkt->
isLLSC() && pkt->
req->getExtraData() == 0;
237 unsigned size = pkt->
getSize();
239 std::unique_ptr<uint8_t[]> pkt_data;
246 pkt_data.reset(
new uint8_t[size]);
250 if (is_read || is_write) {
256 "Monitor got a response without monitor sender state\n");
270 "Received read response: serial = %d, addr = %#llx, " 272 received_state->
serial, addr, size);
281 warn(
"%s: read of %#llx @ cycle %d failed:\n%s\n",
289 delete received_state;
290 }
else if (is_write) {
292 "Received write response: serial = %d, addr = %#llx, " 294 received_state->
serial, addr, size);
296 if (is_failed_LLSC) {
308 delete received_state;
311 "Received non read/write response: addr = %#llx\n", addr);
313 }
else if (is_read || is_write) {
#define panic(...)
This implements a cprintf based panic() function.
~MemCheckerMonitor()
Destructor.
Ports are used to interface objects to each other.
Tick recvAtomicSnoop(PacketPtr pkt)
bool recvTimingReq(PacketPtr pkt)
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
void completeWrite(Serial serial, Tick complete, Addr addr, size_t size)
Completes a previously started write transaction.
void sendRangeChange() const
Called by the owner to send a range change.
#define fatal(...)
This implements a cprintf based fatal() function.
const std::string & name()
void abortWrite(Serial serial, Addr addr, size_t size)
Aborts a previously started write transaction.
bool sendTimingSnoopResp(PacketPtr pkt)
Attempt to send a timing snoop response packet to the slave port by calling its corresponding receive...
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
bool completeRead(Serial serial, Tick complete, Addr addr, size_t size, uint8_t *data)
Completes a previously started read transaction.
bool cacheResponding() const
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
AddrRangeList getAddrRanges() const
Tick recvAtomic(PacketPtr pkt)
bool sendTimingReq(PacketPtr pkt)
Attempt to send a timing request to the slave port by calling its corresponding receive function...
bool isConnected() const
Is this port currently connected to a peer?
virtual void sendRetryResp()
Send a retry to the slave port that previously attempted a sendTimingResp to this master port and fai...
uint64_t Serial
The Serial type is used to be able to uniquely identify a transaction as it passes through the system...
void sendFunctionalSnoop(PacketPtr pkt) const
Send a functional snoop request packet, where the data is instantly updated everywhere in the memory ...
MemCheckerMonitor(Params *params)
Constructor based on the Python params.
RequestPtr req
A pointer to the original request.
MonitorMasterPort masterPort
Instance of master port, facing the memory side.
const std::string & getErrorMessage() const
In completeRead, if an error is encountered, this does not print nor cause an error, but instead should be handled by the caller.
bool sendTimingResp(PacketPtr pkt)
Attempt to send a timing response to the master port by calling its corresponding receive function...
Tick curTick()
The current simulated tick.
bool needsResponse() const
SenderState * predecessor
uint64_t Tick
Tick count type.
void reset()
Resets the entire checker.
MemCheckerMonitorParams Params
Parameters of memchecker monitor.
void writeData(uint8_t *p) const
Copy data from the packet to the memory at the provided pointer.
void recvFunctionalSnoop(PacketPtr pkt)
bool isSnooping() const
Find out if the peer master port is snooping or not.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
virtual const std::string name() const
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Implements a MemChecker monitor, to be inserted between two ports.
MonitorSlavePort slavePort
Instance of slave port, i.e.
AddrRangeList getAddrRanges() const
Get the address ranges of the connected slave port.
void sendRetryReq()
Send a retry to the master port that previously attempted a sendTimingReq to this slave port and fail...
SenderState * senderState
This packet's sender state.
void recvTimingSnoopReq(PacketPtr pkt)
Serial startWrite(Tick start, Addr addr, size_t size, const uint8_t *data)
Starts a write transaction.
void sendTimingSnoopReq(PacketPtr pkt)
Attempt to send a timing snoop request packet to the master port by calling its corresponding receive...
bool recvTimingSnoopResp(PacketPtr pkt)
void recvFunctional(PacketPtr pkt)
void pushSenderState(SenderState *sender_state)
Push a new sender state to the packet and make the current sender state the predecessor of the new on...
SenderState * popSenderState()
Pop the top of the state stack and return a pointer to it.
void sendFunctional(PacketPtr pkt) const
Send a functional request packet, where the data is instantly updated everywhere in the memory system...
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
bool recvTimingResp(PacketPtr pkt)
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Serial startRead(Tick start, Addr addr, size_t size)
Starts a read transaction.
Abstract superclass for simulation objects.
MemChecker::Serial serial