Software Emulation - 2021.2 English

Vitis Unified Software Platform Documentation: Application Acceleration Development (UG1393)

Document ID
UG1393
ft:locale
English (United States)
Release Date
2021-12-15
Version
2021.2 English

The main goal of software emulation (sw_emu) is to ensure functional correctness of the host program and kernels. Software emulation provides a purely functional execution, without any modeling of timing delays, or latency; it does not give any indication of the accelerator performance.

The kernel code is always compiled and running natively. The application code is either:

  • Compiled and running natively on an x86 processor (Data Center platforms)
  • Cross-compiler to the Arm® processor and running in an emulator (Embedded platforms)

Thus, software emulation is typically used for algorithm refinement, debugging functional issues, and letting developers iterate quickly through the code to make improvements. The software programming model of fast compilation and run iterations is preserved.

The v++ compiler does the minimum transformation of the kernel code to create the FPGA binary to run the host program and kernel code together. Software emulation takes the C-based kernel code and compiles it with GCC. It runs each kernel as a separate C-thread. If there are multiple compute units of a single kernel, each CU is run as a separate thread. Therefore, it mimics the parallel execution model of the hardware. However, within each kernel the execution is modeled sequentially although there might be parallelism within a kernel when running on hardware. The software emulation driver implements the XRT API and acts as a bridge between the user application running XRT and the device process modeling the hardware components.

Tip: For RTL kernels, software emulation can be supported if a C model is associated with the kernel. The RTL Kernel Development Flow provides an option to associate C model files with the RTL kernel for support of software emulation flows.

The following describes the software emulation limitations:

As discussed in Vitis Compiler Command, the software emulation target is specified in the v++ command with the -t option:
v++ -t sw_emu ...

You can use the GDB debugger for both the host application and the kernel code, set breakpoints or use printf() to print information and checkpoints. For details on how to debug the host application or the kernel during software emulation, refer to Debugging in Software Emulation.