Getting Started with Examples

All Xilinx® SDx™ environments are provided with example designs. These examples can:

  • Be a useful learning tool for both the SDx 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 platform provided within the SDx environment contains sample designs to get you started, and are accessible through the project creation flow as described in Creating an Application Project. Furthermore, each of these designs, which are found in <sdx_root>/samples provides a makefile so you can build, emulate, and run the code working entirely on the command line if you prefer. In addition, many examples are available to be downloaded from the Xilinx GitHub repository, although a limited number are also included in the samples folder of the software installation.

Installing Examples

Select a template for new projects when working through the New SDx Project wizard. You can also load template projects from within an existing project, by selecting Xilinx > SDx Examples.

Figure: SDAccel Examples – Empty



The left side of the dialog box shows SDAccel™ 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 SDAccel Examples to download the examples and populate the dialog box. The examples are downloaded as shown in the following figure.

Figure: SDAccel Examples – Populated



The command menu at the bottom left of the SDx 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 GitHub repository.
Reset
Deletes the downloaded examples from the .Xilinx folder.
Note: Corporate firewalls can restrict outbound connections. Specific proxy settings might be necessary.

Using Local Copies

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

  • On Linux: ~/.Xilinx/SDx/<version>

The download directory cannot be changed from the SDx 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/SDAccel_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 SDx 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