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_Install_Dir>/samples
provides a makefile so you can build, emulate, and run
the code working entirely on the command line if you prefer.
Many example designs and tutorials can be downloaded from the Xilinx GitHub repository. The example design repository contains the latest examples to get you started with application optimization targeting Xilinx PCIe® FPGA acceleration boards. All examples are ready to be compiled and executed on SDAccel™ supported boards and accelerated cloud service partners.
In addition, the tutorial repository provides step-by-step instructions on a range of topics including building an application, emulation, along with advanced topics such as mixing C++ and RTL kernels, and optimizing host code.
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 .
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. Customizing the location of the download directory is accomplished using the directions in the Using Local Copies section.
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.
- Refresh
- Refreshes the list of downloaded examples to download any updates from the GitHub repository.
- Reset
- Deletes the downloaded examples from the .Xilinx folder.
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