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),
77 Cycles _delay,
int _req_limit)
99 if (if_name ==
"master")
101 else if (if_name ==
"slave")
113 fatal(
"Both ports of a serial_link must be connected.\n");
122 return outstandingResponses == respQueueLimit;
128 return transmitList.size() == reqQueueLimit;
151 * serial_link.link_speed));
152 Tick t = serial_link.clockEdge(cycles);
174 transmitList.size(), outstandingResponses);
180 }
else if ( !retryReq ) {
184 if (expects_response) {
185 if (respQueueFull()) {
191 assert(outstandingResponses != respQueueLimit);
192 ++outstandingResponses;
212 serial_link.num_lanes * serial_link.link_speed));
213 Tick t = serial_link.clockEdge(cycles);
248 if (transmitList.empty()) {
252 assert(transmitList.size() != reqQueueLimit);
265 if (transmitList.empty()) {
275 assert(!transmitList.empty());
284 pkt->
getAddr(), transmitList.size());
286 if (sendTimingReq(pkt)) {
288 transmitList.pop_front();
293 if (!transmitList.empty()) {
299 serial_link.num_lanes * serial_link.link_speed));
300 Tick t = serial_link.clockEdge(cycles);
318 assert(!transmitList.empty());
322 assert(resp.tick <=
curTick());
327 pkt->
getAddr(), outstandingResponses);
329 if (sendTimingResp(pkt)) {
331 transmitList.pop_front();
334 assert(outstandingResponses != 0);
335 --outstandingResponses;
338 if (!transmitList.empty()) {
344 serial_link.num_lanes * serial_link.link_speed));
345 Tick t = serial_link.clockEdge(cycles);
346 serial_link.schedule(
sendEvent, std::max(next_resp.
tick, t));
387 for (
auto i = transmitList.begin();
i != transmitList.end(); ++
i) {
409 auto i = transmitList.begin();
411 while (
i != transmitList.end() && !found) {
429 SerialLinkParams::create()
A MasterPort is a specialisation of a BaseMasterPort, which implements the default protocol for the t...
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.
bool respQueueFull() const
Is this side blocked from accepting new response packets.
void sendRangeChange() const
Called by the owner to send a range change.
Cycles is a wrapper class for representing cycle counts, i.e.
#define fatal(...)
This implements a cprintf based fatal() function.
SerialLink & serial_link
The serial_link to which this port belongs.
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 serial_link.
void recvReqRetry()
When receiving a retry request from the peer port, pass it to the serial_link.
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
bool cacheResponding() const
const Cycles delay
Minimum delay though this 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.
bool isConnected() const
Is this port currently connected to a peer?
A SlavePort is a specialisation of a port.
const Cycles delay
Minimum request delay though this serial_link.
void pushLabel(const std::string &lbl)
Push label for PrintReq (safe to call unconditionally).
SerialLink(SerialLinkParams *p)
Tick curTick()
The current simulated tick.
bool needsResponse() const
uint32_t headerDelay
The extra delay from seeing the packet until the header is transmitted.
EventFunctionWrapper sendEvent
Send event for the response queue.
SerialLinkSlavePort & slavePort
The slave port on the other side of the serial_link.
uint64_t Tick
Tick count type.
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 ...
bool reqQueueFull() const
Is this side blocked from accepting new request packets.
Tick recvAtomic(PacketPtr pkt)
When receiving a Atomic requestfrom the peer port, pass it to the serial_link.
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
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 sendEvent(ThreadContext *tc)
Send an event (SEV) to a specific PE if there isn't already a pending event.
bool trySatisfyFunctional(PacketPtr pkt)
Check a functional request against the packets in our request queue.
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...
Cycles ticksToCycles(Tick t) const
SerialLinkSlavePort(const std::string &_name, SerialLink &_serial_link, SerialLinkMasterPort &_masterPort, Cycles _delay, int _resp_limit, const std::vector< AddrRange > &_ranges)
Constructor for the SerialLinkSlavePort.
const std::string name() const
Return port name (for DPRINTF).
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.
AddrRangeList getAddrRanges() const
When receiving a address range request the peer port, pass it to the serial_link. ...
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.
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.
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.
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...
void recvFunctional(PacketPtr pkt)
When receiving a Functional request from the peer port, pass it to the serial_link.
SerialLinkMasterPort(const std::string &_name, SerialLink &_serial_link, SerialLinkSlavePort &_slavePort, Cycles _delay, int _req_limit)
Constructor for the SerialLinkMasterPort.
virtual void init()
init() is called after all C++ SimObjects have been created and all ports are connected.