54 #include "debug/Bridge.hh" 55 #include "params/Bridge.hh" 60 Cycles _delay,
int _resp_limit,
62 :
SlavePort(_name, &_bridge), bridge(_bridge), masterPort(_masterPort),
63 delay(_delay), ranges(_ranges.begin(), _ranges.end()),
64 outstandingResponses(0), retryReq(false), respQueueLimit(_resp_limit),
72 Cycles _delay,
int _req_limit)
74 delay(_delay), reqQueueLimit(_req_limit),
91 if (if_name ==
"master")
93 else if (if_name ==
"slave")
105 fatal(
"Both ports of a bridge must be connected.\n");
114 return outstandingResponses == respQueueLimit;
120 return transmitList.size() == reqQueueLimit;
131 DPRINTF(
Bridge,
"Request queue size: %d\n", transmitList.size());
161 transmitList.size(), outstandingResponses);
170 if (expects_response) {
171 if (respQueueFull()) {
177 assert(outstandingResponses != respQueueLimit);
178 ++outstandingResponses;
209 DPRINTF(
Bridge,
"Request waiting for retry, now retrying\n");
222 if (transmitList.empty()) {
226 assert(transmitList.size() != reqQueueLimit);
228 transmitList.emplace_back(pkt, when);
239 if (transmitList.empty()) {
243 transmitList.emplace_back(pkt, when);
249 assert(!transmitList.empty());
257 DPRINTF(
Bridge,
"trySend request addr 0x%x, queue size %d\n",
258 pkt->
getAddr(), transmitList.size());
260 if (sendTimingReq(pkt)) {
262 transmitList.pop_front();
266 if (!transmitList.empty()) {
270 bridge.clockEdge()));
287 assert(!transmitList.empty());
291 assert(resp.tick <=
curTick());
295 DPRINTF(
Bridge,
"trySend response addr 0x%x, outstanding %d\n",
296 pkt->
getAddr(), outstandingResponses);
298 if (sendTimingResp(pkt)) {
300 transmitList.pop_front();
303 assert(outstandingResponses != 0);
304 --outstandingResponses;
307 if (!transmitList.empty()) {
311 bridge.clockEdge()));
318 DPRINTF(
Bridge,
"Request waiting for retry, now retrying\n");
355 for (
auto i = transmitList.begin();
i != transmitList.end(); ++
i) {
377 auto i = transmitList.begin();
379 while (
i != transmitList.end() && !found) {
397 BridgeParams::create()
A MasterPort is a specialisation of a BaseMasterPort, which implements the default protocol for the t...
AddrRangeList getAddrRanges() const
When receiving a address range request the peer port, pass it to the bridge.
Ports are used to interface objects to each other.
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
void sendRangeChange() const
Called by the owner to send a range change.
Cycles is a wrapper class for representing cycle counts, i.e.
BridgeSlavePort(const std::string &_name, Bridge &_bridge, BridgeMasterPort &_masterPort, Cycles _delay, int _resp_limit, std::vector< AddrRange > _ranges)
Constructor for the BridgeSlavePort.
#define fatal(...)
This implements a cprintf based fatal() function.
Declaration of a memory-mapped bridge that connects a master and a slave through a request and respon...
const Cycles delay
Minimum request delay though this bridge.
Tick recvAtomic(PacketPtr pkt)
When receiving a Atomic requestfrom the peer port, pass it to the bridge.
bool cacheResponding() const
bool trySatisfyFunctional(PacketPtr pkt)
Check a functional request against the packets in our request queue.
void recvRespRetry()
When receiving a retry request from the peer port, pass it to the bridge.
bool respQueueFull() const
Is this side blocked from accepting new response packets.
bool isConnected() const
Is this port currently connected to a peer?
A SlavePort is a specialisation of a port.
void pushLabel(const std::string &lbl)
Push label for PrintReq (safe to call unconditionally).
bool recvTimingResp(PacketPtr pkt)
When receiving a timing request from the peer port, pass it to the bridge.
void recvReqRetry()
When receiving a retry request from the peer port, pass it to the bridge.
Tick curTick()
The current simulated tick.
bool reqQueueFull() const
Is this side blocked from accepting new request packets.
bool needsResponse() const
uint32_t headerDelay
The extra delay from seeing the packet until the header is transmitted.
uint64_t Tick
Tick count type.
BridgeMasterPort masterPort
Master port of the bridge.
BridgeSlavePort slavePort
Slave port of the bridge.
bool trySatisfyFunctional(PacketPtr other)
Check a functional request against a memory value stored in another packet (i.e.
void popLabel()
Pop label for PrintReq (safe to call unconditionally).
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
void retryStalledReq()
Retry any stalled request that we have failed to accept at an earlier point in time.
bool recvTimingReq(PacketPtr pkt)
When receiving a timing request from the peer port, pass it to the bridge.
BridgeMasterPort(const std::string &_name, Bridge &_bridge, BridgeSlavePort &_slavePort, Cycles _delay, int _req_limit)
Constructor for the BridgeMasterPort.
A deferred packet stores a packet along with its scheduled transmission time.
uint32_t payloadDelay
The extra pipelining delay from seeing the packet until the end of payload is transmitted by the comp...
virtual const std::string name() const
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
The port on the side that receives requests and sends responses.
void sendEvent(ThreadContext *tc)
Send an event (SEV) to a specific PE if there isn't already a pending event.
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
Cycles ticksToCycles(Tick t) const
void schedTimingReq(PacketPtr pkt, Tick when)
Queue a request packet to be sent out later and also schedule a send if necessary.
const std::string name() const
Return port name (for DPRINTF).
void trySendTiming()
Handle send event, scheduled when the packet at the head of the response queue is ready to transmit (...
EventFunctionWrapper sendEvent
Send event for the response queue.
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
A bridge is used to interface two different crossbars (or in general a memory-mapped master and slave...
void trySendTiming()
Handle send event, scheduled when the packet at the head of the outbound queue is ready to transmit (...
Port on the side that forwards requests and receives responses.
void sendFunctional(PacketPtr pkt) const
Send a functional request packet, where the data is instantly updated everywhere in the memory system...
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
void schedTimingResp(PacketPtr pkt, Tick when)
Queue a response packet to be sent out later and also schedule a send if necessary.
BridgeSlavePort & slavePort
The slave port on the other side of the bridge.
const Cycles delay
Minimum delay though this bridge.
const std::string & cmdString() const
Return the string name of the cmd field (for debugging and tracing).
Tick sendAtomic(PacketPtr pkt)
Send an atomic request packet, where the data is moved and the state is updated in zero time...
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Bridge & bridge
The bridge to which this port belongs.
void recvFunctional(PacketPtr pkt)
When receiving a Functional request from the peer port, pass it to the bridge.