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),
65 respQueueLimit(_resp_limit), sendEvent(*this)
72 Cycles _delay,
int _req_limit)
74 delay(_delay), reqQueueLimit(_req_limit), sendEvent(*this)
90 if (if_name ==
"master")
100 if (if_name ==
"slave")
112 fatal(
"Both ports of a bridge must be connected.\n");
127 return transmitList.size() == reqQueueLimit;
138 DPRINTF(
Bridge,
"Request queue size: %d\n", transmitList.size());
168 transmitList.size(), outstandingResponses);
177 if (expects_response) {
178 if (respQueueFull()) {
184 assert(outstandingResponses != respQueueLimit);
185 ++outstandingResponses;
216 DPRINTF(
Bridge,
"Request waiting for retry, now retrying\n");
229 if (transmitList.empty()) {
230 bridge.schedule(sendEvent, when);
233 assert(transmitList.size() != reqQueueLimit);
235 transmitList.emplace_back(pkt, when);
246 if (transmitList.empty()) {
247 bridge.schedule(sendEvent, when);
250 transmitList.emplace_back(pkt, when);
256 assert(!transmitList.empty());
264 DPRINTF(
Bridge,
"trySend request addr 0x%x, queue size %d\n",
265 pkt->
getAddr(), transmitList.size());
267 if (sendTimingReq(pkt)) {
269 transmitList.pop_front();
273 if (!transmitList.empty()) {
276 bridge.schedule(sendEvent, std::max(next_req.
tick,
277 bridge.clockEdge()));
294 assert(!transmitList.empty());
298 assert(resp.tick <=
curTick());
302 DPRINTF(
Bridge,
"trySend response addr 0x%x, outstanding %d\n",
303 pkt->
getAddr(), outstandingResponses);
305 if (sendTimingResp(pkt)) {
307 transmitList.pop_front();
310 assert(outstandingResponses != 0);
311 --outstandingResponses;
314 if (!transmitList.empty()) {
317 bridge.schedule(sendEvent, std::max(next_resp.
tick,
318 bridge.clockEdge()));
325 DPRINTF(
Bridge,
"Request waiting for retry, now retrying\n");
362 for (
auto i = transmitList.begin();
i != transmitList.end(); ++
i) {
384 auto i = transmitList.begin();
386 while (
i != transmitList.end() && !found) {
404 BridgeParams::create()
A MasterPort is a specialisation of a BaseMasterPort, which implements the default protocol for the t...
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.
Declaration of a memory-mapped bridge that connects a master and a slave through a request and respon...
unsigned int outstandingResponses
Counter to track the outstanding responses.
Cycles ticksToCycles(Tick t) const
Tick recvAtomic(PacketPtr pkt)
When receiving a Atomic requestfrom the peer port, pass it to the bridge.
virtual void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
virtual BaseMasterPort & getMasterPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a master port with a given name and index.
panic_if(!root,"Invalid expression\n")
void recvRespRetry()
When receiving a retry request from the peer port, pass it to the bridge.
A SlavePort is a specialisation of a port.
virtual BaseSlavePort & getSlavePort(const std::string &if_name, PortID idx=InvalidPortID)
Get a slave port with a given name and index.
void pushLabel(const std::string &lbl)
Push label for PrintReq (safe to call unconditionally).
A BaseSlavePort is a protocol-agnostic slave port, responsible only for the structural connection to ...
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.
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.
void popLabel()
Pop label for PrintReq (safe to call unconditionally).
bool respQueueFull() const
Is this side blocked from accepting new response packets.
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.
bool needsResponse() const
bool reqQueueFull() const
Is this side blocked from accepting new request packets.
A deferred packet stores a packet along with its scheduled transmission time.
bool cacheResponding() const
uint32_t payloadDelay
The extra pipelining delay from seeing the packet until the end of payload is transmitted by the comp...
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 sendRangeChange() const
Called by the owner to send a range change.
bool checkFunctional(PacketPtr other)
Check a functional request against a memory value stored in another packet (i.e.
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
bool checkFunctional(PacketPtr pkt)
Check a functional request against the packets in our request queue.
virtual const std::string name() const
const std::string & cmdString() const
Return the string name of the cmd field (for debugging and tracing).
The MemObject class extends the ClockedObject with accessor functions to get its master and slave por...
A BaseMasterPort is a protocol-agnostic master port, responsible only for the structural connection t...
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 response queue is ready to transmit (...
AddrRangeList getAddrRanges() const
When receiving a address range request the peer port, pass it to the bridge.
unsigned int respQueueLimit
Max queue size for reserved responses.
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.
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.
virtual BaseSlavePort & getSlavePort(const std::string &if_name, PortID idx=InvalidPortID)
Get a slave port with a given name and index.
Tick sendAtomic(PacketPtr pkt)
Send an atomic request packet, where the data is moved and the state is updated in zero time...
void recvFunctional(PacketPtr pkt)
When receiving a Functional request from the peer port, pass it to the bridge.
virtual BaseMasterPort & getMasterPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a master port with a given name and index.
void sendFunctional(PacketPtr pkt)
Send a functional request packet, where the data is instantly updated everywhere in the memory system...