32 #include "debug/SimpleMemobj.hh" 36 instPort(params->
name +
".inst_port", this),
37 dataPort(params->
name +
".data_port", this),
38 memPort(params->
name +
".mem_side", this),
49 if (if_name ==
"mem_side") {
51 }
else if (if_name ==
"inst_port") {
53 }
else if (if_name ==
"data_port") {
66 panic_if(blockedPacket !=
nullptr,
"Should never try to send if blocked!");
69 if (!sendTimingResp(pkt)) {
77 return owner->getAddrRanges();
83 if (needRetry && blockedPacket ==
nullptr) {
95 return owner->handleFunctional(pkt);
102 if (!owner->handleRequest(pkt)) {
114 assert(blockedPacket !=
nullptr);
118 blockedPacket =
nullptr;
129 panic_if(blockedPacket !=
nullptr,
"Should never try to send if blocked!");
132 if (!sendTimingReq(pkt)) {
141 return owner->handleResponse(pkt);
148 assert(blockedPacket !=
nullptr);
152 blockedPacket =
nullptr;
161 owner->sendRangeChange();
196 if (pkt->
req->isInstFetch()) {
235 SimpleMemobjParams::create()
bool handleResponse(PacketPtr pkt)
Handle the respone from the memory side.
Ports are used to interface objects to each other.
bool recvTimingReq(PacketPtr pkt) override
Receive a timing request from the master port.
void sendRangeChange() const
Called by the owner to send a range change.
AddrRangeList getAddrRanges() const override
Get a list of the non-overlapping address ranges the owner is responsible for.
const std::string & name()
const PortID InvalidPortID
void recvRangeChange() override
Called to receive an address range change from the peer slave port.
AddrRangeList getAddrRanges() const
Return the address ranges this memobj is responsible for.
SimpleMemobj(SimpleMemobjParams *params)
constructor
bool recvTimingResp(PacketPtr pkt) override
Receive a timing response from the slave port.
void sendPacket(PacketPtr pkt)
Send a packet across this port.
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
RequestPtr req
A pointer to the original request.
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
bool blocked
True if this is currently blocked waiting for a response.
void sendRangeChange()
Tell the CPU side to ask for our memory ranges.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
bool handleRequest(PacketPtr pkt)
Handle the request from the CPU side.
A very simple memory object.
void sendPacket(PacketPtr pkt)
Send a packet across this port.
AddrRangeList getAddrRanges() const
Get the address ranges of the connected slave port.
CPUSidePort instPort
Instantiation of the CPU-side ports.
void handleFunctional(PacketPtr pkt)
Handle a packet functionally.
void trySendRetry()
Send a retry to the peer port only if it is needed.
MemSidePort memPort
Instantiation of the memory-side port.
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.
void recvReqRetry() override
Called by the slave port if sendTimingReq was called on this master port (causing recvTimingReq to be...
void recvFunctional(PacketPtr pkt) override
Receive a functional request packet from the master port.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Abstract superclass for simulation objects.
void recvRespRetry() override
Called by the master port if sendTimingResp was called on this slave port (causing recvTimingResp to ...