/*
- * Copyright (c) 2012 ARM Limited
+ * Copyright (c) 2012,2015 ARM Limited
* All rights reserved.
*
* The license below extends only to copyright in the software and shall
protected:
- /** Packet queue used to store outgoing requests and responses. */
- SlavePacketQueue &queue;
+ /** Packet queue used to store outgoing responses. */
+ RespPacketQueue &respQueue;
- /** This function is notification that the device should attempt to send a
- * packet again. */
- virtual void recvRetry() { queue.retry(); }
+ void recvRespRetry() { respQueue.retry(); }
public:
* QueuePort constructor.
*/
QueuedSlavePort(const std::string& name, MemObject* owner,
- SlavePacketQueue &queue) :
- SlavePort(name, owner), queue(queue)
+ RespPacketQueue &resp_queue, PortID id = InvalidPortID) :
+ SlavePort(name, owner, id), respQueue(resp_queue)
{ }
virtual ~QueuedSlavePort() { }
* @param when Absolute time (in ticks) to send packet
*/
void schedTimingResp(PacketPtr pkt, Tick when)
- { queue.schedSendTiming(pkt, when); }
+ { respQueue.schedSendTiming(pkt, when); }
/** Check the list of buffered packets against the supplied
* functional request. */
- bool checkFunctional(PacketPtr pkt) { return queue.checkFunctional(pkt); }
-
- /**
- * Hook for draining the queued port.
- *
- * @param de an event which is used to signal back to the caller
- * @returns a number indicating how many times process will be called
- */
- unsigned int drain(Event *de) { return queue.drain(de); }
+ bool trySatisfyFunctional(PacketPtr pkt)
+ { return respQueue.trySatisfyFunctional(pkt); }
};
+/**
+ * The QueuedMasterPort combines two queues, a request queue and a
+ * snoop response queue, that both share the same port. The flow
+ * control for requests and snoop responses are completely
+ * independent, and so each queue manages its own flow control
+ * (retries).
+ */
class QueuedMasterPort : public MasterPort
{
protected:
- /** Packet queue used to store outgoing requests and responses. */
- MasterPacketQueue &queue;
+ /** Packet queue used to store outgoing requests. */
+ ReqPacketQueue &reqQueue;
+
+ /** Packet queue used to store outgoing snoop responses. */
+ SnoopRespPacketQueue &snoopRespQueue;
- /** This function is notification that the device should attempt to send a
- * packet again. */
- virtual void recvRetry() { queue.retry(); }
+ void recvReqRetry() { reqQueue.retry(); }
+
+ void recvRetrySnoopResp() { snoopRespQueue.retry(); }
public:
/**
* Create a QueuedPort with a given name, owner, and a supplied
- * implementation of a packet queue. The external definition of
- * the queue enables e.g. the cache to implement a specific queue
+ * implementation of two packet queues. The external definition of
+ * the queues enables e.g. the cache to implement a specific queue
* behaviuor in a subclass, and provide the latter to the
* QueuePort constructor.
*/
QueuedMasterPort(const std::string& name, MemObject* owner,
- MasterPacketQueue &queue) :
- MasterPort(name, owner), queue(queue)
+ ReqPacketQueue &req_queue,
+ SnoopRespPacketQueue &snoop_resp_queue,
+ PortID id = InvalidPortID) :
+ MasterPort(name, owner, id), reqQueue(req_queue),
+ snoopRespQueue(snoop_resp_queue)
{ }
virtual ~QueuedMasterPort() { }
* @param when Absolute time (in ticks) to send packet
*/
void schedTimingReq(PacketPtr pkt, Tick when)
- { queue.schedSendTiming(pkt, when); }
+ { reqQueue.schedSendTiming(pkt, when); }
/**
* Schedule the sending of a timing snoop response.
* @param when Absolute time (in ticks) to send packet
*/
void schedTimingSnoopResp(PacketPtr pkt, Tick when)
- { queue.schedSendTiming(pkt, when, true); }
+ { snoopRespQueue.schedSendTiming(pkt, when); }
/** Check the list of buffered packets against the supplied
* functional request. */
- bool checkFunctional(PacketPtr pkt) { return queue.checkFunctional(pkt); }
-
- /**
- * Hook for draining the queued port.
- *
- * @param de an event which is used to signal back to the caller
- * @returns a number indicating how many times process will be called
- */
- unsigned int drain(Event *de) { return queue.drain(de); }
+ bool trySatisfyFunctional(PacketPtr pkt)
+ {
+ return reqQueue.trySatisfyFunctional(pkt) ||
+ snoopRespQueue.trySatisfyFunctional(pkt);
+ }
};
#endif // __MEM_QPORT_HH__