45#include "debug/ExternalPort.hh"
89 const std::string &name_,
91 const std::string &port_data)
95 DPRINTF(ExternalPort,
"finding stub port '%s'\n", port_data);
103 if (debug::ExternalPort) {
104 [[maybe_unused]]
unsigned int size = packet->
getSize();
107 " data: ...\n", packet->
getAddr(), size);
156 fatal(
"StubSlavePort: function: %s\n", __func__);
173 fatal(
"StubSlavePort: unimplemented function: %s\n", __func__);
176std::map<std::string, ExternalSlave::Handler *>
182 return owner.addrRanges;
201 if (if_name ==
"port") {
215 fatal(
"%s: Can't find external port type: %s"
229 fatal(
"ExternalSlave %s: externalPort not set!\n",
name());
231 fatal(
"ExternalSlave %s is unconnected!\n",
name());
#define DDUMP(x, data, count)
DPRINTF is a debugging trace facility that allows one to selectively enable tracing statements.
Derive from this class to create an external port interface.
AddrRangeList getAddrRanges() const
Any or all of recv... can be overloaded to provide the port's functionality.
ExternalPort(const std::string &name_, ExternalSlave &owner_)
static void registerHandler(const std::string &handler_name, Handler *handler)
Register a handler which can provide ports with port_type == handler_name.
std::string portName
Name of the bound port.
static std::map< std::string, Handler * > portHandlers
Registered handlers.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
AddrRangeList addrRanges
The Range of addresses supported by the devices on the external side of this port.
std::string portType
Key to select a port handler.
std::string portData
Handler-specific port configuration.
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Port interface.
ExternalSlave(const ExternalSlaveParams ¶ms)
ExternalPort * externalPort
The peer port for the gem5 port "port".
virtual std::string name() const
const T * getConstPtr() const
Ports are used to interface objects to each other.
const std::string name() const
Return port name (for DPRINTF).
bool sendTimingResp(PacketPtr pkt)
Attempt to send a timing response to the request port by calling its corresponding receive function.
void sendRetryReq()
Send a retry to the request port that previously attempted a sendTimingReq to this response port and ...
ExternalSlave::ExternalPort * getExternalPort(const std::string &name_, ExternalSlave &owner, const std::string &port_data)
Create or find an external port which can be bound.
Implement a ‘stub’ port which just responds to requests by printing a message.
Tick recvAtomic(PacketPtr packet)
Receive an atomic request packet from the peer.
StubSlavePort(const std::string &name_, ExternalSlave &owner_)
void recvFunctional(PacketPtr packet)
Receive a functional request packet from the peer.
bool recvTimingSnoopResp(PacketPtr packet)
Receive a timing snoop response from the peer.
void recvFunctionalSnoop(PacketPtr packet)
EventFunctionWrapper responseEvent
bool recvTimingReq(PacketPtr packet)
Receive a timing request from the peer.
void processResponseEvent()
bool mustRetry
Received a new request while processing a first.
PacketPtr responsePacket
Stub can handle a single request at a time.
void recvRespRetry()
Called by the peer if sendTimingResp was called on this protocol (causing recvTimingResp to be called...
ExternalSlave is a memory object representing a binding from a gem5 requestor to a response port in a...
std::list< AddrRange > AddrRangeList
Convenience typedef for a collection of address ranges.
#define fatal(...)
This implements a cprintf based fatal() function.
const Params & params() const
SimObject(const Params &p)
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
Copyright (c) 2024 Arm Limited All rights reserved.
Tick curTick()
The universal simulation clock.
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()