gem5  v20.1.0.0
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
BaseXBar::Layer< SrcType, DstType > Class Template Referenceabstract

A layer is an internal crossbar arbitration point with its own flow control. More...

#include <xbar.hh>

Inheritance diagram for BaseXBar::Layer< SrcType, DstType >:
Drainable Stats::Group

Public Member Functions

 Layer (DstType &_port, BaseXBar &_xbar, const std::string &_name)
 Create a layer and give it a name. More...
 
DrainState drain () override
 Drain according to the normal semantics, so that the crossbar can tell the layer to drain, and pass an event to signal back when drained. More...
 
const std::string name () const
 
bool tryTiming (SrcType *src_port)
 Determine if the layer accepts a packet from a specific port. More...
 
void succeededTiming (Tick busy_time)
 Deal with a destination port accepting a packet by potentially removing the source port from the retry list (if retrying) and occupying the layer accordingly. More...
 
void failedTiming (SrcType *src_port, Tick busy_time)
 Deal with a destination port not accepting a packet by potentially adding the source port to the retry list (if not already at the front) and occupying the layer accordingly. More...
 
void occupyLayer (Tick until)
 
void retryWaiting ()
 Send a retry to the port at the head of waitingForLayer. More...
 
void recvRetry ()
 Handle a retry from a neighbouring module. More...
 
- Public Member Functions inherited from Drainable
DrainState drainState () const
 Return the current drain state of an object. More...
 
virtual void notifyFork ()
 Notify a child process of a fork. More...
 
- Public Member Functions inherited from Stats::Group
 Group (Group *parent, const char *name=nullptr)
 Construct a new statistics group. More...
 
virtual ~Group ()
 
virtual void regStats ()
 Callback to set stat parameters. More...
 
virtual void resetStats ()
 Callback to reset stats. More...
 
virtual void preDumpStats ()
 Callback before stats are dumped. More...
 
void addStat (Stats::Info *info)
 Register a stat with this group. More...
 
const std::map< std::string, Group * > & getStatGroups () const
 Get all child groups associated with this object. More...
 
const std::vector< Info * > & getStats () const
 Get all stats associated with this object. More...
 
void addStatGroup (const char *name, Group *block)
 Add a stat block as a child of this block. More...
 
const InforesolveStat (std::string name) const
 Resolve a stat by its name within this group. More...
 
 Group ()=delete
 
 Group (const Group &)=delete
 
Groupoperator= (const Group &)=delete
 

Protected Member Functions

virtual void sendRetry (SrcType *retry_port)=0
 Sending the actual retry, in a manner specific to the individual layers. More...
 
- Protected Member Functions inherited from Drainable
 Drainable ()
 
virtual ~Drainable ()
 
virtual void drainResume ()
 Resume execution after a successful drain. More...
 
void signalDrainDone () const
 Signal that an object is drained. More...
 

Private Types

enum  State { IDLE, BUSY, RETRY }
 We declare an enum to track the state of the layer. More...
 

Private Member Functions

void releaseLayer ()
 Release the layer after being occupied and return to an idle state where we proceed to send a retry to any potential waiting port, or drain if asked to do so. More...
 

Private Attributes

DstType & port
 The destination port this layer converges at. More...
 
BaseXBarxbar
 The crossbar this layer is a part of. More...
 
std::string _name
 
State state
 
std::deque< SrcType * > waitingForLayer
 A deque of ports that retry should be called on because the original send was delayed due to a busy layer. More...
 
SrcType * waitingForPeer
 Track who is waiting for the retry when receiving it from a peer. More...
 
EventFunctionWrapper releaseEvent
 
Stats::Scalar occupancy
 Stats for occupancy and utilization. More...
 
Stats::Formula utilization
 

Detailed Description

template<typename SrcType, typename DstType>
class BaseXBar::Layer< SrcType, DstType >

A layer is an internal crossbar arbitration point with its own flow control.

Each layer is a converging multiplexer tree. By instantiating one layer per destination port (and per packet type, i.e. request, response, snoop request and snoop response), we model full crossbar structures like AXI, ACE, PCIe, etc.

The template parameter, PortClass, indicates the destination port type for the layer. The retry list holds either memory-side ports or CPU-side ports, depending on the direction of the layer. Thus, a request layer has a retry list containing CPU-side ports, whereas a response layer holds memory-side ports.

Definition at line 88 of file xbar.hh.

Member Enumeration Documentation

◆ State

template<typename SrcType , typename DstType >
enum BaseXBar::Layer::State
private

We declare an enum to track the state of the layer.

The starting point is an idle state where the layer is waiting for a packet to arrive. Upon arrival, the layer transitions to the busy state, where it remains either until the packet transfer is done, or the header time is spent. Once the layer leaves the busy state, it can either go back to idle, if no packets have arrived while it was busy, or the layer goes on to retry the first port in waitingForLayer. A similar transition takes place from idle to retry if the layer receives a retry from one of its connected ports. The retry state lasts until the port in questions calls sendTiming and returns control to the layer, or goes to a busy state if the port does not immediately react to the retry by calling sendTiming.

Enumerator
IDLE 
BUSY 
RETRY 

Definition at line 200 of file xbar.hh.

Constructor & Destructor Documentation

◆ Layer()

template<typename SrcType , typename DstType >
BaseXBar::Layer< SrcType, DstType >::Layer ( DstType &  _port,
BaseXBar _xbar,
const std::string &  _name 
)

Create a layer and give it a name.

The layer uses the crossbar an event manager.

Parameters
_portdestination port the layer converges at
_xbarthe crossbar this layer belongs to
_namethe layer's name

Definition at line 139 of file xbar.cc.

Member Function Documentation

◆ drain()

