How to Debug Kelvin ISS

This doc explains how to run kelvin SW in its Instruction Set Simulator (ISS).

Running Kelvin ISS with Kelvin Sim

Kelvin Sim is the ISS simulator that's built based on MPACT_Sim and supports all the kelvin instructions. It is used for single-core testing and debugging.

Running the Kelvin SW binary (ELF or the rendered .bin file) can be done with the following CLIs

source build/setup.sh
m kelvin_sim
sim_kelvin <elf/bin file path>

The bash function detects the file type by ELF's magic_bytes and launches the kelvin_sim. kelvin_sim runs the executable, and depends on the terminator ops mpause or ebreak, it prints out different messages before exit the simulator.

Illegal instruction also terminates the simulation, with the fault PC printed out.

Debug Kelvin SW via Kelvin Sim

sim_kelvin <elf file path> debug

It launches kelvin_sim in the interactive mode. It acts as a debugger, with break, run, and step available for instructions. Use help to see the supported debug functions.

Running Kelvin ISS with Renode

Kelvin simulator can connect to renode and then be integrated with the full nexus behavioral simulation framework. It uses kelvin_sim as a library and a KelvinCPU wrapper to connect to the nexus framework.

Running the Kelvin SW binary in a single core setup can be done with the following CLIs

source build/setup.sh
m renode
sim_kelvin_renode <location of the kelvin SW .bin file>

The .bin file is the binary blob of the loadable segment parsed by cache/toolchain_kelvin/bin/riscv32-unknown-elf-objcopy. It is the additional output from the Kelvin build rules from either the Bazel build or CMake build after the .elf executables are built.

NOTE: Renode + kelvin does not support debugger. To debug a Kelvin SW program, please refer to the previous section.

For e2e simulation, loading and running the Kelvin SW program is done via CantripOS MlCoordinator. See Launch ML Job on the ML Core for more information.