32#include "debug/SimpleMemobj.hh"
39 instPort(params.
name +
".inst_port", this),
40 dataPort(params.
name +
".data_port", this),
41 memPort(params.
name +
".mem_side", this),
52 if (if_name ==
"mem_side") {
54 }
else if (if_name ==
"inst_port") {
56 }
else if (if_name ==
"data_port") {
80 return owner->getAddrRanges();
86 if (needRetry && blockedPacket ==
nullptr) {
98 return owner->handleFunctional(pkt);
105 if (!owner->handleRequest(pkt)) {
117 assert(blockedPacket !=
nullptr);
121 blockedPacket =
nullptr;
132 panic_if(blockedPacket !=
nullptr,
"Should never try to send if blocked!");
135 if (!sendTimingReq(pkt)) {
144 return owner->handleResponse(pkt);
151 assert(blockedPacket !=
nullptr);
155 blockedPacket =
nullptr;
164 owner->sendRangeChange();
199 if (pkt->
req->isInstFetch()) {
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
RequestPtr req
A pointer to the original request.
Ports are used to interface objects to each other.
AddrRangeList getAddrRanges() const
Get the address ranges of the connected responder port.
void sendFunctional(PacketPtr pkt) const
Send a functional request packet, where the data is instantly updated everywhere in the memory system...
bool sendTimingResp(PacketPtr pkt)
Attempt to send a timing response to the request port by calling its corresponding receive function.
void sendRangeChange() const
Called by the owner to send a range change.
Abstract superclass for simulation objects.
PacketPtr blockedPacket
If we tried to send a packet and it was blocked, store it here.
bool recvTimingReq(PacketPtr pkt) override
Receive a timing request from the request port.
void recvFunctional(PacketPtr pkt) override
Receive a functional request packet from the request port.
AddrRangeList getAddrRanges() const override
Get a list of the non-overlapping address ranges the owner is responsible for.
void recvRespRetry() override
Called by the request port if sendTimingResp was called on this response port (causing recvTimingResp...
void trySendRetry()
Send a retry to the peer port only if it is needed.
void sendPacket(PacketPtr pkt)
Send a packet across this port.
void recvRangeChange() override
Called to receive an address range change from the peer responder port.
bool recvTimingResp(PacketPtr pkt) override
Receive a timing response from the response port.
void recvReqRetry() override
Called by the response port if sendTimingReq was called on this request port (causing recvTimingReq t...
void sendPacket(PacketPtr pkt)
Send a packet across this port.
A very simple memory object.
bool handleResponse(PacketPtr pkt)
Handle the respone from the memory side.
MemSidePort memPort
Instantiation of the memory-side port.
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
bool handleRequest(PacketPtr pkt)
Handle the request from the CPU side.
CPUSidePort instPort
Instantiation of the CPU-side ports.
AddrRangeList getAddrRanges() const
Return the address ranges this memobj is responsible for.
bool blocked
True if this is currently blocked waiting for a response.
SimpleMemobj(const SimpleMemobjParams ¶ms)
constructor
void handleFunctional(PacketPtr pkt)
Handle a packet functionally.
void sendRangeChange()
Tell the CPU side to ask for our memory ranges.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
const PortID InvalidPortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
const std::string & name()