xbar.hh (13799:15badf7874ee) xbar.hh (13808:0a44fbc3a853)
1/*
2 * Copyright (c) 2011-2015, 2018 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

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

111 * back when drained.
112 *
113 * @param de drain event to call once drained
114 *
115 * @return 1 if busy or waiting to retry, or 0 if idle
116 */
117 DrainState drain() override;
118
1/*
2 * Copyright (c) 2011-2015, 2018 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

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

111 * back when drained.
112 *
113 * @param de drain event to call once drained
114 *
115 * @return 1 if busy or waiting to retry, or 0 if idle
116 */
117 DrainState drain() override;
118
119 /**
120 * Get the crossbar layer's name
121 */
122 const std::string name() const { return xbar.name() + _name; }
123
124
125 /**
126 * Determine if the layer accepts a packet from a specific
127 * port. If not, the port in question is also added to the
128 * retry list. In either case the state of the layer is
129 * updated accordingly.

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

149 * not already at the front) and occupying the layer
150 * accordingly.
151 *
152 * @param src_port Source port
153 * @param busy_time Time to spend as a result of a failed send
154 */
155 void failedTiming(SrcType* src_port, Tick busy_time);
156
119 const std::string name() const { return xbar.name() + _name; }
120
121
122 /**
123 * Determine if the layer accepts a packet from a specific
124 * port. If not, the port in question is also added to the
125 * retry list. In either case the state of the layer is
126 * updated accordingly.

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

146 * not already at the front) and occupying the layer
147 * accordingly.
148 *
149 * @param src_port Source port
150 * @param busy_time Time to spend as a result of a failed send
151 */
152 void failedTiming(SrcType* src_port, Tick busy_time);
153
157 /** Occupy the layer until until */
158 void occupyLayer(Tick until);
159
160 /**
161 * Send a retry to the port at the head of waitingForLayer. The
162 * caller must ensure that the list is not empty.
163 */
164 void retryWaiting();
165
166 /**
167 * Handle a retry from a neighbouring module. This wraps
168 * retryWaiting by verifying that there are ports waiting
169 * before calling retryWaiting.
170 */
171 void recvRetry();
172
154 void occupyLayer(Tick until);
155
156 /**
157 * Send a retry to the port at the head of waitingForLayer. The
158 * caller must ensure that the list is not empty.
159 */
160 void retryWaiting();
161
162 /**
163 * Handle a retry from a neighbouring module. This wraps
164 * retryWaiting by verifying that there are ports waiting
165 * before calling retryWaiting.
166 */
167 void recvRetry();
168
173 /**
174 * Register stats for the layer
175 */
176 void regStats();
177
178 protected:
179
180 /**
181 * Sending the actual retry, in a manner specific to the
182 * individual layers. Note that for a MasterPort, there is
183 * both a RequestLayer and a SnoopResponseLayer using the same

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

188 private:
189
190 /** The destination port this layer converges at. */
191 DstType& port;
192
193 /** The crossbar this layer is a part of. */
194 BaseXBar& xbar;
195
169 void regStats();
170
171 protected:
172
173 /**
174 * Sending the actual retry, in a manner specific to the
175 * individual layers. Note that for a MasterPort, there is
176 * both a RequestLayer and a SnoopResponseLayer using the same

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

181 private:
182
183 /** The destination port this layer converges at. */
184 DstType& port;
185
186 /** The crossbar this layer is a part of. */
187 BaseXBar& xbar;
188
196 /** A name for this layer. */
197 std::string _name;
198
199 /**
200 * We declare an enum to track the state of the layer. The
201 * starting point is an idle state where the layer is waiting
202 * for a packet to arrive. Upon arrival, the layer
203 * transitions to the busy state, where it remains either
204 * until the packet transfer is done, or the header time is

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

209 * idle to retry if the layer receives a retry from one of
210 * its connected ports. The retry state lasts until the port
211 * in questions calls sendTiming and returns control to the
212 * layer, or goes to a busy state if the port does not
213 * immediately react to the retry by calling sendTiming.
214 */
215 enum State { IDLE, BUSY, RETRY };
216
189 std::string _name;
190
191 /**
192 * We declare an enum to track the state of the layer. The
193 * starting point is an idle state where the layer is waiting
194 * for a packet to arrive. Upon arrival, the layer
195 * transitions to the busy state, where it remains either
196 * until the packet transfer is done, or the header time is

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

201 * idle to retry if the layer receives a retry from one of
202 * its connected ports. The retry state lasts until the port
203 * in questions calls sendTiming and returns control to the
204 * layer, or goes to a busy state if the port does not
205 * immediately react to the retry by calling sendTiming.
206 */
207 enum State { IDLE, BUSY, RETRY };
208
217 /** track the state of the layer */
218 State state;
219
220 /**
221 * A deque of ports that retry should be called on because
222 * the original send was delayed due to a busy layer.
223 */
224 std::deque<SrcType*> waitingForLayer;
225

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

230 SrcType* waitingForPeer;
231
232 /**
233 * Release the layer after being occupied and return to an
234 * idle state where we proceed to send a retry to any
235 * potential waiting port, or drain if asked to do so.
236 */
237 void releaseLayer();
209 State state;
210
211 /**
212 * A deque of ports that retry should be called on because
213 * the original send was delayed due to a busy layer.
214 */
215 std::deque<SrcType*> waitingForLayer;
216

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

