masterPorts.push_back(bp);
reqLayers.push_back(new ReqLayer(*bp, *this,
csprintf(".reqLayer%d", i)));
- snoopLayers.push_back(new SnoopRespLayer(*bp, *this,
- csprintf(".snoopLayer%d", i)));
+ snoopLayers.push_back(
+ new SnoopRespLayer(*bp, *this, csprintf(".snoopLayer%d", i)));
}
// see if we have a default slave device connected and if so add
defaultPortID = masterPorts.size();
std::string portName = name() + ".default";
MasterPort* bp = new CoherentXBarMasterPort(portName, *this,
- defaultPortID);
+ defaultPortID);
masterPorts.push_back(bp);
reqLayers.push_back(new ReqLayer(*bp, *this, csprintf(".reqLayer%d",
- defaultPortID)));
+ defaultPortID)));
snoopLayers.push_back(new SnoopRespLayer(*bp, *this,
csprintf(".snoopLayer%d",
defaultPortID)));
protected:
- /**
- * When receiving a timing request, pass it to the crossbar.
- */
- virtual bool recvTimingReq(PacketPtr pkt)
- { return xbar.recvTimingReq(pkt, id); }
+ bool
+ recvTimingReq(PacketPtr pkt) override
+ {
+ return xbar.recvTimingReq(pkt, id);
+ }
- /**
- * When receiving a timing snoop response, pass it to the crossbar.
- */
- virtual bool recvTimingSnoopResp(PacketPtr pkt)
- { return xbar.recvTimingSnoopResp(pkt, id); }
+ bool
+ recvTimingSnoopResp(PacketPtr pkt) override
+ {
+ return xbar.recvTimingSnoopResp(pkt, id);
+ }
- /**
- * When receiving an atomic request, pass it to the crossbar.
- */
- virtual Tick recvAtomic(PacketPtr pkt)
- { return xbar.recvAtomic(pkt, id); }
+ Tick
+ recvAtomic(PacketPtr pkt) override
+ {
+ return xbar.recvAtomic(pkt, id);
+ }
- /**
- * When receiving a functional request, pass it to the crossbar.
- */
- virtual void recvFunctional(PacketPtr pkt)
- { xbar.recvFunctional(pkt, id); }
+ void
+ recvFunctional(PacketPtr pkt) override
+ {
+ xbar.recvFunctional(pkt, id);
+ }
- /**
- * Return the union of all adress ranges seen by this crossbar.
- */
- virtual AddrRangeList getAddrRanges() const
- { return xbar.getAddrRanges(); }
+ AddrRangeList
+ getAddrRanges() const override
+ {
+ return xbar.getAddrRanges();
+ }
};
*
* @return a boolean that is true if this port is snooping
*/
- virtual bool isSnooping() const
- { return true; }
+ bool isSnooping() const override { return true; }
- /**
- * When receiving a timing response, pass it to the crossbar.
- */
- virtual bool recvTimingResp(PacketPtr pkt)
- { return xbar.recvTimingResp(pkt, id); }
-
- /**
- * When receiving a timing snoop request, pass it to the crossbar.
- */
- virtual void recvTimingSnoopReq(PacketPtr pkt)
- { return xbar.recvTimingSnoopReq(pkt, id); }
+ bool
+ recvTimingResp(PacketPtr pkt) override
+ {
+ return xbar.recvTimingResp(pkt, id);
+ }
- /**
- * When receiving an atomic snoop request, pass it to the crossbar.
- */
- virtual Tick recvAtomicSnoop(PacketPtr pkt)
- { return xbar.recvAtomicSnoop(pkt, id); }
+ void
+ recvTimingSnoopReq(PacketPtr pkt) override
+ {
+ return xbar.recvTimingSnoopReq(pkt, id);
+ }
- /**
- * When receiving a functional snoop request, pass it to the crossbar.
- */
- virtual void recvFunctionalSnoop(PacketPtr pkt)
- { xbar.recvFunctionalSnoop(pkt, id); }
+ Tick
+ recvAtomicSnoop(PacketPtr pkt) override
+ {
+ return xbar.recvAtomicSnoop(pkt, id);
+ }
- /** When reciving a range change from the peer port (at id),
- pass it to the crossbar. */
- virtual void recvRangeChange()
- { xbar.recvRangeChange(id); }
+ void
+ recvFunctionalSnoop(PacketPtr pkt) override
+ {
+ xbar.recvFunctionalSnoop(pkt, id);
+ }
- /** When reciving a retry from the peer port (at id),
- pass it to the crossbar. */
- virtual void recvReqRetry()
- { xbar.recvReqRetry(id); }
+ void recvRangeChange() override { xbar.recvRangeChange(id); }
+ void recvReqRetry() override { xbar.recvReqRetry(id); }
};
* Override the sending of retries and pass them on through
* the mirrored slave port.
*/
- void sendRetryResp() {
+ void
+ sendRetryResp() override
+ {
// forward it as a snoop response retry
slavePort.sendRetrySnoopResp();
}
- /**
- * Provided as necessary.
- */
- void recvReqRetry() { panic("SnoopRespPort should never see retry\n"); }
+ void
+ recvReqRetry() override
+ {
+ panic("SnoopRespPort should never see retry");
+ }
- /**
- * Provided as necessary.
- */
- bool recvTimingResp(PacketPtr pkt)
+ bool
+ recvTimingResp(PacketPtr pkt) override
{
- panic("SnoopRespPort should never see timing response\n");
- return false;
+ panic("SnoopRespPort should never see timing response");
}
};
* broadcast needed for probes. NULL denotes an absent filter. */
SnoopFilter *snoopFilter;
- /** Cycles of snoop response latency.*/
const Cycles snoopResponseLatency;
-
- /** Is this crossbar the point of coherency? **/
const bool pointOfCoherency;
-
- /** Is this crossbar the point of unification? **/
const bool pointOfUnification;
/**
*/
std::unique_ptr<Packet> pendingDelete;
- /** Function called by the port when the crossbar is recieving a Timing
- request packet.*/
bool recvTimingReq(PacketPtr pkt, PortID slave_port_id);
-
- /** Function called by the port when the crossbar is recieving a Timing
- response packet.*/
bool recvTimingResp(PacketPtr pkt, PortID master_port_id);
-
- /** Function called by the port when the crossbar is recieving a timing
- snoop request.*/
void recvTimingSnoopReq(PacketPtr pkt, PortID master_port_id);
-
- /** Function called by the port when the crossbar is recieving a timing
- snoop response.*/
bool recvTimingSnoopResp(PacketPtr pkt, PortID slave_port_id);
-
- /** Timing function called by port when it is once again able to process
- * requests. */
void recvReqRetry(PortID master_port_id);
/**
* @param pkt Packet to forward
* @param exclude_slave_port_id Id of slave port to exclude
*/
- void forwardTiming(PacketPtr pkt, PortID exclude_slave_port_id) {
+ void
+ forwardTiming(PacketPtr pkt, PortID exclude_slave_port_id)
+ {
forwardTiming(pkt, exclude_slave_port_id, snoopPorts);
}
void forwardTiming(PacketPtr pkt, PortID exclude_slave_port_id,
const std::vector<QueuedSlavePort*>& dests);
- /** Function called by the port when the crossbar is recieving a Atomic
- transaction.*/
Tick recvAtomic(PacketPtr pkt, PortID slave_port_id);
-
- /** Function called by the port when the crossbar is recieving an
- atomic snoop transaction.*/
Tick recvAtomicSnoop(PacketPtr pkt, PortID master_port_id);
/**
*
* @return a pair containing the snoop response and snoop latency
*/
- std::pair<MemCmd, Tick> forwardAtomic(PacketPtr pkt,
- PortID exclude_slave_port_id)
+ std::pair<MemCmd, Tick>
+ forwardAtomic(PacketPtr pkt, PortID exclude_slave_port_id)
{
return forwardAtomic(pkt, exclude_slave_port_id, InvalidPortID,
snoopPorts);
*
* @return Whether the memory below is the destination for the packet
*/
- bool isDestination(const PacketPtr pkt) const
+ bool
+ isDestination(const PacketPtr pkt) const
{
return (pkt->req->isToPOC() && pointOfCoherency) ||
(pkt->req->isToPOU() && pointOfUnification);
protected:
- /**
- * When receiving a timing request, pass it to the crossbar.
- */
- virtual bool recvTimingReq(PacketPtr pkt)
- { return xbar.recvTimingReq(pkt, id); }
-
- /**
- * When receiving an atomic request, pass it to the crossbar.
- */
- virtual Tick recvAtomic(PacketPtr pkt)
- { return xbar.recvAtomic(pkt, id); }
-
- /**
- * When receiving a functional request, pass it to the crossbar.
- */
- virtual void recvFunctional(PacketPtr pkt)
- { xbar.recvFunctional(pkt, id); }
-
- /**
- * Return the union of all adress ranges seen by this crossbar.
- */
- virtual AddrRangeList getAddrRanges() const
- { return xbar.getAddrRanges(); }
-
+ bool
+ recvTimingReq(PacketPtr pkt) override
+ {
+ return xbar.recvTimingReq(pkt, id);
+ }
+
+ Tick
+ recvAtomic(PacketPtr pkt) override
+ {
+ return xbar.recvAtomic(pkt, id);
+ }
+
+ void
+ recvFunctional(PacketPtr pkt) override
+ {
+ xbar.recvFunctional(pkt, id);
+ }
+
+ AddrRangeList
+ getAddrRanges() const override
+ {
+ return xbar.getAddrRanges();
+ }
};
/**
protected:
- /**
- * When receiving a timing response, pass it to the crossbar.
- */
- virtual bool recvTimingResp(PacketPtr pkt)
- { return xbar.recvTimingResp(pkt, id); }
-
- /** When reciving a range change from the peer port (at id),
- pass it to the crossbar. */
- virtual void recvRangeChange()
- { xbar.recvRangeChange(id); }
-
- /** When reciving a retry from the peer port (at id),
- pass it to the crossbar. */
- virtual void recvReqRetry()
- { xbar.recvReqRetry(id); }
-
+ bool
+ recvTimingResp(PacketPtr pkt) override
+ {
+ return xbar.recvTimingResp(pkt, id);
+ }
+
+ void
+ recvRangeChange() override
+ {
+ xbar.recvRangeChange(id);
+ }
+
+ void
+ recvReqRetry() override
+ {
+ xbar.recvReqRetry(id);
+ }
};
- /** Function called by the port when the crossbar is recieving a Timing
- request packet.*/
virtual bool recvTimingReq(PacketPtr pkt, PortID slave_port_id);
-
- /** Function called by the port when the crossbar is recieving a Timing
- response packet.*/
virtual bool recvTimingResp(PacketPtr pkt, PortID master_port_id);
-
- /** Timing function called by port when it is once again able to process
- * requests. */
void recvReqRetry(PortID master_port_id);
-
- /** Function called by the port when the crossbar is recieving a Atomic
- transaction.*/
Tick recvAtomic(PacketPtr pkt, PortID slave_port_id);
-
- /** Function called by the port when the crossbar is recieving a Functional
- transaction.*/
void recvFunctional(PacketPtr pkt, PortID slave_port_id);
public:
virtual ~NoncoherentXBar();
- /**
- * stats
- */
- virtual void regStats();
+ void regStats() override;
Stats::Scalar totPktSize;
};
delete s;
}
-void
-BaseXBar::init()
-{
-}
-
Port &
BaseXBar::getPort(const std::string &if_name, PortID idx)
{
}
template <typename SrcType, typename DstType>
-BaseXBar::Layer<SrcType,DstType>::Layer(DstType& _port, BaseXBar& _xbar,
+BaseXBar::Layer<SrcType, DstType>::Layer(DstType& _port, BaseXBar& _xbar,
const std::string& _name) :
port(_port), xbar(_xbar), _name(_name), state(IDLE),
waitingForPeer(NULL), releaseEvent([this]{ releaseLayer(); }, name())
}
template <typename SrcType, typename DstType>
-void BaseXBar::Layer<SrcType,DstType>::occupyLayer(Tick until)
+void BaseXBar::Layer<SrcType, DstType>::occupyLayer(Tick until)
{
// ensure the state is busy at this point, as the layer should
// transition from idle as soon as it has decided to forward the
template <typename SrcType, typename DstType>
bool
-BaseXBar::Layer<SrcType,DstType>::tryTiming(SrcType* src_port)
+BaseXBar::Layer<SrcType, DstType>::tryTiming(SrcType* src_port)
{
// if we are in the retry state, we will not see anything but the
// retrying port (or in the case of the snoop ports the snoop
template <typename SrcType, typename DstType>
void
-BaseXBar::Layer<SrcType,DstType>::succeededTiming(Tick busy_time)
+BaseXBar::Layer<SrcType, DstType>::succeededTiming(Tick busy_time)
{
// we should have gone from idle or retry to busy in the tryTiming
// test
template <typename SrcType, typename DstType>
void
-BaseXBar::Layer<SrcType,DstType>::failedTiming(SrcType* src_port,
+BaseXBar::Layer<SrcType, DstType>::failedTiming(SrcType* src_port,
Tick busy_time)
{
// ensure no one got in between and tried to send something to
template <typename SrcType, typename DstType>
void
-BaseXBar::Layer<SrcType,DstType>::releaseLayer()
+BaseXBar::Layer<SrcType, DstType>::releaseLayer()
{
// releasing the bus means we should now be idle
assert(state == BUSY);
template <typename SrcType, typename DstType>
void
-BaseXBar::Layer<SrcType,DstType>::retryWaiting()
+BaseXBar::Layer<SrcType, DstType>::retryWaiting()
{
// this should never be called with no one waiting
assert(!waitingForLayer.empty());
template <typename SrcType, typename DstType>
void
-BaseXBar::Layer<SrcType,DstType>::recvRetry()
+BaseXBar::Layer<SrcType, DstType>::recvRetry()
{
// we should never get a retry without having failed to forward
// something to this port
template <typename SrcType, typename DstType>
DrainState
-BaseXBar::Layer<SrcType,DstType>::drain()
+BaseXBar::Layer<SrcType, DstType>::drain()
{
//We should check that we're not "doing" anything, and that noone is
//waiting. We might be idle but have someone waiting if the device we
template <typename SrcType, typename DstType>
void
-BaseXBar::Layer<SrcType,DstType>::regStats()
+BaseXBar::Layer<SrcType, DstType>::regStats()
{
using namespace Stats;
* file, but since there are only two given options (MasterPort and
* SlavePort) it seems a bit excessive at this point.
*/
-template class BaseXBar::Layer<SlavePort,MasterPort>;
-template class BaseXBar::Layer<MasterPort,SlavePort>;
+template class BaseXBar::Layer<SlavePort, MasterPort>;
+template class BaseXBar::Layer<MasterPort, SlavePort>;
*/
DrainState drain() override;
- /**
- * Get the crossbar layer's name
- */
const std::string name() const { return xbar.name() + _name; }
*/
void failedTiming(SrcType* src_port, Tick busy_time);
- /** Occupy the layer until until */
void occupyLayer(Tick until);
/**
*/
void recvRetry();
- /**
- * Register stats for the layer
- */
void regStats();
protected:
/** The crossbar this layer is a part of. */
BaseXBar& xbar;
- /** A name for this layer. */
std::string _name;
/**
*/
enum State { IDLE, BUSY, RETRY };
- /** track the state of the layer */
State state;
/**
* potential waiting port, or drain if asked to do so.
*/
void releaseLayer();
-
- /** event used to schedule a release of the layer */
EventFunctionWrapper releaseEvent;
/**
};
- class ReqLayer : public Layer<SlavePort,MasterPort>
+ class ReqLayer : public Layer<SlavePort, MasterPort>
{
public:
/**
* @param _name the layer's name
*/
ReqLayer(MasterPort& _port, BaseXBar& _xbar, const std::string& _name) :
- Layer(_port, _xbar, _name) {}
+ Layer(_port, _xbar, _name)
+ {}
protected:
-
- void sendRetry(SlavePort* retry_port)
- { retry_port->sendRetryReq(); }
+ void
+ sendRetry(SlavePort* retry_port) override
+ {
+ retry_port->sendRetryReq();
+ }
};
- class RespLayer : public Layer<MasterPort,SlavePort>
+ class RespLayer : public Layer<MasterPort, SlavePort>
{
public:
/**
* @param _xbar the crossbar this layer belongs to
* @param _name the layer's name
*/
- RespLayer(SlavePort& _port, BaseXBar& _xbar, const std::string& _name) :
- Layer(_port, _xbar, _name) {}
+ RespLayer(SlavePort& _port, BaseXBar& _xbar,
+ const std::string& _name) :
+ Layer(_port, _xbar, _name)
+ {}
protected:
-
- void sendRetry(MasterPort* retry_port)
- { retry_port->sendRetryResp(); }
+ void
+ sendRetry(MasterPort* retry_port) override
+ {
+ retry_port->sendRetryResp();
+ }
};
- class SnoopRespLayer : public Layer<SlavePort,MasterPort>
+ class SnoopRespLayer : public Layer<SlavePort, MasterPort>
{
public:
/**
*/
SnoopRespLayer(MasterPort& _port, BaseXBar& _xbar,
const std::string& _name) :
- Layer(_port, _xbar, _name) {}
+ Layer(_port, _xbar, _name)
+ {}
protected:
- void sendRetry(SlavePort* retry_port)
- { retry_port->sendRetrySnoopResp(); }
+ void
+ sendRetry(SlavePort* retry_port) override
+ {
+ retry_port->sendRetrySnoopResp();
+ }
};
/**
* and to decode the address.
*/
const Cycles frontendLatency;
- /** Cycles of forward latency */
const Cycles forwardLatency;
- /** Cycles of response latency */
const Cycles responseLatency;
/** the width of the xbar in bytes */
const uint32_t width;
PortID idx=InvalidPortID) override;
void regStats() override;
-
};
#endif //__MEM_XBAR_HH__