summaryrefslogtreecommitdiff
path: root/src/mem/packet_queue.hh
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2012-05-01 13:40:42 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2012-05-01 13:40:42 -0400
commit3fea59e1629f5dac55a7d36752e822bee7fd7fa7 (patch)
tree5fd0076b5920a217f8463c66be3df9effe8e4324 /src/mem/packet_queue.hh
parent8966e6d36d17acce3ddac13b309eeb12c7711f27 (diff)
downloadgem5-3fea59e1629f5dac55a7d36752e822bee7fd7fa7.tar.xz
MEM: Separate requests and responses for timing accesses
This patch moves send/recvTiming and send/recvTimingSnoop from the Port base class to the MasterPort and SlavePort, and also splits them into separate member functions for requests and responses: send/recvTimingReq, send/recvTimingResp, and send/recvTimingSnoopReq, send/recvTimingSnoopResp. A master port sends requests and receives responses, and also receives snoop requests and sends snoop responses. A slave port has the reciprocal behaviour as it receives requests and sends responses, and sends snoop requests and receives snoop responses. For all MemObjects that have only master ports or slave ports (but not both), e.g. a CPU, or a PIO device, this patch merely adds more clarity to what kind of access is taking place. For example, a CPU port used to call sendTiming, and will now call sendTimingReq. Similarly, a response previously came back through recvTiming, which is now recvTimingResp. For the modules that have both master and slave ports, e.g. the bus, the behaviour was previously relying on branches based on pkt->isRequest(), and this is now replaced with a direct call to the apprioriate member function depending on the type of access. Please note that send/recvRetry is still shared by all the timing accessors and remains in the Port base class for now (to maintain the current bus functionality and avoid changing the statistics of all regressions). The packet queue is split into a MasterPort and SlavePort version to facilitate the use of the new timing accessors. All uses of the PacketQueue are updated accordingly. With this patch, the type of packet (request or response) is now well defined for each type of access, and asserts on pkt->isRequest() and pkt->isResponse() are now moved to the appropriate send member functions. It is also worth noting that sendTimingSnoopReq no longer returns a boolean, as the semantics do not alow snoop requests to be rejected or stalled. All these assumptions are now excplicitly part of the port interface itself.
Diffstat (limited to 'src/mem/packet_queue.hh')
-rw-r--r--src/mem/packet_queue.hh88
1 files changed, 73 insertions, 15 deletions
diff --git a/src/mem/packet_queue.hh b/src/mem/packet_queue.hh
index fbcd7d449..0171eb9a3 100644
--- a/src/mem/packet_queue.hh
+++ b/src/mem/packet_queue.hh
@@ -86,9 +86,6 @@ class PacketQueue
/** The manager which is used for the event queue */
EventManager& em;
- /** Label to use for print request packets label stack. */
- const std::string label;
-
/** This function attempts to send deferred packets. Scheduled to
* be called in the future via SendEvent. */
void processSendEvent();
@@ -104,8 +101,8 @@ class PacketQueue
protected:
- /** The port used to send the packets. */
- Port& port;
+ /** Label to use for print request packets label stack. */
+ const std::string label;
/** Remember whether we're awaiting a retry from the bus. */
bool waitingOnRetry;
@@ -135,6 +132,11 @@ class PacketQueue
void trySendTiming();
/**
+ *
+ */
+ virtual bool sendTiming(PacketPtr pkt, bool send_as_snoop) = 0;
+
+ /**
* Based on the transmit list, or the provided time, schedule a
* send event if there are packets to send. If we are idle and
* asked to drain then do so.
@@ -152,31 +154,28 @@ class PacketQueue
*/
virtual void recvRangeChange() { }
- public:
-
/**
- * Create a packet queue, linked to an event manager, a port used
- * to send the packets, and potentially give it a label that will
- * be used for functional print request packets.
+ * Create a packet queue, linked to an event manager, and a label
+ * that will be used for functional print request packets.
*
* @param _em Event manager used for scheduling this queue
- * @param _port Port used to send the packets
* @param _label Label to push on the label stack for print request packets
*/
- PacketQueue(EventManager& _em, Port& _port,
- const std::string _label = "PacketQueue");
+ PacketQueue(EventManager& _em, const std::string& _label);
/**
* Virtual desctructor since the class may be used as a base class.
*/
virtual ~PacketQueue();
+ public:
+
/**
- * Provide a name to simplify debugging. Base it on the port.
+ * Provide a name to simplify debugging.
*
* @return A complete name, appended to module and port
*/
- const std::string name() const { return port.name() + "-queue"; }
+ virtual const std::string name() const = 0;
/** Check the list of buffered packets against the supplied
* functional request. */
@@ -217,4 +216,63 @@ class PacketQueue
unsigned int drain(Event *de);
};
+class MasterPacketQueue : public PacketQueue
+{
+
+ protected:
+
+ MasterPort& masterPort;
+
+ public:
+
+ /**
+ * Create a master packet queue, linked to an event manager, a
+ * master port, and a label that will be used for functional print
+ * request packets.
+ *
+ * @param _em Event manager used for scheduling this queue
+ * @param _masterPort Master port used to send the packets
+ * @param _label Label to push on the label stack for print request packets
+ */
+ MasterPacketQueue(EventManager& _em, MasterPort& _masterPort,
+ const std::string _label = "MasterPacketQueue");
+
+ virtual ~MasterPacketQueue() { }
+
+ const std::string name() const
+ { return masterPort.name() + "-" + label; }
+
+ bool sendTiming(PacketPtr pkt, bool send_as_snoop);
+};
+
+class SlavePacketQueue : public PacketQueue
+{
+
+ protected:
+
+ SlavePort& slavePort;
+
+ public:
+
+ /**
+ * Create a slave packet queue, linked to an event manager, a
+ * slave port, and a label that will be used for functional print
+ * request packets.
+ *
+ * @param _em Event manager used for scheduling this queue
+ * @param _slavePort Slave port used to send the packets
+ * @param _label Label to push on the label stack for print request packets
+ */
+ SlavePacketQueue(EventManager& _em, SlavePort& _slavePort,
+ const std::string _label = "SlavePacketQueue");
+
+ virtual ~SlavePacketQueue() { }
+
+ const std::string name() const
+ { return slavePort.name() + "-" + label; }
+
+ bool sendTiming(PacketPtr pkt, bool send_as_snoop);
+
+};
+
#endif // __MEM_PACKET_QUEUE_HH__