IP to FPGA Conversion Utility

Overview

The IP to FPGA Conversion Utility supports the conversion of MathWorks MATLAB Simulink® models into NI FPGA bitfiles. An earlier approach used a manual process that required LabVIEW expertise. In contrast, this utility auto-converts a given Simulink model into a bitfile.
 

This document details how to use the IP to FPGA Conversion Utility. It is intended for those who want to convert Simulink models into FPGA bitfiles for deployment to the following NI FPGA Hardware:
 

  • NI PXIe-7867R
  • NI PXIe-7868R

The document also discusses how to interface with the generated bitfile using VeriStand and other applications.
 

Note: This process assumes familiarity with Simulink. For more information and examples of Simulink designs, refer to the MathWorks documentation.

Contents

Installation Instructions

To install the IP to FPGA Conversion Utility, refer to readme.

Limitations

The IP to FPGA Conversion Utility has the following limitations:

  • No support for double precision ports
  • Only registers CPU-FPGA communication through Read/Write controls
  • Only allows combinatorial circuits, such as circuits without clocks

Converting Simulink Models into Bitfiles

Software Requirements

Steps

  1. Open the model you want to convert into an NI FPGA bitfile in Simulink.
  2. Navigate to the Configuration Parameters window.
    Note: For more information on the Simulink environment, refer to their documentation.
  3. In the navigation pane, click HDL Coder Generation.
  4. Set the Language to VHDL.
    Note: Verilog is not supported.
  5. Set the Folder where Simulink will generate the VHDL code.
  6. Click Run Compatibility Checker to confirm the compatibility of the model.

                                                         

  7. In the navigation pane under HDL Code Generation, click Target and enter a Target Frequency (MHz).

                                                                

  8. (Optional): If your model has an array or complex ports, in the navigation pane click Global Settings and set Scalarize ports to on.

                                                           

  9. Save the model (.slx) and generate the HDL code.
  10. Ensure that all LabVIEW and LabVIEW FPGA licenses are activated on the machine you are running the IP to FPGA Conversion Utility.
    Note: You can skip this step during subsequent bitfile conversions.
  11. Open the Command Line and enter ip2fpgaCLI.exe.
  12. Enter the create-config command to create a configurations template file.
    Note: For more information on the create-config command, refer to the Commands Table.
  13. (Optional): To have the configuration template file map the model ports to Board I/Os, refer to Modifying Configuration Template File. By default, model ports map to registers.
  14. Open LabVIEW and select the Compile Server option from Tools >> Options.
    Note: You can skip this step during subsequent bitfile conversions. For more information on compiling options, refer to NI LabVIEW FPGA Compilation Options.

                                                                           

  15. Enter the build-bitfile command to generate the bitfile.
    Using this command causes the IP to FPGA Conversion Utility to display information in the command line output. This information includes the created LabVIEW Project Path, Data Ports table, Estimated Device Utilization, Final Device Utilization, Bitfile Path, and more.
    Note: For more information on build-bitfile command, refer to the Commands Table.

Importing a Bitfile into VeriStand

Software Requirements      

Steps

  1. After generating a bitfile, import that file into VeriStand through the FPGA Addon Custom Device.
    The path to the bitfile can be found in the command line output.



  2. Open VeriStand System Explorer to add the FPGA Addon Custom Device.
    Note: For more information, refer to the FPGA Addon Quick Start Guide on GitHub.

  

Interfacing with the Bitfile from other Applications

In addition to VeriStand, you can interface with the bitfile from the following applications:

Modifying the Configuration Template File

The configuration file allows the user to map a model port to the supported NI FPGA Board I/O or to registers. A template configuration file can be created by using the create-config command.

Note: By default, all model ports map to registers.

The configuration file also contains information on the available Board I/Os for the selected NI FPGA target. This helps with mapping model ports to Board I/Os.

Before modifying the configuration file, read the file’s Board I/O details. Understanding the direction and datatype of the model port and Board I/O is essential to determining the correct connection configuration. The following is a snippet of a model port mapped to a Board I/O.

 

Note: Using the build-bitfile command will trigger a data loss warning if the model port bitness does not match the mapped Board I/O bitness.

Commands Table

Command

Command Options

Description

Example

 

-v, --verbose

Increases output logging verbosity.

 

create-config

 

Creates a configuration template file for the specified NI FPGA. This file can be used to map model ports to a Board I/O.

 

The configuration file can be passed on as an option for the build-bitfile command

ip2fpgaCLI.exe create-config -p "C:\Users\SampleUser\Desktop\Sample\SubSystem.slx" -t "PXIe-7867R" -l 2019 -o "C:\Users\ SampleUser\Desktop\Sample\SubSystem.JSON"

 

-p, --project=<value>

Specifies a path to a Simulink (.slx) project. Simulink must successfully generate HDL code before using this command.                            

 

 

-t, --target=<value>

Specifies the NI FPGA target type to generate the bitfile. Enter the value as either PXIe-7867R or PXIe-7868R.

 

 

-l, --lvversion=<value>

(optional)

Specifies the LabVIEW version used to compile the bitfile. If not specified, the default is the latest LabVIEW version.

 

 

-o, --output=<value>

 

Specifies the path for saving the configuration (.json) file.

 

build-bitfile

 

Builds a bitfile from the provided SLX file and targeting the specified NI FPGA Board

ip2fpgaCLI.exe build-bitfile -p "C:\Users\SampleUser\Desktop\Sample\SubSystem.slx" -t "PXIe-7867R" -l 2019 -c "C:\Users\ SampleUser \Desktop\Sample\SubSystem.JSON"

 

-p, --project=<value>

Specifies a path to a SLX file. Simulink must successfully generate HDL code before using this command.                             

 

 

-t, --target=<value>

Specifies the NI FPGA target type to generate the bitfile. Enter the value as either PXIe-7867R or PXIe-7868R.

 

 

-l, --lvversion=<value>(optional)

Specifies the LabVIEW version used to compile the bitfile. If not specified, the default is the latest LabVIEW version.

 

 

-n, --nocompile (optional)

If present, execution will stop after generating the LabVIEW FPGA project. No bitfile will be compile.

 

For more information on this command, refer to Advanced Modifications.

 

 

-c, --configfile=<value> (optional)

Specifies the path to a Configuration file (.json). If not specified, the default is to map model ports to board I/Os.

 

Advanced Modifications

LabVIEW users may want to make the following changes:

  • Add another custom IP
  • Update the Xilinx Implementation Strategy
  • Configure the Board I/O properties before generating a bitfile

To do so, open the LabVIEW project generated by the build-bitfile command using the command option -n:

ip2fpgaCLI.exe build-bitfile -p "C:\Users\SampleUser\Desktop\Sample\SubSystem.slx" -t "PXIe-7868R" -l 2019 -n

Use the generated LabVIEW project file to make the necessary modifications. You can find this file at the path displayed in the output window.

Was this information helpful?

Yes

No