50#include "debug/Bridge.hh"
51#include "params/Bridge.hh"
59 Cycles _delay,
int _resp_limit,
62 memSidePort(_memSidePort), delay(_delay),
63 ranges(_ranges.begin(), _ranges.end()),
64 outstandingResponses(0), retryReq(false), respQueueLimit(_resp_limit),
72 Cycles _delay,
int _req_limit)
75 delay(_delay), reqQueueLimit(_req_limit),
92 if (if_name ==
"mem_side_port")
94 else if (if_name ==
"cpu_side_port")
106 fatal(
"Both ports of a bridge must be connected.\n");
121 return transmitList.size() == reqQueueLimit;
132 DPRINTF(
Bridge,
"Request queue size: %d\n", transmitList.size());
162 transmitList.size(), outstandingResponses);
171 if (expects_response) {
172 if (respQueueFull()) {
178 assert(outstandingResponses != respQueueLimit);
179 ++outstandingResponses;
210 DPRINTF(
Bridge,
"Request waiting for retry, now retrying\n");
223 if (transmitList.empty()) {
227 assert(transmitList.size() != reqQueueLimit);
229 transmitList.emplace_back(pkt, when);
240 if (transmitList.empty()) {
244 transmitList.emplace_back(pkt, when);
250 assert(!transmitList.empty());
258 DPRINTF(
Bridge,
"trySend request addr 0x%x, queue size %d\n",
259 pkt->
getAddr(), transmitList.size());
261 if (sendTimingReq(pkt)) {
263 transmitList.pop_front();
267 if (!transmitList.empty()) {
271 bridge.clockEdge()));
288 assert(!transmitList.empty());
296 DPRINTF(
Bridge,
"trySend response addr 0x%x, outstanding %d\n",
297 pkt->
getAddr(), outstandingResponses);
299 if (sendTimingResp(pkt)) {
301 transmitList.pop_front();
304 assert(outstandingResponses != 0);
305 --outstandingResponses;
308 if (!transmitList.empty()) {
312 bridge.clockEdge()));
319 DPRINTF(
Bridge,
"Request waiting for retry, now retrying\n");
364 for (
auto i = transmitList.begin();
i != transmitList.end(); ++
i) {
393 auto i = transmitList.begin();
395 while (
i != transmitList.end() && !found) {
Declaration of a memory-mapped bridge that connects a requestor and a responder through a request and...
Port on the side that forwards requests and receives responses.
void recvReqRetry() override
When receiving a retry request from the peer port, pass it to the bridge.
BridgeRequestPort(const std::string &_name, Bridge &_bridge, BridgeResponsePort &_cpuSidePort, Cycles _delay, int _req_limit)
Constructor for the BridgeRequestPort.
bool trySatisfyFunctional(PacketPtr pkt)
Check a functional request against the packets in our request queue.
bool reqQueueFull() const
Is this side blocked from accepting new request packets.
bool recvTimingResp(PacketPtr pkt) override
When receiving a timing request from the peer port, pass it to the bridge.
void schedTimingReq(PacketPtr pkt, Tick when)
Queue a request packet to be sent out later and also schedule a send if necessary.
void trySendTiming()
Handle send event, scheduled when the packet at the head of the outbound queue is ready to transmit (...
The port on the side that receives requests and sends responses.
void recvFunctional(PacketPtr pkt) override
When receiving a Functional request from the peer port, pass it to the bridge.
bool respQueueFull() const
Is this side blocked from accepting new response packets.
bool recvTimingReq(PacketPtr pkt) override
When receiving a timing request from the peer port, pass it to the bridge.
unsigned int respQueueLimit
Max queue size for reserved responses.
unsigned int outstandingResponses
Counter to track the outstanding responses.
void recvMemBackdoorReq(const MemBackdoorReq &req, MemBackdoorPtr &backdoor) override
When receiving a Functional backdoor request from the peer port, pass it to the bridge.
BridgeResponsePort(const std::string &_name, Bridge &_bridge, BridgeRequestPort &_memSidePort, Cycles _delay, int _resp_limit, std::vector< AddrRange > _ranges)
Constructor for the BridgeResponsePort.
void recvRespRetry() override
When receiving a retry request from the peer port, pass it to the bridge.
void schedTimingResp(PacketPtr pkt, Tick when)
Queue a response packet to be sent out later and also schedule a send if necessary.
AddrRangeList getAddrRanges() const override
When receiving a address range request the peer port, pass it to the bridge.
Tick recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor) override
When receiving an Atomic backdoor request from the peer port, pass it to the bridge.
Tick recvAtomic(PacketPtr pkt) override
When receiving an Atomic request from the peer port, pass it to the bridge.
void retryStalledReq()
Retry any stalled request that we have failed to accept at an earlier point in time.
void trySendTiming()
Handle send event, scheduled when the packet at the head of the response queue is ready to transmit (...
A deferred packet stores a packet along with its scheduled transmission time.
A bridge is used to interface two different crossbars (or in general a memory-mapped requestor and re...
BridgeRequestPort memSidePort
Request port of the bridge.
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
BridgeResponsePort cpuSidePort
Response port of the bridge.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Cycles ticksToCycles(Tick t) const
Cycles is a wrapper class for representing cycle counts, i.e.
virtual std::string name() const
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
void pushLabel(const std::string &lbl)
Push label for PrintReq (safe to call unconditionally).
const std::string & cmdString() const
Return the string name of the cmd field (for debugging and tracing).
bool needsResponse() const
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.
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).
bool cacheResponding() const
Ports are used to interface objects to each other.
bool isConnected() const
Is this port currently connected to a peer?
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.
Tick sendAtomic(PacketPtr pkt)
Send an atomic request packet, where the data is moved and the state is updated in zero time,...
void sendFunctional(PacketPtr pkt) const
Send a functional request packet, where the data is instantly updated everywhere in the memory system...
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.
void sendRangeChange() const
Called by the owner to send a range change.
#define fatal(...)
This implements a cprintf based fatal() function.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
void sendEvent(ThreadContext *tc)
Send an event (SEV) to a specific PE if there isn't already a pending event.
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.