template<typename SrcType , typename DstType >
DrainState BaseXBar::Layer< SrcType, DstType >::drain ( )
overridevirtual

Drain according to the normal semantics, so that the crossbar can tell the layer to drain, and pass an event to signal back when drained.

Parameters
dedrain event to call once drained
Returns
1 if busy or waiting to retry, or 0 if idle

Implements Drainable.

Definition at line 584 of file xbar.cc.

◆ failedTiming()

template<typename SrcType , typename DstType >
void BaseXBar::Layer< SrcType, DstType >::failedTiming ( SrcType *  src_port,
Tick  busy_time 
)

Deal with a destination port not accepting a packet by potentially adding the source port to the retry list (if not already at the front) and occupying the layer accordingly.

Parameters
src_portSource port
busy_timeTime to spend as a result of a failed send

Definition at line 222 of file xbar.cc.

◆ name()

template<typename SrcType , typename DstType >
const std::string BaseXBar::Layer< SrcType, DstType >::name ( ) const
inline

Definition at line 114 of file xbar.hh.

◆ occupyLayer()

template<typename SrcType , typename DstType >
void BaseXBar::Layer< SrcType, DstType >::occupyLayer ( Tick  until)

Definition at line 158 of file xbar.cc.

◆ recvRetry()

template<typename SrcType , typename DstType >
void BaseXBar::Layer< SrcType, DstType >::recvRetry ( )

Handle a retry from a neighbouring module.

This wraps retryWaiting by verifying that there are ports waiting before calling retryWaiting.

Definition at line 303 of file xbar.cc.

◆ releaseLayer()

template<typename SrcType , typename DstType >
void BaseXBar::Layer< SrcType, DstType >::releaseLayer ( )
private

Release the layer after being occupied and return to an idle state where we proceed to send a retry to any potential waiting port, or drain if asked to do so.

Definition at line 244 of file xbar.cc.

◆ retryWaiting()

template<typename SrcType , typename DstType >
void BaseXBar::Layer< SrcType, DstType >::retryWaiting ( )

Send a retry to the port at the head of waitingForLayer.

The caller must ensure that the list is not empty.

Definition at line 268 of file xbar.cc.

◆ sendRetry()

template<typename SrcType , typename DstType >
virtual void BaseXBar::Layer< SrcType, DstType >::sendRetry ( SrcType *  retry_port)
protectedpure virtual

Sending the actual retry, in a manner specific to the individual layers.

Note that for a RequestPort, there is both a RequestLayer and a SnoopResponseLayer using the same port, but using different functions for the flow control.

Implemented in BaseXBar::SnoopRespLayer, BaseXBar::ReqLayer, and BaseXBar::RespLayer.

◆ succeededTiming()

template<typename SrcType , typename DstType >
void BaseXBar::Layer< SrcType, DstType >::succeededTiming ( Tick  busy_time)

Deal with a destination port accepting a packet by potentially removing the source port from the retry list (if retrying) and occupying the layer accordingly.

Parameters
busy_timeTime to spend as a result of a successful send

Definition at line 210 of file xbar.cc.

◆ tryTiming()

template<typename SrcType , typename DstType >
bool BaseXBar::Layer< SrcType, DstType >::tryTiming ( SrcType *  src_port)

Determine if the layer accepts a packet from a specific port.

If not, the port in question is also added to the retry list. In either case the state of the layer is updated accordingly.

Parameters
portSource port presenting the packet
Returns
True if the layer accepts the packet

Definition at line 179 of file xbar.cc.

Member Data Documentation

◆ _name

template<typename SrcType , typename DstType >
std::string BaseXBar::Layer< SrcType, DstType >::_name
private

Definition at line 182 of file xbar.hh.

Referenced by BaseXBar::Layer< RequestPort, ResponsePort >::name().

◆ occupancy

template<typename SrcType , typename DstType >
Stats::Scalar BaseXBar::Layer< SrcType, DstType >::occupancy
private

Stats for occupancy and utilization.

These stats capture the time the layer spends in the busy state and are thus only relevant when the memory system is in timing mode.

Definition at line 229 of file xbar.hh.

◆ port

template<typename SrcType , typename DstType >
DstType& BaseXBar::Layer< SrcType, DstType >::port
private

The destination port this layer converges at.

Definition at line 177 of file xbar.hh.

◆ releaseEvent

template<typename SrcType , typename DstType >
EventFunctionWrapper BaseXBar::Layer< SrcType, DstType >::releaseEvent
private

Definition at line 222 of file xbar.hh.

◆ state

template<typename SrcType , typename DstType >
State BaseXBar::Layer< SrcType, DstType >::state
private

Definition at line 202 of file xbar.hh.

◆ utilization

template<typename SrcType , typename DstType >
Stats::Formula BaseXBar::Layer< SrcType, DstType >::utilization
private

Definition at line 230 of file xbar.hh.

◆ waitingForLayer

template<typename SrcType , typename DstType >
std::deque<SrcType*> BaseXBar::Layer< SrcType, DstType >::waitingForLayer
private

A deque of ports that retry should be called on because the original send was delayed due to a busy layer.

Definition at line 208 of file xbar.hh.

◆ waitingForPeer

template<typename SrcType , typename DstType >
SrcType* BaseXBar::Layer< SrcType, DstType >::waitingForPeer
private

Track who is waiting for the retry when receiving it from a peer.

If no port is waiting NULL is stored.

Definition at line 214 of file xbar.hh.

◆ xbar

template<typename SrcType , typename DstType >
BaseXBar& BaseXBar::Layer< SrcType, DstType >::xbar
private

The crossbar this layer is a part of.

Definition at line 180 of file xbar.hh.


The documentation for this class was generated from the following files:

Generated on Wed Sep 30 2020 14:02:22 for gem5 by doxygen 1.8.17