56 #include "debug/SerialLink.hh"
57 #include "params/SerialLink.hh"
62 Cycles _delay,
int _resp_limit,
65 :
SlavePort(_name, &_serial_link), serial_link(_serial_link),
66 masterPort(_masterPort), delay(_delay),
67 ranges(_ranges.begin(), _ranges.end()),
68 outstandingResponses(0), retryReq(false),
69 respQueueLimit(_resp_limit), sendEvent(*this)
76 Cycles _delay,
int _req_limit)
77 :
MasterPort(_name, &_serial_link), serial_link(_serial_link),
78 slavePort(_slavePort), delay(_delay), reqQueueLimit(_req_limit),
98 if (if_name ==
"master")
108 if (if_name ==
"slave")
120 fatal(
"Both ports of a serial_link must be connected.\n");
135 return transmitList.size() == reqQueueLimit;
158 * serial_link.link_speed));
159 Tick t = serial_link.clockEdge(cycles);
181 transmitList.size(), outstandingResponses);
187 }
else if ( !retryReq ) {
191 if (expects_response) {
192 if (respQueueFull()) {
198 assert(outstandingResponses != respQueueLimit);
199 ++outstandingResponses;
219 serial_link.num_lanes * serial_link.link_speed));
220 Tick t = serial_link.clockEdge(cycles);
255 if (transmitList.empty()) {
256 serial_link.schedule(sendEvent, when);
259 assert(transmitList.size() != reqQueueLimit);
272 if (transmitList.empty()) {
273 serial_link.schedule(sendEvent, when);
282 assert(!transmitList.empty());
291 pkt->
getAddr(), transmitList.size());
293 if (sendTimingReq(pkt)) {
295 transmitList.pop_front();
300 if (!transmitList.empty()) {
306 serial_link.num_lanes * serial_link.link_speed));
307 Tick t = serial_link.clockEdge(cycles);
308 serial_link.schedule(sendEvent, std::max(next_req.
tick, t));
325 assert(!transmitList.empty());
329 assert(resp.tick <=
curTick());
334 pkt->
getAddr(), outstandingResponses);
336 if (sendTimingResp(pkt)) {
338 transmitList.pop_front();
341 assert(outstandingResponses != 0);
342 --outstandingResponses;
345 if (!transmitList.empty()) {
351 serial_link.num_lanes * serial_link.link_speed));
352 Tick t = serial_link.clockEdge(cycles);
353 serial_link.schedule(sendEvent, std::max(next_resp.
tick, t));
394 for (
auto i = transmitList.begin();
i != transmitList.end(); ++
i) {
416 auto i = transmitList.begin();
418 while (
i != transmitList.end() && !found) {
436 SerialLinkParams::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.
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.
Cycles ticksToCycles(Tick t) const
bool recvTimingReq(PacketPtr pkt)
When receiving a timing request from the peer port, pass it to the serial_link.
void recvReqRetry()
When receiving a retry request from the peer port, pass it to the serial_link.
SerialLink is a simple variation of the Bridge class, with the ability to account for the latency of ...
SerialLinkSlavePort slavePort
Slave port of the serial_link.
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.
AddrRangeList getAddrRanges() const
When receiving a address range request the peer port, pass it to the serial_link. ...
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 ...
SerialLink(SerialLinkParams *p)
bool reqQueueFull() const
Is this side blocked from accepting new request packets.
virtual BaseSlavePort & getSlavePort(const std::string &if_name, PortID idx=InvalidPortID)
Get a slave port with a given name and index.
unsigned int respQueueLimit
Max queue size for reserved responses.
bool checkFunctional(PacketPtr pkt)
Check a functional request against the packets in our request queue.
Tick curTick()
The current simulated tick.
uint32_t headerDelay
The extra delay from seeing the packet until the header is transmitted.
unsigned int outstandingResponses
Counter to track the outstanding responses.
uint64_t Tick
Tick count type.
void popLabel()
Pop label for PrintReq (safe to call unconditionally).
virtual BaseMasterPort & getMasterPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a master port with a given name and index.
bool needsResponse() const
Tick recvAtomic(PacketPtr pkt)
When receiving a Atomic requestfrom the peer port, pass it to the serial_link.
bool cacheResponding() const
uint32_t payloadDelay
The extra pipelining delay from seeing the packet until the end of payload is transmitted by the comp...
void recvRespRetry()
When receiving a retry request from the peer port, pass it to the serial_link.
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 schedTimingResp(PacketPtr pkt, Tick when)
Queue a response packet to be sent out later and also schedule a send if necessary.
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.
Port on the side that forwards requests and receives responses.
void trySendTiming()
Handle send event, scheduled when the packet at the head of the response queue is ready to transmit (...
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
virtual const std::string name() const
const std::string & cmdString() const
Return the string name of the cmd field (for debugging and tracing).
SerialLinkSlavePort(const std::string &_name, SerialLink &_serial_link, SerialLinkMasterPort &_masterPort, Cycles _delay, int _resp_limit, const std::vector< AddrRange > &_ranges)
Constructor for the SerialLinkSlavePort.
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...
T divCeil(const T &a, const U &b)
void schedTimingReq(PacketPtr pkt, Tick when)
Queue a request packet to be sent out later and also schedule a send if necessary.
uint64_t link_speed
Speed of each link (Gb/s) in this serial link.
Declaration of the SerialLink Class, modeling Hybrid-Memory-Cube's serial interface.
void trySendTiming()
Handle send event, scheduled when the packet at the head of the outbound queue is ready to transmit (...
A deferred packet stores a packet along with its scheduled transmission time.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
bool recvTimingResp(PacketPtr pkt)
When receiving a timing request from the peer port, pass it to the serial_link.
unsigned num_lanes
Number of parallel lanes in this serial link.
SerialLinkMasterPort masterPort
Master port of the serial_link.
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 serial_link.
virtual BaseMasterPort & getMasterPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a master port with a given name and index.
SerialLinkMasterPort(const std::string &_name, SerialLink &_serial_link, SerialLinkSlavePort &_slavePort, Cycles _delay, int _req_limit)
Constructor for the SerialLinkMasterPort.
void sendFunctional(PacketPtr pkt)
Send a functional request packet, where the data is instantly updated everywhere in the memory system...
virtual void init()
init() is called after all C++ SimObjects have been created and all ports are connected.