Xlera8

Creating an Acceleration Platform for Vitis Part Four: Testing a Custom Acceleration Platform in Vitis

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:

stephenm_0-1597253936161.png

Browse to your custom platform:

stephenm_1-1597254058759.png

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:

stephenm_2-1597254143183.png

The application settings should be auto-populated using the settings you entered when packaging your platform:

stephenm_3-1597254205338.png

Lets use the template here:

stephenm_4-1597254249343.png

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:

emu-sw.PNG

Then Build:

build.PNG

Then right click on the app, and select Run As and Launch on Emulator:

run_emu.PNG

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_passed.PNG

Test on Hardware:

I am planning to run this on my ZCU104 board, so I have changed the Active Build Config to Hardware:

stephenm_5-1597254374379.png

Then Build:

stephenm_6-1597254416898.png

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:

stephenm_0-1597657587452.png

Your SD Card should now look like the following example:

stephenm_1-1597657650688.png

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

stephenm_2-1597657898437.png

And that’s it. we have now successfully tested the application.

Source: https://forums.xilinx.com/t5/Design-and-Debug-Techniques-Blog/Creating-an-Acceleration-Platform-for-Vitis-Part-Four-Testing-a/ba-p/1138865

Chat with us

Hi there! How can I help you?