data.fifo.wide_to_narrow ≡
Wide to narrow fifo
template < typename T, auto ArraySize, auto ArrayDepth, bool EnqueueBlocking = true, bool DequeueBlocking = true > class fifo §
A FIFO that accepts arrays of inputs, and returns single values
Parameters
-
typename TDatatype for each entry of the FIFO.
-
auto ArraySizeNumber of elements in input arrays, must be a power of 2.
-
auto ArrayDepthMaximum number of arrays that can be stored, must be a power of 2.
-
bool EnqueueBlocking = true
Block on enqueue if the FIFO is full until an entry frees up. By default this is true. Otherwise, the caller must ensure that the FIFO is not full.
-
bool DequeueBlocking = true
Block on dequeue if the FIFO is empty until an entry arrives. By default, this is true. Otherwise, the caller must ensure that the FIFO is not empty.
Aliases
-
using array_t = T[ArraySize] §
Callbacks and Fields
-
const auto ScalarDepth = (ArrayDepth * ArraySize) §
The number of scalar elements the FIFO can hold
Methods
-
T dequeue_and_discard(index_t<ArraySize> discard_count) §
Read one entry from FIFO and discard
discard_countsubsequent entries. Block if FIFO is empty andDequeueBlockingis true. -
T dequeue() §
Read one entry from FIFO. Block if FIFO is empty and
DequeueBlockingis true. -
void enqueue(fifo::array_t values) §
Write one entry to the FIFO. Block if FIFO is full and
EnqueueBlockingis true.
Invariants
-
(0 == (ArraySize & (ArraySize - 1)))
ArraySize must be a power of 2
-
(0 == (ArrayDepth & (ArrayDepth - 1)))
ArrayDepth must be a power of 2