qport.hh (10089:bc3126a05a7f) qport.hh (10713:eddb533708cb)
1/*
1/*
2 * Copyright (c) 2012 ARM Limited
2 * Copyright (c) 2012,2015 ARM Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

--- 45 unchanged lines hidden (view full) ---

56 * queue is a parameter to allow tailoring of the queue implementation
57 * (used in the cache).
58 */
59class QueuedSlavePort : public SlavePort
60{
61
62 protected:
63
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

--- 45 unchanged lines hidden (view full) ---

56 * queue is a parameter to allow tailoring of the queue implementation
57 * (used in the cache).
58 */
59class QueuedSlavePort : public SlavePort
60{
61
62 protected:
63
64 /** Packet queue used to store outgoing requests and responses. */
65 SlavePacketQueue &queue;
64 /** Packet queue used to store outgoing responses. */
65 RespPacketQueue &respQueue;
66
66
67 /** This function is notification that the device should attempt to send a
68 * packet again. */
69 virtual void recvRetry() { queue.retry(); }
67 void recvRespRetry() { respQueue.retry(); }
70
71 public:
72
73 /**
74 * Create a QueuedPort with a given name, owner, and a supplied
75 * implementation of a packet queue. The external definition of
76 * the queue enables e.g. the cache to implement a specific queue
77 * behaviuor in a subclass, and provide the latter to the
78 * QueuePort constructor.
79 */
80 QueuedSlavePort(const std::string& name, MemObject* owner,
68
69 public:
70
71 /**
72 * Create a QueuedPort with a given name, owner, and a supplied
73 * implementation of a packet queue. The external definition of
74 * the queue enables e.g. the cache to implement a specific queue
75 * behaviuor in a subclass, and provide the latter to the
76 * QueuePort constructor.
77 */
78 QueuedSlavePort(const std::string& name, MemObject* owner,
81 SlavePacketQueue &queue, PortID id = InvalidPortID) :
82 SlavePort(name, owner, id), queue(queue)
79 RespPacketQueue &resp_queue, PortID id = InvalidPortID) :
80 SlavePort(name, owner, id), respQueue(resp_queue)
83 { }
84
85 virtual ~QueuedSlavePort() { }
86
87 /**
88 * Schedule the sending of a timing response.
89 *
90 * @param pkt Packet to send
91 * @param when Absolute time (in ticks) to send packet
92 */
93 void schedTimingResp(PacketPtr pkt, Tick when)
81 { }
82
83 virtual ~QueuedSlavePort() { }
84
85 /**
86 * Schedule the sending of a timing response.
87 *
88 * @param pkt Packet to send
89 * @param when Absolute time (in ticks) to send packet
90 */
91 void schedTimingResp(PacketPtr pkt, Tick when)
94 { queue.schedSendTiming(pkt, when); }
92 { respQueue.schedSendTiming(pkt, when); }
95
96 /** Check the list of buffered packets against the supplied
97 * functional request. */
93
94 /** Check the list of buffered packets against the supplied
95 * functional request. */
98 bool checkFunctional(PacketPtr pkt) { return queue.checkFunctional(pkt); }
96 bool checkFunctional(PacketPtr pkt)
97 { return respQueue.checkFunctional(pkt); }
99
98
100 unsigned int drain(DrainManager *dm) { return queue.drain(dm); }
99 unsigned int drain(DrainManager *dm) { return respQueue.drain(dm); }
101};
102
100};
101
102/**
103 * The QueuedMasterPort combines two queues, a request queue and a
104 * snoop response queue, that both share the same port. The flow
105 * control for requests and snoop responses are completely
106 * independent, and so each queue manages its own flow control
107 * (retries).
108 */
103class QueuedMasterPort : public MasterPort
104{
105
106 protected:
107
109class QueuedMasterPort : public MasterPort
110{
111
112 protected:
113
108 /** Packet queue used to store outgoing requests and responses. */
109 MasterPacketQueue &queue;
114 /** Packet queue used to store outgoing requests. */
115 ReqPacketQueue &reqQueue;
110
116
111 /** This function is notification that the device should attempt to send a
112 * packet again. */
113 virtual void recvRetry() { queue.retry(); }
117 /** Packet queue used to store outgoing snoop responses. */
118 SnoopRespPacketQueue &snoopRespQueue;
114
119
120 void recvReqRetry() { reqQueue.retry(); }
121
122 void recvRetrySnoopResp() { snoopRespQueue.retry(); }
123
115 public:
116
117 /**
118 * Create a QueuedPort with a given name, owner, and a supplied
124 public:
125
126 /**
127 * Create a QueuedPort with a given name, owner, and a supplied
119 * implementation of a packet queue. The external definition of
120 * the queue enables e.g. the cache to implement a specific queue
128 * implementation of two packet queues. The external definition of
129 * the queues enables e.g. the cache to implement a specific queue
121 * behaviuor in a subclass, and provide the latter to the
122 * QueuePort constructor.
123 */
124 QueuedMasterPort(const std::string& name, MemObject* owner,
130 * behaviuor in a subclass, and provide the latter to the
131 * QueuePort constructor.
132 */
133 QueuedMasterPort(const std::string& name, MemObject* owner,
125 MasterPacketQueue &queue, PortID id = InvalidPortID) :
126 MasterPort(name, owner, id), queue(queue)
134 ReqPacketQueue &req_queue,
135 SnoopRespPacketQueue &snoop_resp_queue,
136 PortID id = InvalidPortID) :
137 MasterPort(name, owner, id), reqQueue(req_queue),
138 snoopRespQueue(snoop_resp_queue)
127 { }
128
129 virtual ~QueuedMasterPort() { }
130
131 /**
132 * Schedule the sending of a timing request.
133 *
134 * @param pkt Packet to send
135 * @param when Absolute time (in ticks) to send packet
136 */
137 void schedTimingReq(PacketPtr pkt, Tick when)
139 { }
140
141 virtual ~QueuedMasterPort() { }
142
143 /**
144 * Schedule the sending of a timing request.
145 *
146 * @param pkt Packet to send
147 * @param when Absolute time (in ticks) to send packet
148 */
149 void schedTimingReq(PacketPtr pkt, Tick when)
138 { queue.schedSendTiming(pkt, when); }
150 { reqQueue.schedSendTiming(pkt, when); }
139
140 /**
141 * Schedule the sending of a timing snoop response.
142 *
143 * @param pkt Packet to send
144 * @param when Absolute time (in ticks) to send packet
145 */
146 void schedTimingSnoopResp(PacketPtr pkt, Tick when)
151
152 /**
153 * Schedule the sending of a timing snoop response.
154 *
155 * @param pkt Packet to send
156 * @param when Absolute time (in ticks) to send packet
157 */
158 void schedTimingSnoopResp(PacketPtr pkt, Tick when)
147 { queue.schedSendTiming(pkt, when, true); }
159 { snoopRespQueue.schedSendTiming(pkt, when); }
148
149 /** Check the list of buffered packets against the supplied
150 * functional request. */
160
161 /** Check the list of buffered packets against the supplied
162 * functional request. */
151 bool checkFunctional(PacketPtr pkt) { return queue.checkFunctional(pkt); }
163 bool checkFunctional(PacketPtr pkt)
164 {
165 return reqQueue.checkFunctional(pkt) ||
166 snoopRespQueue.checkFunctional(pkt);
167 }
152
168
153 unsigned int drain(DrainManager *dm) { return queue.drain(dm); }
169 unsigned int drain(DrainManager *dm)
170 { return reqQueue.drain(dm) + snoopRespQueue.drain(dm); }
154};
155
156#endif // __MEM_QPORT_HH__
171};
172
173#endif // __MEM_QPORT_HH__