This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

Fixed-Point Data Over DMA FIFO

Updated Nov 6, 2020

Reported In

Software

  • LabVIEW Full
  • LabVIEW FPGA Module

Issue Details

  • Moving fixed-point data over a DMA FIFO
  • On FIFO read I only receive a whole number when the FIFO or memory is read
  • I need to transfer the data so that the fractional part (mantissa) of the data remains intact

Solution

For LabVIEW 8.6 and later

  • You can set up the DMA FIFO such that it supports the fixed-point data type

For LabVIEW 8.5.x

  • DMA FIFO only supports the unsigned 32-bit data type
  • You will need to work around this limitation in order to pass both parts of the fixed point

Generally, we need to match the FIFO data type to our input
  • Target and VI-scoped FIFOs and memory can pass data of varying types
  • Match the type of the FIFO or memory with the word length of the fixed-point data, rounding the FIFO or memory datatype up
  • For example, if you are passing a fixed-point number with a word length of 20, use an unsigned 32-bit FIFO

Additional Information

To setup a DMA FIFO to take fixed-point in LabVIEW 8.6 and later
  1. Create the FIFO, or edit its properties in the project by right-clicking on in and selecting Properties
  2. Then select fixed-point (FXP) as the data type for the FIFO
  3. This will allow you to pass fixed-point data through the FIFO unchanged
 

FPGA Conversion

  1. Convert the fixed-point number to an array of Booleans using the Number to Boolean Array VI
  2. Convert this array of booleans to an unsigned 32-bit integer using the Boolean Array to Number VI
  3. Wire the output of the Boolean Array to Number to the Element input of the FIFO Write VI
 

Host Conversion

  1. On the host side, read a number of elements from the DMA FIFO
  2. Convert each element one at a time to an array of Booleans using the Number to Boolean Array VI, inside of an auto-indexed for loop
  3. Place a Boolean Array to Number VI inside of the for loop and wire the Boolean array to the input
  4. Right-click on the Boolean Array to Number VI and select Properties.  Change the representation to fixed-point and fill in the Fixed-Point Configuration according to the properties of the fixed point data type on the FPGA
  5. Wire the fixed-point data type out of the for loop into an auto-indexed terminal
  • Note: It is required to know the settings of the fixed-point data on the FPGA in order to convert the number on the host
  • Note: It is necessary to use the Binary Array to Number and override the output type under the properties of the VI.  Using just the Binary Array to Number and then the To FXP VIs will also truncate the fractional part of the data.
Once the fixed-point data is converted, you can use the numeric conversion VIs to convert the data to any representation that is needed on the host.