Simulators

Develop and test CHERI software and systems without physical hardware.

Overview

Simulation is often the easiest way to get started with CHERI. It lets you develop, port and test software before you have access to CHERI hardware.

Different simulators serve different purposes. Some run complete operating systems and applications relatively quickly, while others provide detailed models of the CHERI architecture or a particular processor implementation.

Which simulator do I need?

For most software developers, QEMU is a good place to start. It can run complete CHERI software environments and is well suited to application development, porting and automated testing.

For architecture and hardware developers, more detailed models are available:

The right choice depends on what you want to learn.

QEMU for software development

CHERI-enabled QEMU provides a convenient way to run complete CHERI software environments without physical hardware. cheribuild can build QEMU together with matching development tools, operating systems and disk images.

Use QEMU to:

QEMU models architectural behaviour rather than a particular processor's physical implementation. It should therefore not be used to predict processor performance or hardware characteristics such as detailed cache, speculation or timing behaviour.

Sail for architecture development

Sail is a formal model that provides executable descriptions of instruction-set behaviour and is used in CHERI architecture development, reference simulation, test generation and formal reasoning.

It is particularly useful when the question is "What should this CHERI instruction do?" rather than "How quickly will this software run?"

Sail models can also provide an independent reference against which processor implementations can be compared.

When using an executable architecture model, make sure its CHERI instruction-set architecture (ISA) version matches the system or implementation you are testing.

CHERIoT simulation

The CHERIoT development environment provides simulation routes for both architecture and processor-implementation models.

This allows developers to run compartmentalised firmware in simulation before moving to an FPGA or production hardware, and to test software at different levels of abstraction during development.

RTL simulation for hardware development

Register-transfer-level (RTL) simulation runs the processor's actual hardware description and is primarily useful to processor and hardware developers.

It can help investigate:

RTL simulation provides much more implementation detail than QEMU, but is significantly slower. It is therefore generally better suited to focused hardware tests and smaller software workloads than running complete applications and operating systems.

Compiled implementation models, using tools such as Verilator, can provide another route for running some hardware designs more quickly while retaining implementation-specific behaviour.

Choosing the right simulator

Start with the question you are trying to answer:

Whichever route you choose, check that the simulator, CHERI ISA version, compiler and software environment are compatible.

Moving to hardware

Simulation lets you start developing with CHERI without waiting for physical hardware.

Use Run CHERI in Simulation for a first practical setup, and move to FPGA Platforms when the question depends on hardware implementation.

Image preview