data.fifo.multi


template <
    typename T,
    auto Size,
    auto N,
    bool EnqueueBlocking = true,
    bool DequeueBlocking = true
    >
class multi_fifo §

This class implements a set of FIFOs that use a single, statically partitioned block of memory. Note that when using the blocking version, a call for one of the FIFO instances that blocks will also block subsequent calls for other FIFO instances, even if those calls would otherwise not block. In other words, there is head of line blocking across FIFOs.

Parameters

  • typename T
    

    Type of each entry in the FIFO.

  • auto Size
    

    Maximum number of entries that can be stored in each FIFO.

  • auto N
    

    Number of FIFOs.

  • 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

Methods

  • inline count_t<Size> count(multi_fifo::fifo_idx_t which) §
    

    Return the number of elements that have been written and not read. Note that this can be out of date the instant it is read due to other threads reading or writing to the FIFO. This cannot be used for checking empty or full for non-blocking versions of the FIFO.

  • T dequeue(multi_fifo::fifo_idx_t which, bool pop) §
    

    Read one entry from a FIFO. Block if the FIFO is empty and DequeueBlocking is true. If pop is false then the entry is left on the FIFO, equivalent to front.

  • void enqueue(multi_fifo::fifo_idx_t which, T value) §
    

    Write one entry to a FIFO. Block if the FIFO is full and EnqueueBlocking is true.