46#ifndef __MEM_PORT_HH__
47#define __MEM_PORT_HH__
83 std::unique_ptr<ExtensionBase>
clone()
const override
85 return std::make_unique<TracingExtension>(
trace_);
92 trace_.push(response_port);
106 std::stringstream port_trace;
107 std::stack<std::string> copy_stack =
trace_;
108 port_trace <<
"Port trace of the Packet (" << std::endl
110 while (!copy_stack.empty()) {
111 if (copy_stack.size() == 1)
112 port_trace <<
"[Source] ";
113 port_trace << copy_stack.top() << std::endl;
117 return port_trace.str();
146 [[deprecated(
"RequestPort ownership is deprecated. "
147 "Owner should now be registered in derived classes.")]]
305 panic(
"%s was not expecting an atomic snoop request\n",
name());
312 panic(
"%s was not expecting a functional snoop request\n",
name());
318 panic(
"%s was not expecting a timing snoop request.\n",
name());
324 panic(
"%s was not expecting a snoop retry.\n",
name());
335 using RequestPort::RequestPort;
361 [[deprecated(
"ResponsePort ownership is deprecated. "
362 "Owner should now be registered in derived classes.")]]
535 panic(
"%s was not expecting a %s\n",
name(), __func__);
541 panic(
"%s was not expecting a timing snoop response\n",
name());
548 using ResponsePort::ResponsePort;
Tick sendBackdoor(AtomicResponseProtocol *peer, PacketPtr pkt, MemBackdoorPtr &backdoor)
Send an atomic request packet like above, but also request a backdoor to the data being accessed.
Tick send(AtomicResponseProtocol *peer, PacketPtr pkt)
Send an atomic request packet, where the data is moved and the state is updated in zero time,...
Tick sendSnoop(AtomicRequestProtocol *peer, PacketPtr pkt)
Send an atomic snoop request packet, where the data is moved and the state is updated in zero time,...
This is the extension for carrying additional information.
void sendMemBackdoorReq(FunctionalResponseProtocol *peer, const MemBackdoorReq &req, MemBackdoorPtr &backdoor)
Send a request for a back door to a range of memory.
void send(FunctionalResponseProtocol *peer, PacketPtr pkt) const
Send a functional request packet, where the data is instantly updated everywhere in the memory system...
void sendSnoop(FunctionalRequestProtocol *peer, PacketPtr pkt) const
Send a functional snoop request packet, where the data is instantly updated everywhere in the memory ...
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Ports are used to interface objects to each other.
const std::string name() const
Return port name (for DPRINTF).
void reportUnbound() const
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
void sendMemBackdoorReq(const MemBackdoorReq &req, MemBackdoorPtr &backdoor)
Send a request for a back door to a range of memory.
virtual void sendRetryResp()
Send a retry to the response port that previously attempted a sendTimingResp to this request port and...
void recvTimingSnoopReq(PacketPtr pkt) override
Receive a timing snoop request from the peer.
virtual void recvRangeChange()
Called to receive an address range change from the peer response port.
void unbind() override
Unbind this request port and the associated response port.
virtual bool isSnooping() const
Determine if this request port is snooping or not.
bool tryTiming(PacketPtr pkt) const
Check if the responder can handle a timing request.
Tick recvAtomicSnoop(PacketPtr pkt) override
Default implementations.
ResponsePort * _responsePort
Tick sendAtomic(PacketPtr pkt)
Send an atomic request packet, where the data is moved and the state is updated in zero time,...
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
bool sendTimingReq(PacketPtr pkt)
Attempt to send a timing request to the responder port by calling its corresponding receive function.
void recvRetrySnoopResp() override
Called by the peer if sendTimingSnoopResp was called on this protocol (causing recvTimingSnoopResp to...
void removeTrace(PacketPtr pkt) const
bool sendTimingSnoopResp(PacketPtr pkt)
Attempt to send a timing snoop response packet to the response port by calling its corresponding rece...
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...
void recvFunctionalSnoop(PacketPtr pkt) override
Receive a functional snoop request packet from the peer.
Tick sendAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor)
Send an atomic request packet like above, but also request a backdoor to the data being accessed.
A ResponsePort is a specialization of a port.
bool sendTimingResp(PacketPtr pkt)
Attempt to send a timing response to the request port by calling its corresponding receive function.
void sendFunctionalSnoop(PacketPtr pkt) const
Send a functional snoop request packet, where the data is instantly updated everywhere in the memory ...
bool tryTiming(PacketPtr pkt) override
Availability request from the peer.
void bind(Port &peer) override
Attach to a peer port.
void sendRetrySnoopResp()
Send a retry to the request port that previously attempted a sendTimingSnoopResp to this response por...
Tick recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor) override
Default implementations.
bool recvTimingSnoopResp(PacketPtr pkt) override
Receive a timing snoop response from the peer.
Tick sendAtomicSnoop(PacketPtr pkt)
Send an atomic snoop request packet, where the data is moved and the state is updated in zero time,...
ResponsePort(const std::string &name, SimObject *_owner, PortID id=InvalidPortID)
Response port.
void sendTimingSnoopReq(PacketPtr pkt)
Attempt to send a timing snoop request packet to the request port by calling its corresponding receiv...
bool isSnooping() const
Find out if the peer request port is snooping or not.
void responderUnbind()
Called by the request port to unbind.
bool defaultBackdoorWarned
void unbind() override
We let the request port do the work, so these don't do anything.
void sendRangeChange() const
Called by the owner to send a range change.
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.
void sendRetryReq()
Send a retry to the request port that previously attempted a sendTimingReq to this response port and ...
RequestPort * _requestPort
Abstract superclass for simulation objects.
void sendRetryResp(TimingResponseProtocol *peer)
Send a retry to the peer that previously attempted a sendTimingResp to this protocol and failed.
bool trySend(TimingResponseProtocol *peer, PacketPtr pkt) const
Check if the peer can handle a timing request.
bool sendReq(TimingResponseProtocol *peer, PacketPtr pkt)
Attempt to send a timing request to the peer by calling its corresponding receive function.
bool sendSnoopResp(TimingResponseProtocol *peer, PacketPtr pkt)
Attempt to send a timing snoop response packet to it's peer by calling its corresponding receive func...
bool sendResp(TimingRequestProtocol *peer, PacketPtr pkt)
Attempt to send a timing response to the peer by calling its corresponding receive function.
void sendSnoopReq(TimingRequestProtocol *peer, PacketPtr pkt)
Attempt to send a timing snoop request packet to the peer by calling its corresponding receive functi...
void sendRetrySnoopResp(TimingRequestProtocol *peer)
Send a retry to the peer that previously attempted a sendTimingSnoopResp to this peer and failed.
void sendRetryReq(TimingRequestProtocol *peer)
Send a retry to the peer that previously attempted a sendTimingReq to this protocol and failed.
TracingExtension is an Extension of the Packet for recording the trace of the Packet.
std::unique_ptr< ExtensionBase > clone() const override
std::stack< std::string > trace_
TracingExtension()=default
std::stack< std::string > & getTrace()
TracingExtension(const std::stack< std::string > &q)
void add(std::string request_port, std::string response_port, gem5::Addr addr)
std::string getTraceInString()
#define panic(...)
This implements a cprintf based panic() function.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
const PortID InvalidPortID
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
uint64_t Tick
Tick count type.
std::string csprintf(const char *format, const Args &...args)
Declaration of the Packet class.