MatchLib
All Classes Namespaces Files Functions Modules Pages
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
ReorderBuf< Data, Depth, InFlight > Class Template Reference

Reorder Buffer that allows out-of-order writes to queue and in-order reads. More...

#include <ReorderBuf.h>

Inheritance diagram for ReorderBuf< Data, Depth, InFlight >:
ReorderBufWBeats< RdResp< Cfg >, 8, 4 > ReorderBufWBeats< Data, Depth, InFlight >

Public Types

typedef sc_uint< nvhls::index_width< InFlight >::val > Id
 

Public Member Functions

bool canAcceptRequest ()
 
Id addRequest ()
 
bool topResponseReady ()
 
void addResponse (const Id &id, const Data &data)
 
Data popResponse ()
 
void reset ()
 
bool isEmpty ()
 

Protected Types

typedef FIFO< bool, Depth > VBits
 
typedef VBits::FifoIdx EntryNum
 
typedef mem_array_sep< EntryNum, InFlight, 1 > Id2Entry
 

Protected Member Functions

typedef NVUINTW (InFlight) IdRepository
 
bool get_next_avail_id (Id &id, IdRepository &id_repository)
 

Protected Attributes

mem_array_sep< Data, Depth, 1 > storage
 
VBits vbits
 
IdRepository idrep
 
Id2Entry id2entry
 

Detailed Description

template<typename Data, unsigned int Depth, unsigned int InFlight>
class ReorderBuf< Data, Depth, InFlight >

Reorder Buffer that allows out-of-order writes to queue and in-order reads.

Template Parameters
DataDataType
DepthDepth of queue
InFlightNumber of inflight entries
A Simple Example
#include <ReorderBuf.h>
...
void ReorderBufTop( const OpType& op,
const DataType& in_data,
const Rob::Id& in_id,
Rob::Id& out_id,
DataType& out_data,
bool& out_resp)
{
static Rob rob;
out_id = 0; out_resp = false; out_data =0;
switch (op)
{
case canAccept: out_resp = rob.canAcceptRequest(); break;
case addRequest: out_id = rob.addRequest(); break;
case top: out_resp = rob.topResponseReady(); break;
case addResponse: rob.addResponse(in_id, in_data);break;
case popResponse: out_data = rob.popResponse(); break;
case reset: rob.reset(); break;
case isEmpty: out_resp = rob.isEmpty(); break;
default:
NVHLS_ASSERT_MSG(0,"invalid op"); //never get here
}
}
...
#define NVHLS_ASSERT_MSG(X, MSG)

Definition at line 68 of file ReorderBuf.h.

Member Typedef Documentation

◆ Id

template<typename Data , unsigned int Depth, unsigned int InFlight>
typedef sc_uint<nvhls::index_width<InFlight>::val> ReorderBuf< Data, Depth, InFlight >::Id

Definition at line 75 of file ReorderBuf.h.

◆ VBits

template<typename Data , unsigned int Depth, unsigned int InFlight>
typedef FIFO<bool, Depth> ReorderBuf< Data, Depth, InFlight >::VBits
protected

Definition at line 79 of file ReorderBuf.h.

◆ EntryNum

template<typename Data , unsigned int Depth, unsigned int InFlight>
typedef VBits::FifoIdx ReorderBuf< Data, Depth, InFlight >::EntryNum
protected

Definition at line 85 of file ReorderBuf.h.

◆ Id2Entry

template<typename Data , unsigned int Depth, unsigned int InFlight>
typedef mem_array_sep<EntryNum, InFlight,1> ReorderBuf< Data, Depth, InFlight >::Id2Entry
protected

Definition at line 87 of file ReorderBuf.h.

Constructor & Destructor Documentation

◆ ReorderBuf()

template<typename Data , unsigned int Depth, unsigned int InFlight>
ReorderBuf< Data, Depth, InFlight >::ReorderBuf ( )
inline

Definition at line 71 of file ReorderBuf.h.

Member Function Documentation

◆ get_next_avail_id()

template<typename Data , unsigned int Depth, unsigned int InFlight>
bool ReorderBuf< Data, Depth, InFlight >::get_next_avail_id ( Id &  id,
IdRepository &  id_repository 
)
inlineprotected

Definition at line 90 of file ReorderBuf.h.

◆ canAcceptRequest()

template<typename Data , unsigned int Depth, unsigned int InFlight>
bool ReorderBuf< Data, Depth, InFlight >::canAcceptRequest ( )
inline

Definition at line 106 of file ReorderBuf.h.

◆ addRequest()

template<typename Data , unsigned int Depth, unsigned int InFlight>
Id ReorderBuf< Data, Depth, InFlight >::addRequest ( )
inline

Definition at line 111 of file ReorderBuf.h.

◆ topResponseReady()

template<typename Data , unsigned int Depth, unsigned int InFlight>
bool ReorderBuf< Data, Depth, InFlight >::topResponseReady ( )
inline

Definition at line 123 of file ReorderBuf.h.

◆ addResponse()

template<typename Data , unsigned int Depth, unsigned int InFlight>
void ReorderBuf< Data, Depth, InFlight >::addResponse ( const Id &  id,
const Data &  data 
)
inline

Definition at line 132 of file ReorderBuf.h.

◆ popResponse()

template<typename Data , unsigned int Depth, unsigned int InFlight>
Data ReorderBuf< Data, Depth, InFlight >::popResponse ( )
inline

Definition at line 141 of file ReorderBuf.h.

◆ reset()

template<typename Data , unsigned int Depth, unsigned int InFlight>
void ReorderBuf< Data, Depth, InFlight >::reset ( )
inline

Definition at line 151 of file ReorderBuf.h.

◆ isEmpty()

template<typename Data , unsigned int Depth, unsigned int InFlight>
bool ReorderBuf< Data, Depth, InFlight >::isEmpty ( )
inline

Definition at line 157 of file ReorderBuf.h.

Member Data Documentation

◆ storage

template<typename Data , unsigned int Depth, unsigned int InFlight>
mem_array_sep<Data, Depth, 1> ReorderBuf< Data, Depth, InFlight >::storage
protected

Definition at line 78 of file ReorderBuf.h.

◆ vbits

template<typename Data , unsigned int Depth, unsigned int InFlight>
VBits ReorderBuf< Data, Depth, InFlight >::vbits
protected

Definition at line 80 of file ReorderBuf.h.

◆ idrep

template<typename Data , unsigned int Depth, unsigned int InFlight>
IdRepository ReorderBuf< Data, Depth, InFlight >::idrep
protected

Definition at line 84 of file ReorderBuf.h.

◆ id2entry

template<typename Data , unsigned int Depth, unsigned int InFlight>
Id2Entry ReorderBuf< Data, Depth, InFlight >::id2entry
protected

Definition at line 88 of file ReorderBuf.h.


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