MatchLib
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
FIFO< DataType, FifoLen, NumBanks > Class Template Reference

Configurable FIFO class. More...

#include <fifo.h>

Public Member Functions

typedef NVUINTW (BankSelWidth) BankIdx
 
typedef NVUINTW (AddrWidth) FifoIdx
 
typedef NVUINTW (AddrWidth+1) FifoIdxPlusOne
 
FifoIdx ModIncr (FifoIdx curr_idx)
 
void push (DataType wr_data, BankIdx bidx=0)
 
DataType pop (BankIdx bidx=0)
 
void incrHead (BankIdx bidx=0)
 
DataType peek (BankIdx bidx=0)
 
bool isEmpty (BankIdx bidx=0)
 
bool isFull (BankIdx bidx=0)
 
FifoIdxPlusOne NumFilled (BankIdx bidx=0)
 
FifoIdxPlusOne NumAvailable (BankIdx bidx=0)
 
void reset ()
 
FifoIdx get_head (BankIdx bidx=0)
 
FifoIdx get_tail (BankIdx bidx=0)
 
template<unsigned int Size>
void Marshall (Marshaller< Size > &m)
 

Public Attributes

FifoIdx head [NumBanks]
 
FifoIdx tail [NumBanks]
 
mem_array_sep< DataType, FifoLen *NumBanks, NumBanks > fifo_body
 
bool last_action_was_push [NumBanks]
 

Static Public Attributes

static const int BankSelWidth
 
static const int AddrWidth
 
static const int width = mem_array_sep<DataType, FifoLen * NumBanks, NumBanks>::width + 2 * NumBanks * AddrWidth + NumBanks
 

Detailed Description

template<typename DataType, unsigned int FifoLen, unsigned int NumBanks = 1>
class FIFO< DataType, FifoLen, NumBanks >

Configurable FIFO class.

Template Parameters
DataTypeDataType of entry in FIFO
FifoLenLength of FIFO
NumBanksNumber of FIFO banks
A Simple Example
#include <fifo.h>
...
FIFO<DataType, LenInputBuffer, NumInputs> fifo_inst;
fifo_inst.reset(); // optional in this case, suitable if fifo is a class member rather than local variable
...
// Push to FIFO
if (!fifo_inst.isFull(bank_id)) {
fifo_inst.push(input_data, bank_id);
}
...
// Pop from FIFO
if (!fifo_inst.isEmpty(bank_id)) {
output_data = fifo_inst.pop(bank_id);
}
...
// Peek from FIFO
if (!fifo_inst.isEmpty(bank_id)) {
output_data = fifo_inst.peek(bank_id);
}
...
// IncrHead without reading data from FIFO
fifo_inst.incrHead(bank_id);

Definition at line 65 of file fifo.h.

Member Data Documentation

◆ BankSelWidth

template<typename DataType , unsigned int FifoLen, unsigned int NumBanks = 1>
const int FIFO< DataType, FifoLen, NumBanks >::BankSelWidth
static
Initial value:
=
(NumBanks == 1) ? 1 : nvhls::nbits<NumBanks - 1>::val
Compute number of bits to represent a constant.
Definition: nvhls_int.h:118

Definition at line 68 of file fifo.h.

◆ AddrWidth

template<typename DataType , unsigned int FifoLen, unsigned int NumBanks = 1>
const int FIFO< DataType, FifoLen, NumBanks >::AddrWidth
static
Initial value:
=
(FifoLen == 1) ? 1 : nvhls::nbits<FifoLen - 1>::val

Definition at line 70 of file fifo.h.


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