Moving Examples to a Different FPGA Target

Updated Sep 23, 2020



  • LabVIEW FPGA Module
  • LabVIEW

Most FPGA examples, such as those in the NI Example Finder, are configured for a specific FPGA target. To reuse these examples with your specific hardware, you can move them to a new target. This tutorial guides you in relocating an example to a different FPGA target by moving the VIs, I/O, and FPGA resources.

Duplicating the Project

Before moving an FPGA example to a different target, make a duplicate of the original example. This way you do not modify the original and can return to it later if you choose to make changes.

  1. Open the example you want to move to a new FPGA target in the LabVIEW software. This tutorial uses the NI 9205 Basic IO.lvproj example in the NI Example Finder at Hardware Input and Output » CompactRIO » Module Specific IO » Analog Input » NI 9205 Basic IO.lvproj.
  2. Make a duplicate of the project and VIs by navigating to File » Save As. Click Duplicate .lvproj file and contents and Select the contents to copy. Click Continue.

Figure 1. Duplicate the original example.
  1. Deselect the Dependencies folder(s) so LabVIEW uses copies of the dependencies from vi.lib rather than a new copy. Click OK and choose a location to save the files.

Figure 2. Deselect the dependencies to minimize unnecessary code copies.
  1. Close the original example and open the new copy.


Moving the Files to a New Target

When moving an example to a new target, copy all the VIs, I/O, and FPGA resources specific to the example to the new target to ensure LabVIEW FPGA can link the project resources with the physical FPGA resources. LabVIEW FPGA uses the names of the VIs, I/O, and FPGA resources such as DMA FIFOs, registers, and memory items to link your code with the project resources.

  1. Add your target, including your FPGA and any I/O, to the project.This tutorial moves the example to a cRIO-9036 device.
  • To add a remote FPGA target such as a CompactRIO or Single-Board RIO device, right-click the top Project item in the project and click New » Targets and Devices. Select your remote target from the list. To add the FPGA target, right-click the chassis item on the newly added target and click New » FPGA Target.
  • To add a local FPGA target such as an R Series card, right-click My Computer in the project and click New » Targets and Devices. Select your local FPGA target from the list.
  • To add I/O to the FPGA target, right-click the FPGA target and click New » C Series Module or FPGA I/O.

Figure 3. Add the intended FPGA target to the project by right-clicking the item, choosing New » Targets and Devices, and locating the cRIO-9036 in the displayed list.
  1. Expand the CompactRIO target, chassis, and FPGA target of both targets. Move the VIs and FPGA resources (DMA FIFOs, registers, memory items, and so on) between the existing and new target by clicking and dragging between the two. Any host VIs on a Real-Time target  should also be copied.

Figure 4. Move VIs and FPGA resources between targets. In this example, NI 9205 Basic IO (FPGA).vi, NI 9205 Basic IO (Host).vi, and the Data DMA FIFO were moved from the cRIO-9068 to the cRIO-9036.
  1. Rename the I/O under the new target to match the I/O names under the original target. Right-click on any I/O channels whose names need to be changed and click Rename. LabVIEW FPGA uses the input type (that is, analog input) and name to link physical channels to I/O nodes on the block diagram. In this example, no I/O needs renaming because the default channel names were used.

Figure 5. Rename a FPGA I/O channel.
  1. Open the main VI for the example under the new target. Ensure the run arrow is not broken. If the run arrow is broken, use the error list (View » Error List) to debug and fix the root cause of the broken VI such as a missing subVI, incorrectly named I/O, or missing FPGA resources under the FPGA target.

Figure 6. Examine the run arrow of the retargeted FPGA VI to ensure all VIs, I/O, and FPGA resources were moved correctly.
  1. Remove the old FPGA target from the project by right-clicking on the target and clicking Remove from Project.

Figure 7. Remove the old target from the project when no longer needed.

Compiling the Code

To complete the process of moving the FPGA VI to a new target, recompile the FPGA VI and update the FPGA VI reference in the host application if needed.

  1. Right-click the main FPGA VI and click Create Build Specification.

Figure 8. Create an FPGA build specification for the retargeted example.
  1. Right-click the created build specification and click Build. Select your compile server in the window and click OK. The compilation process may take several minutes to several hours, depending on the complexity of the example.

Figure 9. Build the FPGA code.
  1. If the example has a host VI, locate the Open FPGA VI Reference node on the block diagram, right-click it, and click Configure Open FPGA VI Reference. Otherwise, skip to step 5.

Figure 10. Locate the Open FPGA VI Reference and open the configuration window to change the FPGA target.
  1. Click the folder to the right of the build specification field and select the FPGA VI in the displayed window. Click OK. Click OK in the Configure Open FPGA VI Reference window. The host VI should no longer have broken wires related to the FPGA nodes.

Figure 11. Choose the updated FPGA VI to run and use for the FPGA reference in the host VI.
  1. Run the code after the FPGA code finishes compiling.

Next Steps