Getting Started with Examples

The Vitis core development kit is provided with example designs. These examples can:

  • Be a useful learning tool for both the Vitis IDE and compilation flows such as makefile flows.
  • Help you quickly get started in creating a new application project.
  • Demonstrate useful coding styles.
  • Highlight important optimization techniques.

Every target platform provided within the Vitis IDE contains sample designs to get you started, and are accessible through the project creation flow as described in Create an Application Project.

A limited number of sample designs are available in the <vitis_root>/samples folder, and many examples are also available for download from the Xilinx GitHub repository. Each of these designs is provided with a Makefile, so you can build, emulate, and run the code entirely on the command line if preferred.

Installing Examples and Libraries

You can download and install sample applications from the Templates page when working through the New Application Project wizard, or from within an existing project by selecting Xilinx > Examples. This displays the Vitis IDE Examples dialog box as shown in the following figure.

Figure 1: Vitis IDE Examples


The left side of the dialog box shows Vitis IDE Examples, and has a download command for each category. The right side of the dialog box shows the directory to where the examples downloaded and the URL from where the examples are downloaded. Click Download next to Vitis IDE Examples to download the examples and populate the dialog box.

The command menu at the bottom left of the Vitis IDE Examples dialog box provides two commands to manage the repository of examples:

Refresh
Refreshes the list of downloaded examples to download any updates from the Vitis Examples GitHub repository.
Reset
Deletes the downloaded examples from the .Xilinx folder.
TIP: Corporate firewalls can restrict outbound connections. Specific proxy settings might be necessary.

You can also download Vitis Accelerated Libraries from the New Application Project wizard, or by selecting the Xilinx > Libraries menu command. For more information on the available libraries and their uses, refer to Vitis Libraries.

Figure 2: Vitis IDE Libraries


Using Local Copies

While you must download the examples to add templates when you create new projects, the Vitis IDE always downloads the examples into your local .Xilinx/vitis/<version> folder:

  • On Windows: C:\Users\<user_name>\.Xilinx\vitis\<version>
  • On Linux: ~/.Xilinx/vitis/<version>

The download directory cannot be changed from the Vitis IDE Examples dialog box. You might want to download the example files to a different location from the .Xilinx folder. To perform this, use the git command from a command shell to specify a new destination folder for the downloaded examples:

git clone https://github.com/Xilinx/Vitis_Examples 
<workspace>/examples

When you clone the examples using the git command as shown above, you can use the example files as a resource for application and kernel code to use in your own projects. However, many of the files use include statements to include other example files that are managed in the makefiles of the various examples. These include files are automatically populated into the src folder of a project when the template is added through the New Vitis Project wizard. To make the files local, locate the files and manually make them local to your project.

You can find the needed files by searching for the file from the location of the cloned repository. For example, you can run the following command from the examples folder to find the xcl2.hpp file needed for the vadd example.

find -name xcl2.hpp