MatchLib
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< 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
}
}
...

Definition at line 68 of file ReorderBuf.h.


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