1. Connecting to AWS | 2. Makefile Flow | 3. GUI Flow | 4. Optimization Lab | 5. Using the RTL Kernel Wizard | 6. Hardware/ Software Debugging |
This lab guides you through the steps involved in using a Makefile flow to build and perform software and hardware emulations to verify the functionality. You will then use an AWS F1 instance to validate the design.
After completing this lab, you will be able to:
- Run Software Emulation to verify the functionality of a design using a Makefile flow
- Run Hardware Emulation to verify the functionality including kernel hardware using a Makefile flow
- Build the full system and verify functionality in hardware on an AWS F1 instance
The AWS shell file have already been clone from https://github.com/aws/aws-fpga and are available in ~/aws_fpga. Before an AWS F1 design can be built in SDAccel, the shell and SDAccel tools need to be configured from a setup script. This only needs to be done once for each version of the AWS shell.
-
Right-click on the Centos desktop and select Open Terminal
-
Execute the following commands in the terminal to setup the AWS shell and SDAccel tools.
cd ~/aws-fpga source sdaccel_setup.sh
-
Source the Xilinx tools
source $XILINX_SDX/settings64.sh
-
Create a Makefile_flow directory and change the working directory into it using the following commands:
mkdir Makefile_flow cd Makefile_flow
-
Copy the provided helloworld_ocl project directory into the current working directory using the following command:
cp -r /home/centos/sources/helloworld_ocl/ .
The SDAccel emulation flows allow testing, profiling and debugging of the application before deploying on F1.
Software emulation allows functionality of the software application to be verified.
Hardware emulation allows verification of the functionality of the generated logic generated for the FPGA, and the software application, together.
- Execute the following commands in the terminal to build and run the Software Emulation flow for the SDAccel 'hello world' example:
The application will be compiled, the xclbin and the helloworld.exe files will be generated. The application will be executed on CPU in software emulation mode showing output like:
cd helloworld_ocl make clean make check TARGETS=sw_emu DEVICES=$AWS_PLATFORM all
Executing the application in software emulation mode
- Go to the /home/centos/aws-fpga/Makefile_flow/helloworld_ocl/src folder and open the host.cpp file to see its content. Observe that the DATA_SIZE is defined as 256 (line 34), one operand (source_a) is defined as constant 10 (line 46) and another operand (source_b) as constant 32 (line 47), providing a result of 42
Program snippet
- Change the DATA_SIZE to 64, source_a to 4, and source_b to 15; save the file and run the last two commands
Output after modifying the source file
- Execute the following commands to build and run the HW (hardware) emulation flow for the 'hello world' example:
The kernel called vector_add will be created by calling Vivado High-Level Synthesis (HLS) tool, which will try to pipeline the kernel and try to achieve initiation interval of 1. At the end of the HLS compilation an xo file is generated.
make clean make check TARGETS=hw_emu DEVICES=$AWS_PLATFORM all
HLS being used to compile the kernel
The host application will then be compiled, the xclbin and the helloworld.exe files will be generated. The application will be executed on the host CPU in the hardware emulation mode showing the output and transfer rate like:Execution output
- Change to the solution directory by executing the following command
cd /home/centos/sources/makefile_flow_solution
- Execute the following commands to load the AFI and execute the application to verify the functionality
sudo sh source /opt/xilinx/xrt/setup.sh ./helloworld xclbin/vector_addition.hw.xilinx_aws-vu9p-f1-04261818_dynamic_5_0.awsxclbin
- The FPGA bitstream will be downloaded and the host application will be executed showing output something like:
Execution output
- Enter exit in the terminal window to exit out of sudo shell
In this lab, you used a Makefile flow to perform SW and Hardware Emulations. You then ran the application on F1 and validated the functionality.
Start the next lab: 3. GUI Flow lab
Build the system hardware using the Makefile flow (Note that since the building of the project takes over two hours skip this step in the workshop environment)
- Execute the following commands to build the system hardware for the 'hello world' example:
make clean
make check TARGETS=hw DEVICES=$AWS_PLATFORM all
This will build the project under the helloworld_ocl directory. The built project will include executable helloworld file along with vector_addition.hw.xilinx_aws-vu9p-f1-04261818_dynamic_5_0.xclbin file under the sub-folder xclbin
This step takes about two hours.
Once the full system is built, you can create an AFI by following the steps listed here