Table Of Contents

Transferring Data between a Target and Host Using FIFOs

Last Modified: September 20, 2016

Before completing this task, verify that FIFOs are the best data storage and transfer option for your application.

Use FIFOs to transfer data between an FPGA target and a host processor without data loss.

What to Use

What to Do

  1. Create the following diagram in a G VI targeted to your host processor.

    Customize the gray sections for your unique programming goals.

    Use the RIO address for your FPGA found in Measurement & Automation Explorer (MAX) to specify an FPGA target. To ensure your code runs on the FPGA, the RIO address input must match the FPGA target RIO Alias.
    Select Open FPGA VI Reference and assign a bitfile on the Item tab. You must assign a bitfile before you can select FIFO references for Write DMA FIFO and Read DMA FIFO.
    spd-note-note
    Note  

    If no bitfile appears on the Item tab, select a VI targeted to the FPGA target in SystemDesigner and specify Bitfile as the Build Output on the Item tab. The Build Name of the bitfile for that FPGA VI should now appear in the configuration options for Open FPGA VI Reference within the host VI.

    Perform operations using the host processor before transferring data to the FPGA target. The data you write to Write DMA FIFO must use the same data type that you need in your FPGA VI. Convert data types from the host processor to the data type of the FIFO you specify for Write DMA FIFO.
    In a shared resource collection (.grsc) targeted to the FPGA, create a Host to Target FIFO. In the host VI, select Write DMA FIFO and specify the reference to the Host to Target FIFO in the General section of the Item tab.
    In a shared resource collection (.grsc) targeted to the FPGA, create a Target to Host FIFO. In the host VI, select Read DMA FIFO and specify the reference to the Target to Host FIFO in the General section of the Item tab.
    The data output from Read DMA FIFO contains data written to the DMA FIFO from the FPGA target. Use this output to display data from the FPGA target on the host, or use the host to further process the output data using the host processor.
  2. Create the following diagram in a G VI diagram targeted to your FPGA.

    Customize the gray sections for your unique programming goals.

Use a FIFO constant to reference the Host to Target FIFO that you created. Use the same FIFO reference for Read FIFO that you specify for Write DMA FIFO on the host VI.
Process the data sent from the host. Use handshaking when working with nodes that have a latency of greater than one clock cycle to ensure the FPGA writes valid data.
Use a FIFO constant to reference the Target to Host FIFO that you created. Use the same FIFO reference for Write FIFO that you specify for Read DMA FIFO on the host VI.

Troubleshooting

  • If you receive unexpected or invalid data on your host from your target:
    • Check that the RIO address for your hardware is correct. Verify the RIO address input you use in LabVIEW matches the RIO Alias listed for your hardware device in NI Measurement & Automation Explorer (MAX).
    • Check that the FIFO references on the host match the FIFO references on the target. The FIFO you configure for Write DMA FIFO on the host must match the FIFO reference you send to Read FIFO on the FPGA target. The FIFO you configure for Read DMA FIFO on the host must match the FIFO reference you send to Write FIFO on the FPGA target.
  • Make sure the FPGA VI appears in the Project Files tab as part of the project. Select the FPGA VI in SystemDesigner and make sure you select Bitfile in the Build Output pull-down menu in the Build Options section of the Item tab.

Examples

Search LabVIEW for the following installed examples:

  • FIFO
  • FPGA Host Interface

Recently Viewed Topics