FIFOs

class nifpga.session._FIFO(session, nifpga, bitfile_fifo, datatype=None)[source]

Bases: object

_FIFO is a private class that is a wrapper for the logic that associated with a FIFO.

All FIFOs will exists in a sessions session.fifos property. This means that all possible FIFOs for a given session are created during session initialization; a user should never need to create a new instance of this class.

class AcquireReadValues(data, elements_acquired, elements_remaining)

Bases: tuple

data

Alias for field number 0

elements_acquired

Alias for field number 1

elements_remaining

Alias for field number 2

class AcquireWriteValues(data, elements_acquired, elements_remaining)

Bases: tuple

data

Alias for field number 0

elements_acquired

Alias for field number 1

elements_remaining

Alias for field number 2

class ReadValues(data, elements_remaining)

Bases: tuple

data

Alias for field number 0

elements_remaining

Alias for field number 1

buffer_allocation_granularity

The allocation granularity of the host memory part of a DMA FIFO.

By default this will usually be a page size, which is optimal for most devices. This property can be used to customize it.

buffer_size

The size in elements of the Host Memory part of a DMA FIFO.

commit_configuration()[source]

Resolves and Commits property changes made to the FIFO.

configure(requested_depth)[source]

Specifies the depth of the host memory part of the DMA FIFO.

Parameters:requested_depth (int) – The depth of the host memory part of the DMA FIFO in number of elements.
Returns:The actual number of elements in the host memory part of the DMA FIFO, which may be more than the requested number.
Return type:actual_depth (int)
datatype

Property of a Fifo that contains its datatype.

flow_control

Controls whether the FPGA will wait for the host when using FIFOs.

If flow control is disabled, the FPGA will have free reign to read or write elements before the host is ready. This means the FIFO no longer acts in a First In First Out manner.

For Host To Target FIFOs, this feature is useful when you want to put something like a waveform in a FIFO and let the FPGA continue reading that waveform over and over without any involvement from the host.

For Target To Host FIFOs, this feature is useful when you only care about the latest data and don’t care about old data.

get_peer_to_peer_endpoint()[source]

Gets an endpoint reference to a peer-to-peer FIFO.

name

Property of a Fifo that contains its name.

read(number_of_elements, timeout_ms=0)[source]

Read the specified number of elements from the FIFO.

Note

If the FIFO has not been started before calling _FIFO.read(), then it will automatically start and continue to work as expected.

Parameters:
  • number_of_elements (int) – The number of elements to read from the FIFO.
  • timeout_ms (int) – The timeout to wait in milliseconds.
Returns:

ReadValues (namedtuple):

ReadValues.data (list): containing the data from
    the FIFO.
ReadValues.elements_remaining (int): The amount of elements
    remaining in the FIFO.

start()[source]

Starts the FIFO.

stop()[source]

Stops the FIFO.

write(data, timeout_ms=0)[source]

Writes the specified data to the FIFO.

Note

If the FIFO has not been started before calling _FIFO.write(), then it will automatically start and continue to work as expected.

Parameters:
  • data (list) – Data to be written to the FIFO.
  • timeout_ms (int) – The timeout to wait in milliseconds.
Returns:

The number of elements remaining in the host memory part of the DMA FIFO.

Return type:

elements_remaining (int)