Introduction to Vitis Part 1


This lab guides you through the steps involved in creating a Vitis project using Graphical User Interface (GUI). After creating the project, you will run software emulation to verify the functionality of the design.


For more details on the Vitis IDE see the Vitis documentation for Creating a Vitis IDE Project.

Description of example application

This lab uses an example application available in Vitis. It consists of a host application and kernel (written in C++/OpenCL). The kernel is a simple vector addition. The elements of 2 vectors (A & B) are added together, and the result returned in a third array (C). The host application initializes the two input arrays, send data to the kernel, and reads back the result.

You will compile and test a software only version of the application. The vector add kernel will then be implemented as a hardware kernel. You will first build and run a Software Emulation version of the design, followed by a Hardware Emulation version which will run a simulation of the hardware model of the kernel along with the host application. You will then test the design with the hardware kernel running in the FPGA in the next part of the lab.


After completing this lab (part 1 and part 2), you will learn how to:


Create a Vitis Project

  1. Launch Vitis GUI

    From a terminal, run the following commands to make sure Vitis and XRT environment has been setup:

    echo $XILINX_VITIS
    echo $XILINX_XRT

    If either of the variables above are empty, then execute the following two commands:

    source ~/aws-fpga/
    source ~/aws-fpga/
  2. Start the Vitis GUI by running:

    vitis &
  3. Set the Vitis workspace to a new empty folder, such as ~/workspace and click Launch

  4. The Vitis IDE Welcome page will be displayed

  5. Create a new application project

    Click Create Application Project from Welcome page, or File > New > Application Project to create a new application.

  6. Click Next > in the first window

    New Application Project Name

  7. Select xilinx_aws-vu9p-f1_shell-v04261818_201920_2 platform and click Next >

    If you do not see this platform, check you followed the lab set up instructions to set the PLATFORM_REPO_PATHS variable. You can select the platform by clickingthe + button and browsing to ~/aws-fpga/Vitis/aws_platform/ and selecting xilinx_aws-vu9p-f1_shell-v04261818_201920_2

    New Application Project Platform

  8. Name the project vadd and click Next >

    New Application Project Name

  9. Select Empty Application in the Templates window and click Finish

The project is generated.Observe the top-level folder is called vadd_system, under which three sub-folders (vadd_kernels, vadd_system_hw_link, vadd) are generated. The vadd_kernels folder will hold all the kernel related files, the vadd_system_hw_link will hold all linked kernel related files, and the vadd folder will hold all the host application related files.

Since the Empty project template was selected, the vadd and vadd_kernels will have empty src folders

  1. In the Explorer view, expand and right-click on vadd_system > vadd > src and select Import Sources…

  2. In the Import Sources window, click Browse and navigate to ~/xup_compute_acceleration/sources/vadd_lab/ and click Open.

  3. Select the vadd.cpp, xcl2.cpp, and xcl2.hpp files as they will be executed on the host and click Finish

    Expand the src folder in the Explorer view to verify that the three files were added.

  4. Similarly, import the hardware kernel code (krnl_vadd.cpp) under the vadd_system > vadd_kernels > src folder

  5. Double-click on the vadd_kernels.prj under the vadd_system > vadd_kernels folder in the Explorer view to open the corresponding Hardware Kernel Project Settings

  6. Click the Add Hardware function button () on the Hardware Functions panel’s ribbon

  7. Select krnl_vadd(int , int *, int *, unsigned int) - krnl_vadd.cpp** in the *Add Hardware Functions window and click **OK

  8. Verify that krnl_vadd is added as a Hardware Function

Build and Run Software Emulation

  1. Select the vadd_system tab in the project settings view

  2. Check the Active build configuration is set to Emulation-SW on the upper right corner of System Project Settings view

  3. Select vadd_system in the Explore view and build the design by clicking the hammer button () on top buttons bar, or right click vadd_system and select Build Project

    This step compiles each of the kernels, links them, and compiles the host application. Click Continue if you see an Unsupported Operating System warning

  4. Run Software Emulation

    To launch software emulation, select vadd_system either in the Assistant view or in the Explorer view and then click on the run button

  5. Select the Launch SW Emulator option and click OK

Observe the application has run and the output is displayed in the Console view

Found Platform
Platform Name: Xilinx
INFO: Reading /home/ec2-user/workspace/vadd_system/Emulation-SW/binary_container_1.xclbin
Loading: '/home/ec2-user/workspace/vadd_system/Emulation-SW/binary_container_1.xclbin'
Trying to program device[0]: xilinx_aws-vu9p-f1_shell-v04261818_201920_2
Device[0]: program successful!
Running Vector add with 32768 elements
Launching Hardware Kernel...
Getting Hardware Results...

You can leave the project open as you will continue from this step in the second part of this lab.


In this lab, you used Vitis to create a project using one of the application templates. You then ran the design using the software emulation flow.

Copyright© 2021 Xilinx