Vivado and HLS functional testing in Linux environment

1. Introduction

For the completed installation and operation of Vivado under Linux , this article mainly introduces the operation process of Vivado and HLS under the Linux operating system through a case where the LED light flickers, and conducts a simple test of the installed software functions.
HLS synthesizes the compilation of C code into Verilog or VHDL code. This article briefly analyzes the code generated by HLS, and also solves the error "Failed to generate IP" that may occur during the compilation process.

2. Vivado_HLS generates IP core

  1. Run Vivado_HLS:
    The running process of Vivado_HLS has been introduced in the installation and operation of Vivado under Linux . Run the following command shell script to open HLS:
	source /opt/Xilinx/Vivado/2017.4/settings64.sh  ##Vivado在Linux下的安装路径
	vivado_hls

Please add a picture description

Open the interface as shown in the figure below:

Please add a picture description

  1. Create a new project Create New Project, and create the project in the workplace folder under Documents for easy search:

Please add a picture description

  1. The top-level module is named Top Function:

Please add a picture description

  1. Select the FPGA model Part Selection and keep consistent with the selected model:

Please add a picture description

  1. Create a new .cpp file, the code content is very simple, that is, the LED light flashes once every 50M clock cycles, and the IP core is compiled and generated:

Please add a picture description

The IP core is shown in the figure:

insert image description here

3. Vivado project calls IP core

  1. Run Vivado:
    The running process of Vivado has been introduced in the installation and operation of Vivado under Linux . Run the following command shell script to open Vivado:
	source /opt/Xilinx/Vivado/2017.4/settings64.sh  ##Vivado在Linux下的安装路径
	vivado
  1. After creating a new project, add the path where the HLS project is located in the IP Catalog, and you can see that the IP core generated by HLS has been successfully imported:

Please add a picture description

  1. Create a new bd (Block Design) project, import the IP core, ap_rst is always low, and the ap_clk and led_V interfaces are externally connected:

Please add a picture description

  1. ap_clk and led_V are bound to the crystal oscillator clock output and LED interface respectively:

Please add a picture description

  1. After the synthesis is successful, a bit stream file is generated:

Please add a picture description

  1. Since the clock is 50MHz, you can see that the LED flashes once per second after program device:

insert image description here

Please add a picture description

Four. HLS generates Verilog code analysis

Open the IP core generated by HLS and you can see the compiled Verilog code as shown below:

Please add a picture description
The naming is complicated and confusing, but based on the working principle of LED lights, it can be simply analyzed from the input and output interfaces:

The counter i_reg_39 is basically equivalent to i_1_fu_56_p2, assigning values ​​to each other to complete the counter function that depends on the input clock, and completing the flipping of the led_V output interface by comparing with 25M, and realizing the function of blinking every 50M clock cycles;

5. Problems and solutions during HLS operation

problem appear:

During the process of compiling the comprehensive project and generating the IP core in HLS, a "Failed to generate IP" error may appear, as shown in the following figure:

insert image description here

Solution:

This problem is usually caused by an earlier HLS version. For example, this project uses the 2017.4 version of HLS, so the system time needs to be changed to before 2018 to successfully generate the IP core:

insert image description here

Guess you like

Origin blog.csdn.net/weixin_43361652/article/details/128169909