48#include "debug/PortTrace.hh"
49#include "debug/ResponsePort.hh"
58class DefaultRequestPort :
public RequestPort
64 throw UnboundPortException();
68 DefaultRequestPort() : RequestPort(
"default_request_port") {}
74 bool recvTimingResp(
PacketPtr)
override { blowUp(); }
75 void recvTimingSnoopReq(
PacketPtr)
override { blowUp(); }
76 void recvReqRetry()
override { blowUp(); }
77 void recvRetrySnoopResp()
override { blowUp(); }
80 void recvFunctionalSnoop(
PacketPtr)
override { blowUp(); }
83class DefaultResponsePort :
public ResponsePort
89 throw UnboundPortException();
93 DefaultResponsePort() : ResponsePort(
"default_response_port") {}
99 bool recvTimingReq(
PacketPtr)
override { blowUp(); }
100 bool tryTiming(
PacketPtr)
override { blowUp(); }
101 bool recvTimingSnoopResp(
PacketPtr)
override { blowUp(); }
102 void recvRespRetry()
override { blowUp(); }
105 void recvFunctional(
PacketPtr)
override { blowUp(); }
107 recvMemBackdoorReq(
const MemBackdoorReq &,
MemBackdoorPtr &)
override
116DefaultRequestPort defaultRequestPort;
117DefaultResponsePort defaultResponsePort;
128 Port(
name, _id), _responsePort(&defaultResponsePort), owner{*_owner}
139 Port(
name, _id), _responsePort(&defaultResponsePort),
152 fatal_if(!response_port,
"Can't bind port %s to non-response port %s.",
165 "not bound.",
name());
180 auto req = std::make_shared<Request>(
193 if (!gem5::debug::PortTrace || !pkt)
197 ext = std::make_shared<TracingExtension>();
206 if (!gem5::debug::PortTrace || !pkt)
209 panic_if(!
ext,
"There is no TracingExtension in the packet.");
222 _requestPort(&defaultRequestPort),
223 defaultBackdoorWarned(false),
237 _requestPort(&defaultRequestPort),
238 defaultBackdoorWarned(false),
266 "Port %s doesn't support requesting a back door.",
name());
278 "Port %s doesn't support requesting a back door.",
name());
virtual Tick recvAtomic(PacketPtr pkt)=0
Receive an atomic request packet from the peer.
void setExtension(std::shared_ptr< T > ext)
Set a new extension to the packet and replace the old one, if there already exists the same type of e...
std::shared_ptr< T > getExtension()
Get the extension pointer by linear search with the extensionID.
Object used to maintain state of a PrintReq.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
SenderState * senderState
This packet's sender state.
Ports are used to interface objects to each other.
bool isConnected() const
Is this port currently connected to a peer?
const std::string name() const
Return port name (for DPRINTF).
virtual void unbind()
Dettach from a peer port.
virtual void bind(Port &peer)
Attach to a peer port.
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
void unbind() override
Unbind this request port and the associated response port.
ResponsePort * _responsePort
AddrRangeList getAddrRanges() const
Get the address ranges of the connected responder port.
void bind(Port &peer) override
Bind this request port to a response port.
void addTrace(PacketPtr pkt) const
void removeTrace(PacketPtr pkt) const
RequestPort(const std::string &name, SimObject *_owner, PortID id=InvalidPortID)
Request port.
void sendFunctional(PacketPtr pkt) const
Send a functional request packet, where the data is instantly updated everywhere in the memory system...
void printAddr(Addr a)
Inject a PrintReq for the given address to print the state of that address throughout the memory syst...
@ funcRequestorId
This requestor id is used for functional requests that don't come from a particular device.
A ResponsePort is a specialization of a port.
Tick recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor) override
Default implementations.
ResponsePort(const std::string &name, SimObject *_owner, PortID id=InvalidPortID)
Response port.
void responderUnbind()
Called by the request port to unbind.
bool defaultBackdoorWarned
void responderBind(RequestPort &request_port)
Called by the request port to bind.
virtual AddrRangeList getAddrRanges() const =0
Get a list of the non-overlapping address ranges the owner is responsible for.
void recvMemBackdoorReq(const MemBackdoorReq &req, MemBackdoorPtr &backdoor) override
Receive a request for a back door to a range of memory.
RequestPort * _requestPort
Abstract superclass for simulation objects.
TracingExtension is an Extension of the Packet for recording the trace of the Packet.
std::list< AddrRange > AddrRangeList
Convenience typedef for a collection of address ranges.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
MemBackdoor * MemBackdoorPtr
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
uint64_t Tick
Tick count type.
const std::string & name()