Two of the most commonly used hardware description languages are VHDL and Verilog. LabVIEW FPGA natively supports integration of IP written in VHDL. However, it is not possible to natively integrate IP written in Verilog. This tutorial shows how to use the Xilinx Vivado Design Suite to prepare an existing Verilog module for integration into LabVIEW FPGA through one of the following methods:
To complete this tutorial, you must have the following software installed:
You must download and extract the attached zip folder which contains all the source files that will be used throughout the tutorial and the IP integrated through both CLIP and IPIN.
Note: This document was created using LabVIEW 2018 and Vivado 2017.2. The steps and UI text may differ in other LabVIEW or Vivado versions.
For the purpose of this tutorial, a simple Verilog module has been provided as a starting point. The file can be found in the attached folder at the following location:
Adder.v instantiates a clock driven, 8-bit adder with an asynchronous reset and clock enable. The port definition for this component is shown in the table below.
To integrate external or third-party IP into LabVIEW FPGA you can use Component-Level IP (CLIP) or the IP Integration Node (IPIN). While both allow the integration of code external to LabVIEW, these options have different use cases and limitations. NI recommends that you refer to the LabVIEW Help for the different design requirements before integrating any external IP.
One difference that is relevant to this tutorial is that the top-level synthesis file for CLIP must be a VHDL file while IPIN can use netlists as the top-level synthesis file. This means the generating a VHDL wrapper is required for CLIP but optional for IPIN. However, IPIN might require a VHDL wrapper in specific scenarios. For example, when a top-level port type of the Verilog module is not supported in LabVIEW.
To prepare a Verilog module for integration into LabVIEW FPGA, you must first create a project and configure it properly in the Xilinx Vivado Design Suite.
Note: The LabVIEW FPGA Module Xilinx Compilation Tool for Vivado installs the Vivado Design Suite, which uses the same compiler version and configuration as the LabVIEW FPGA Module. NI recommends that you use this version of Vivado Design Suite for preparing any third-party or external IP for integration into LabVIEW FPGA when using Vivado FPGA targets.
Configure the Project Name page as shown below.
Select the part that matches the FPGA device you will be using in your LabVIEW FPGA project. You can find the details for each target in the General section of the FPGA Target Properties window in LabVIEW. In this tutorial we will be preparing IP for use on a PXIe-7975R (FlexRIO).
Once the project is configured and all source files have been added, the Verilog module must be synthesized into a netlist following the Hierarchical Designflow. This means that the synthesis must be performed in out-of-context (OOC) mode to allow the Verilog module to be used from a VHDL context. This tutorial uses the .dcp netlist file format.
As a result of synthesis, a .dcp netlist will have been created. The netlist is synthesized code which defines the component to be wrapped. In the working directory for the Xilinx Vivado Design Suite project, the .dcp file should be located at the following location. Make note of this file location.
Note: .dcp files are not forward version compatible. NI recommends that you generate these files using the installation of the Vivado Design Suite provided for the version of LabVIEW you are working in.
To integrate a .dcp netlist into LabVIEW FPGA, you must create a VHDL wrapper file that instantiates the component. Creating this file is generally not difficult, but may require some knowledge of the VHDL language.
In the Add Sources window, select Add or create design sources and then click Next.
Once you have synthesized the Verilog module into a netlist and created a VHDL wrapper, the standard IP integration procedure for either CLIP or IP Integration Node applies.
While the above tutorial walks through the process many users may find most intuitive, it may be quicker to generate the necessary files using the Tcl Console from within the Vivado Design Suite. The Tcl Console allows you to run many of the underlying commands used by the Vivado GUI directly and exposes other advanced options. In some situations, using these commands may be more straightforward or quicker than using the GUI. For the purpose of this tutorial, the focus will be on implementing the same options as above using the console. For more information on the functions used below, refer to the official Xilinx documentation.
Note: The exact behavior and format of these commands may differ between versions of the Xilinx Vivado Design Suite. NI recommends that you read the Xilinx documentation for these commands before proceeding.
To perform synthesis and generation of the netlist, first create a Vivado project and add the Adder.v Verilog Module to the project. Once the module is addded to the project, take note of the name of the entity in the Sources view. In the example case of the Adder.v Verilog module, the name of the entity within the project is Adder. To run the synthesis process, you can use the the synth_design command from the Tcl Console. For the Adder module used in this tutorial, the command might look like this:
synth_design -top Adder -part xc7k410tffg900-2 -mode out_of_context
Once synthesis is complete, generate the netlist file using the write_checkpoint command.
write_checkpoint -force -noxdef "C:/Vivado Verilog Tutorial/Adder.dcp"
This command generates the .dcp netlist file at the location specified. Alternatively, you can use the write_edif command to generate an EDIF netlist. Refer to the official Xilinx documentation for information on using the write_edif command in the Tcl Console.
To write a VHDL Wrapper, the same process detailed in the Creating a VHDL Wrapper section of this document can be used. Alternatively, you can use the write_vhdl command to generate a stub VHDL file which you can use to integrate the Verilog module. This would be equivalent to steps 1 through 7 in the Creating a VHDL Wrapper section above and you would still need to go through the remaining steps. Additionally, you must add the new .vhd file to the project or edit it manually in another editor. To generate such a stub file, execute the following command.
write_vhdl -mode port "C:/Vivado Verilog Tutorial/AdderWrapper.vhd"
Note: This step is required only if you plan to simulate Component-Level IP in a third-party simulator such as Xilinx ISIM. In the case of the IP Integration Node, the simulation behavior can be set to a Post-synthesis model for simulation purposes within the LabVIEW environment. As Component-Level IP cannot be directly simulated within LabVIEW FPGA, excluding the netlist from the simulation model will allow full functionality for most use cases. For more information on debugging LabVIEW FPGA code through simulation, see Testing and Debugging LabVIEW FPGA Code .
If you want to simulate your module within LabVIEW FPGA, NI recommends that you generate a VHDL simulation model for the netlist using the write_vhdl command with different flags than used previously. You can then use the simulation model as the user-defined simulation behavior in LabVIEW FPGA. To generate a functional simulation model for the Adder module, execute the following command.
write_vhdl -mode funcsim "C:/Vivado Verilog Tutorial/Adder_funcsim.vhd"
Collaborate with other users in our discussion forums
A valid service agreement may be required, and support options vary by country.