xbar.cc (10719:b4fc9ad648aa) xbar.cc (10913:38dbdeea7f1f)
1/*
2 * Copyright (c) 2011-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

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

140 // already done using the header delay, and the payload delay is
141 // also used to determine how long the crossbar layer is busy and
142 // thus regulates throughput
143}
144
145template <typename SrcType, typename DstType>
146BaseXBar::Layer<SrcType,DstType>::Layer(DstType& _port, BaseXBar& _xbar,
147 const std::string& _name) :
1/*
2 * Copyright (c) 2011-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

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

140 // already done using the header delay, and the payload delay is
141 // also used to determine how long the crossbar layer is busy and
142 // thus regulates throughput
143}
144
145template <typename SrcType, typename DstType>
146BaseXBar::Layer<SrcType,DstType>::Layer(DstType& _port, BaseXBar& _xbar,
147 const std::string& _name) :
148 port(_port), xbar(_xbar), _name(_name), state(IDLE), drainManager(NULL),
148 port(_port), xbar(_xbar), _name(_name), state(IDLE),
149 waitingForPeer(NULL), releaseEvent(this)
150{
151}
152
153template <typename SrcType, typename DstType>
154void BaseXBar::Layer<SrcType,DstType>::occupyLayer(Tick until)
155{
156 // ensure the state is busy at this point, as the layer should

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

247 state = IDLE;
248
249 // bus layer is now idle, so if someone is waiting we can retry
250 if (!waitingForLayer.empty()) {
251 // there is no point in sending a retry if someone is still
252 // waiting for the peer
253 if (waitingForPeer == NULL)
254 retryWaiting();
149 waitingForPeer(NULL), releaseEvent(this)
150{
151}
152
153template <typename SrcType, typename DstType>
154void BaseXBar::Layer<SrcType,DstType>::occupyLayer(Tick until)
155{
156 // ensure the state is busy at this point, as the layer should

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

247 state = IDLE;
248
249 // bus layer is now idle, so if someone is waiting we can retry
250 if (!waitingForLayer.empty()) {
251 // there is no point in sending a retry if someone is still
252 // waiting for the peer
253 if (waitingForPeer == NULL)
254 retryWaiting();
255 } else if (waitingForPeer == NULL && drainManager) {
255 } else if (waitingForPeer == NULL && drainState() == DrainState::Draining) {
256 DPRINTF(Drain, "Crossbar done draining, signaling drain manager\n");
257 //If we weren't able to drain before, do it now.
256 DPRINTF(Drain, "Crossbar done draining, signaling drain manager\n");
257 //If we weren't able to drain before, do it now.
258 drainManager->signalDrainDone();
259 // Clear the drain event once we're done with it.
260 drainManager = NULL;
258 signalDrainDone();
261 }
262}
263
264template <typename SrcType, typename DstType>
265void
266BaseXBar::Layer<SrcType,DstType>::retryWaiting()
267{
268 // this should never be called with no one waiting

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

582 for (int j = 0; j < masterPorts.size(); j++) {
583 pktCount.ysubname(j, masterPorts[j]->getSlavePort().name());
584 pktSize.ysubname(j, masterPorts[j]->getSlavePort().name());
585 }
586 }
587}
588
589template <typename SrcType, typename DstType>
259 }
260}
261
262template <typename SrcType, typename DstType>
263void
264BaseXBar::Layer<SrcType,DstType>::retryWaiting()
265{
266 // this should never be called with no one waiting

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

580 for (int j = 0; j < masterPorts.size(); j++) {
581 pktCount.ysubname(j, masterPorts[j]->getSlavePort().name());
582 pktSize.ysubname(j, masterPorts[j]->getSlavePort().name());
583 }
584 }
585}
586
587template <typename SrcType, typename DstType>
590unsigned int
591BaseXBar::Layer<SrcType,DstType>::drain(DrainManager *dm)
588DrainState
589BaseXBar::Layer::drain()
592{
593 //We should check that we're not "doing" anything, and that noone is
594 //waiting. We might be idle but have someone waiting if the device we
595 //contacted for a retry didn't actually retry.
596 if (state != IDLE) {
597 DPRINTF(Drain, "Crossbar not drained\n");
590{
591 //We should check that we're not "doing" anything, and that noone is
592 //waiting. We might be idle but have someone waiting if the device we
593 //contacted for a retry didn't actually retry.
594 if (state != IDLE) {
595 DPRINTF(Drain, "Crossbar not drained\n");
598 drainManager = dm;
599 return 1;
596 return DrainState::Draining;
597 } else {
598 return DrainState::Drained;
600 }
599 }
601 return 0;
602}
603
604template <typename SrcType, typename DstType>
605void
606BaseXBar::Layer<SrcType,DstType>::regStats()
607{
608 using namespace Stats;
609

--- 21 unchanged lines hidden ---
600}
601
602template <typename SrcType, typename DstType>
603void
604BaseXBar::Layer<SrcType,DstType>::regStats()
605{
606 using namespace Stats;
607

--- 21 unchanged lines hidden ---