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 *>
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
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
uint32_t payloadDelay
The extra pipelining delay from seeing the packet until the end of payload is transmitted by the comp...
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
uint32_t headerDelay
The extra delay from seeing the packet until the header is transmitted.
const T * getConstPtr() const
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).
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.
void sendRetryReq()
Send a retry to the request port that previously attempted a sendTimingReq to this response port and ...
Abstract superclass for simulation objects.
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...
void schedule(Event &event, Tick when)
#define fatal(...)
This implements a cprintf based fatal() function.
const Params & params() const
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.
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()