In the previous blog entries in this series we discussed how to create the hardware and software project. We then discussed how to package this project in Vitis™.
Next, we will be testing it in Vitis, by created a simple application that will be accelerated.
This is part four of the guide. You can find the other parts at the links below:
Part One: Creating the hardware project for the Acceleration Platform in Vivado
Part Two: Creating the software project for the Acceleration Platform in PetaLinux
Part Three: Packaging the Accelerated Platform in Vitis
Creating the Application:
Launch Vitis, and Create the Application Project.
Select a platform from the repository, and click the + icon:
Browse to your custom platform:
Note: Make sure that the flow is set to Embedded Accel.
We can also see some resources. These are the clocks that we enabled.
Give you project a name:
The application settings should be auto-populated using the settings you entered when packaging your platform:
Lets use the template here:
Emulation:
If users do not have access to Hardware, then they can use emulation to test. We can use the Quick Emulation (QEMU) tool to emulate the system using pre-built DTB files (not to be confused with the dtb used for in the Linux image from PetaLinux).
There are two emulation build types; Emulation-SW, and Emulation-HW.
Emulation-SW will emulate the whole system. However, to fully evaluate the RTL logic generated by the tool, Emulation-HW should be used. This uses a co-simulation between the QEMU and the XSIM. Note: QEMU is not cyclic accurate. Therefore, the memory model will not be cyclic accurate. As a result, performance numbers given by the Emulator should be used only as guidance.
For example, to use the Emulation-SW:
Then Build:
Then right click on the app, and select Run As and Launch on Emulator:
You will see the Linux boot in QEMU in the Emulation console, and then hopefully you will see the test pass in the console window:
Test on Hardware:
I am planning to run this on my ZCU104 board, so I have changed the Active Build Config to Hardware:
Then Build:
So, what just happened here? Well, a lot actually:
- Vitis used HLS to convert the C code to RTL, and packaged this with an AXI interface
- Vitis then called Vivado and re-opened your XSA file, then added this new IP core
- Vitis then used the metadata in your PFM to connect this IP core to the CPU
- Vivado then re-implemented to create an updated bitstream
- Vitis then re-packaged this bitstream in the boot image
- The Vitis linker created the container file XCLBIN. The XRT parses this file to get the hardware and platform data needed for the kernels
- The Vitis compiler generated the application file that will execute the kernels
- Finally Vitis created an SD card IMG
Now format the SD card with the sd_card.img. file.
I used win32 disc imager:
Your SD Card should now look like the following example:
If you do not want to use the imager, then copying manually will suffice.
Running the Application:
Boot the Linux image, and use the commands below:
cd /mnt/mmcblkp0 source ./init.sh ./my_first_accel binary_container_1.xclbin
And that’s it. we have now successfully tested the application.