221 SrcType* waitingForPeer;
222
223 /**
224 * Release the layer after being occupied and return to an
225 * idle state where we proceed to send a retry to any
226 * potential waiting port, or drain if asked to do so.
227 */
228 void releaseLayer();
238
239 /** event used to schedule a release of the layer */
240 EventFunctionWrapper releaseEvent;
241
242 /**
243 * Stats for occupancy and utilization. These stats capture
244 * the time the layer spends in the busy state and are thus only
245 * relevant when the memory system is in timing mode.
246 */
247 Stats::Scalar occupancy;
248 Stats::Formula utilization;
249
250 };
251
229 EventFunctionWrapper releaseEvent;
230
231 /**
232 * Stats for occupancy and utilization. These stats capture
233 * the time the layer spends in the busy state and are thus only
234 * relevant when the memory system is in timing mode.
235 */
236 Stats::Scalar occupancy;
237 Stats::Formula utilization;
238
239 };
240
252 class ReqLayer : public Layer
241 class ReqLayer : public Layer<SlavePort, MasterPort>
253 {
254 public:
255 /**
256 * Create a request layer and give it a name.
257 *
258 * @param _port destination port the layer converges at
259 * @param _xbar the crossbar this layer belongs to
260 * @param _name the layer's name
261 */
262 ReqLayer(MasterPort& _port, BaseXBar& _xbar, const std::string& _name) :
242 {
243 public:
244 /**
245 * Create a request layer and give it a name.
246 *
247 * @param _port destination port the layer converges at
248 * @param _xbar the crossbar this layer belongs to
249 * @param _name the layer's name
250 */
251 ReqLayer(MasterPort& _port, BaseXBar& _xbar, const std::string& _name) :
263 Layer(_port, _xbar, _name) {}
252 Layer(_port, _xbar, _name)
253 {}
264
265 protected:
254
255 protected:
266
267 void sendRetry(SlavePort* retry_port)
268 { retry_port->sendRetryReq(); }
256 void
257 sendRetry(SlavePort* retry_port) override
258 {
259 retry_port->sendRetryReq();
260 }
269 };
270
261 };
262
271 class RespLayer : public Layer
263 class RespLayer : public Layer<MasterPort, SlavePort>
272 {
273 public:
274 /**
275 * Create a response layer and give it a name.
276 *
277 * @param _port destination port the layer converges at
278 * @param _xbar the crossbar this layer belongs to
279 * @param _name the layer's name
280 */
264 {
265 public:
266 /**
267 * Create a response layer and give it a name.
268 *
269 * @param _port destination port the layer converges at
270 * @param _xbar the crossbar this layer belongs to
271 * @param _name the layer's name
272 */
281 RespLayer(SlavePort& _port, BaseXBar& _xbar, const std::string& _name) :
282 Layer(_port, _xbar, _name) {}
273 RespLayer(SlavePort& _port, BaseXBar& _xbar,
274 const std::string& _name) :
275 Layer(_port, _xbar, _name)
276 {}
283
284 protected:
277
278 protected:
285
286 void sendRetry(MasterPort* retry_port)
287 { retry_port->sendRetryResp(); }
279 void
280 sendRetry(MasterPort* retry_port) override
281 {
282 retry_port->sendRetryResp();
283 }
288 };
289
284 };
285
290 class SnoopRespLayer : public Layer
286 class SnoopRespLayer : public Layer<SlavePort, MasterPort>
291 {
292 public:
293 /**
294 * Create a snoop response layer and give it a name.
295 *
296 * @param _port destination port the layer converges at
297 * @param _xbar the crossbar this layer belongs to
298 * @param _name the layer's name
299 */
300 SnoopRespLayer(MasterPort& _port, BaseXBar& _xbar,
301 const std::string& _name) :
287 {
288 public:
289 /**
290 * Create a snoop response layer and give it a name.
291 *
292 * @param _port destination port the layer converges at
293 * @param _xbar the crossbar this layer belongs to
294 * @param _name the layer's name
295 */
296 SnoopRespLayer(MasterPort& _port, BaseXBar& _xbar,
297 const std::string& _name) :
302 Layer(_port, _xbar, _name) {}
298 Layer(_port, _xbar, _name)
299 {}
303
304 protected:
305
300
301 protected:
302
306 void sendRetry(SlavePort* retry_port)
307 { retry_port->sendRetrySnoopResp(); }
303 void
304 sendRetry(SlavePort* retry_port) override
305 {
306 retry_port->sendRetrySnoopResp();
307 }
308 };
309
310 /**
311 * Cycles of front-end pipeline including the delay to accept the request
312 * and to decode the address.
313 */
314 const Cycles frontendLatency;
308 };
309
310 /**
311 * Cycles of front-end pipeline including the delay to accept the request
312 * and to decode the address.
313 */
314 const Cycles frontendLatency;
315 /** Cycles of forward latency */
316 const Cycles forwardLatency;
315 const Cycles forwardLatency;
317 /** Cycles of response latency */
318 const Cycles responseLatency;
319 /** the width of the xbar in bytes */
320 const uint32_t width;
321
322 AddrRangeMap<PortID, 3> portMap;
323
324 /**
325 * Remember where request packets came from so that we can route

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

412
413 void init() override;
414
415 /** A function used to return the port associated with this object. */
416 Port &getPort(const std::string &if_name,
417 PortID idx=InvalidPortID) override;
418
419 void regStats() override;
316 const Cycles responseLatency;
317 /** the width of the xbar in bytes */
318 const uint32_t width;
319
320 AddrRangeMap<PortID, 3> portMap;
321
322 /**
323 * Remember where request packets came from so that we can route

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

410
411 void init() override;
412
413 /** A function used to return the port associated with this object. */
414 Port &getPort(const std::string &if_name,
415 PortID idx=InvalidPortID) override;
416
417 void regStats() override;
420
421};
422
423#endif //__MEM_XBAR_HH__
418};
419
420#endif //__MEM_XBAR_HH__