What is QEMU

This page gives a bird eye view of what QEMU is, why should you use it and how it works at a high level.

This is an ideal starting point for new QEMU users. 



What is QEMU

QEMU (Quick EMUlator) is an open source, cross-platform, system emulator. It is an executable that runs on an x86 Linux operating system.

QEMU can emulate a full system (commonly referred to as the guest), such as a Xilinx ZCU102 or VCK190 board.

When this document uses examples that are ran on the guest, the example shell prompt will say something similar to xilinx-zcu102-2020_2:~# or xilinx-vck190-2020_2:~#.

The emulation includes the processors, peripherals, and other hardware on the development board; allowing you to launch an operating system or other applications on the virtualized hardware.

These applications can be developed using the exact same toolchains that would be used on physical hardware.

QEMU can also interact with the host machine through interfaces, such as CAN, Ethernet and USB; allowing real-world data from the host to be used in the guest machine in real time.

Why Use QEMU

Remote Development

Using QEMU allows developers to develop without the need for physical hardware, while still being able to use real-world data for testing.

Easier Debugging

QEMU contains a GDB server which the host can connect to and debug their applications through, as if they were running natively.
See Debugging Guest Applications with QEMU and GDB for more information on how to debug using QEMU.

QEMU also contains commands and tools, such as module debug printing, that developers can use to debug their programs.

Since QEMU emulates the entire guest platform, this allows debugging from the bootloader up to the user application.  This also means that emulation can be paused and resumed at any time, even in the middle of a data transfer.

Easier Testing

Since QEMU is entirely software, it integrates much easier with testing utilities (e.g. PyTest) than hardware does.

Developing and Running an OS

QEMU allows people to run systems that use Linux, FreeRTOS, a custom OS, or bare metal applications.
When doing system-level programming with QEMU, it is easy for developers to cross-compile their kernel and run it in QEMU for testing.

See What is QEMU for how to get started with QEMU.

Hardware Modeling and Verification

QEMU can be used to model and verify hardware, but it can also connect and drive mixed simulation environments, called co-simulation.
With co-simulation, Xilinx exposes a SystemC/TLM interface to connect the processing system (PS) of any Zynq-based and Versal products to a model of your own IP.

Safety and Security

With QEMU, you have access to non-intrusive fault injection, allowing you to validate the safety, security, reliability, and robustness of your system.

How it Works

QEMU works by using dynamic translation. Instructions are translated from the guest's instruction set to the equivalent host machine instructions.

The equivalent host instructions are then executed on the host, and the results of those instructions are then pushed back into the guest machine.
A diagram of this is shown below.

Since the emulation is working at an instruction level, your software is running exactly as it would run on the final target hardware platform; completely unchanged.

This is one of the key benefits of running your software on QEMU, you have complete instruction parity between the final target hardware platform and QEMU.

In order to take full advantage of the host execution throughput, instructions are executed as fast as the host will allow.  As such, QEMU is not a cycle accurate emulator.

In addition, due to some key innovations from Xilinx, QEMU can be connected and interoperate with clock cycle-accurate emulation environments to drive Verilog/SystemC based IP. See the Co-simulation page for more information.

In multi-architecture environments, such as Zynq UltraScale+ MPSoC/RFSoC and Versal Adaptive SoC, QEMU uses shared memory to communicate between the different architectures (i.e. ARM and MicroBlaze).

For example, a block diagram of a Zynq UltraScale+ MPSoC/RFSoC or Versal Adaptive SoC machine running on QEMU may look like this:

Note that if running a standalone (single-architecture environment) ARM or MicroBlaze machine on Zynq UltraScale+ MPSoC/RFSoC or Versal Adaptive SoC, the shared memory is not necessary, as only one QEMU guest is running.
This is also true if running any other standalone ARM or MicroBlaze platform, such as Zynq-7000 or MicroBlaze.

QEMU and Xilinx

Xilinx provides a QEMU emulation platform to support the software developers targeting MicroBlaze, Zynq-7000, Zynq UltraScale+ MPSoC/RFSoC, and Versal Adaptive SoC development platforms.

Xilinx QEMU is distributed as part of the PetaLinux and Yocto toolchains and is already integrated in Vitis.

QEMU can emulate Xilinx development boards, such as VCU118, AC701, ZCU102, VCK190, etc. See QEMU Supported Platforms for a full list of what Xilinx supports on QEMU.

Next Steps

See Chapter 2 on how to Build and Run QEMU.



© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy