Skip to content
archlab-sciencetokyoPublic

About

Dual-width RV32/RV64 RISC-V system simulator for functional and cycle-accurate modeling, full-system Linux, and runtime CFU/MMIO plugins.

Topics

Resources

Contributing

Security policy

Stars

5 stars

Watchers

1 watching

Forks

Latest commit

 

History

1,048 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimRV: Dual-Width Explainable RISC-V System Simulator

An explainable, dual-width (RV32 / RV64) RISC-V simulator with an interactive terminal workbench (TUI), cycle-accurate microarchitectural modeling, hardware RTL parity verification, runtime plugin APIs, and full-system SMP Linux emulation.

Build and Test Docs CI Documentation Latest SimRV release License C++23 Profile RVA23 Target SMP

SimRV is an explainable, dual-width (RV32 / RV64) RISC-V research and education simulator featuring an interactive terminal workbench (TUI), cycle-accurate in-order pipeline modeling, cache hierarchy inspection, and full-system Linux OS emulation. It provides functional and cycle-accurate modes targeting the RVA23 profile (rva23s64 default), with RV32 and narrower compatibility presets available for workloads and verification. The distributed RV64-capable binary also runs RV32 guests; the native RV32 target remains a strict-width verification build.

SimRV is not RISC-V certified. RVA23 is an implementation and verification target, not a formal certification claim; see the compliance scope for verified coverage, ACT testing, and known gaps.


Documentation

Browse the SimRV stable documentation (or the development docs for unreleased changes).

Installation, CLI flags, interactive TUI workbench, bare-metal, Linux SMP, and classroom missions.

Core execution units, 2/3/5/6-stage pipelines, TileLink-C cache coherence, and ISA compliance scope.

Bare-metal firmware, memory maps, MMIO peripherals (16550A UART, CLINT/ACLINT, PLIC/AIA, VirtIO), and SMP Linux.

Custom Function Unit (CFU) plugins, MMIO device plugins, CPU/SoC presets, RTL parity, and C++ SDK.


Installation

Pre-built Linux release packages (x86_64 RPM, DEB, and portable x86_64/aarch64 musl archives) are published on GitHub Releases. Follow the installation guide for package installation, upgrades, and source builds.

Supported Host Platforms

  • Linux (x86_64 and aarch64): Full support including portable static musl archives, RPM/DEB packages, VirtIO-FS, and libslirp user-mode networking.
  • macOS (arm64 and x86_64): Source builds supported (with libslirp networking; VirtIO-FS is Linux-only).
  • Windows: Supported via WSL2 (native Windows is not supported due to POSIX terminal and process APIs).

Building from Source

Requires Clang 22+ or GCC 16+ (C++23), CMake 3.31+, and Ninja:

cmake --preset rv64-release
cmake --build --preset rv64-release

The rv64-release build runs both RV64 and RV32 guest workloads. A strict-width rv32-release preset is also available for native 32-bit verification.


Quick Start

Launch simrv normally (or pass --tui) to explore an image with the interactive TUI, or pass --cli for scripted and headless runs:

# Check host environment and qualified ISA summary
simrv --doctor
simrv --isa-info

# Interactive TUI workbench (default)
simrv -b -m hello.elf

# Headless execution with an instruction limit
simrv --cli -b -m hello.elf --steps 200000

# Cycle-accurate pipeline execution (2stage, 3stage, 5stage, 6stage-issue, 6stage-fetch, 6stage-mem)
simrv --cli -b -m hello.elf --mode cycle-accurate --pipeline 5stage
simrv --cli -b -m hello.elf --mode cycle-accurate --pipeline 3stage

# Boot a full-system Linux image with disk and device tree
simrv --os --cli -m opensbi-linux-payload.elf -D rootfs.img -f devicetree.dtb

# Override ISA preset and Vector register length (VLEN)
simrv -m vector.elf --isa rv64gcv_zba_zbb_zbc_zbs --vlen 512

Extensions, Plugins & SDK

SimRV can be extended at runtime without modifying or recompiling the simulator:

Extension Mechanism Interface Use Case
CFU Plugins (--cfu-plugin) SimRvCfuPlugin C ABI (simrv_cfu_init) Tightly-coupled custom-0 accelerators with cycle-accurate latency
Device Plugins (--plugin) SimRvExternalDevice C ABI (simrv_device_plugin_init) Loosely-coupled MMIO peripherals on the TileLink interconnect
CPU & SoC Models (--config) INI model & platform files Custom pipeline widths, cache hierarchies, branch predictors, and memory maps
C++ Runtime SDK (SimRV::runtime) Installed CMake package + headers Embedding SimRV in external C++ harnesses and co-simulation tools

Scaffold starter projects directly from the CLI:

# Starter CPU model configuration
simrv-tools scaffold cpu balanced my_core.cfg

# Starter Custom Function Unit (CFU) plugin C project
simrv-tools scaffold cfu my_cfu ./my_cfu_plugin/

# Starter external MMIO device plugin C project
simrv-tools scaffold device my_device ./my_device_plugin/

To seed a device plugin from an MMIO node in a board DTB, run simrv-tools scaffold device --from-dtb board.dtb [output-directory] and select a node.

See Custom Extensions & CFU Plugins and Extending CPU Presets & MMIO Platforms for the full C ABI and configuration reference.


Interactive TUI & Classroom Mode

The TUI supports interactive stepping, breakpoints, live register/pipeline/cache/TLB inspection, instruction explanations (e), and an integrated guest terminal. Instructors can attach optional .mission files (simrv mission <path.mission>) for guided labs with named checkpoints and schema-versioned inspection exports (x).

Hotkey Action
[F6] / [s] / [Space] Single instruction step
[F5] / [c] / [Ctrl-P] Run / Pause simulation loop
[o] / [Alt-O] Open Binary / Disk image loader modal
[F2] / [,] / [Alt-S] Simulator Settings modal (General, MISA, uArch)
[v] Toggle Precision (IA / CA)
[i] / [w] Inspect memory address / set watchpoint
[m] / [F8] Manage breakpoints & watchpoints / toggle PC breakpoint
[F3] / [F11] Cycle Register Pages / Cycle Tool Tabs
[e] / [?] / [F9] Instruction Explainer / open Glossary
[x] / [t] Export inspection report while paused / cycle Theme
[Tab] / [Ctrl-W] Change column focus / open Column Tool Picker
[F1] / [h] / [Esc] Help shortcuts / close active modal

Supported RISC-V Extensions

rva23s64 is the primary architectural target; RV32 and narrower ISA presets are available for compatibility and verification workloads.

Extension Status Description & Features
I ✅ Supported Base integer instruction set (RV32I / RV64I)
M ✅ Supported Integer multiplication, division, and remainder
A ✅ Supported Atomic memory operations (LR/SC, AMO word/doubleword)
C ✅ Supported Compressed 16-bit instruction decode and execution
F / D ✅ Supported Single/double precision, FP CSRs, and RNE/RTZ/RDN/RUP/RMM rounding modes
V ✅ Supported RISC-V Vector 1.0 (V) with configurable VLEN (32–1024 bits), Zvfhmin, Zvbb, Zvkt
B ✅ Supported Bit manipulation (Zba, Zbb, Zbc, Zbs)
RVA23 ISA ✅ Supported Zicond, Zcb, Zfa, Zfhmin, Zic64b, CMO, Zawrs, Zkt, Zimop/Zcmop, Supm
Privileged ✅ Supported M/S/U/H modes, Sstc, Sscofpmf, Ssnpm, Sha hypervisor, CSRs, traps, PMP
MMU (Sv32–Sv57) ✅ Supported Hardware page-table walker & TLB (Sv32, Sv39, Sv48, Sv57, Bare) with Svnapot, Svpbmt, Svade, Svinval, two-stage H

Debugging & Co-Simulation

GDB Remote Debugging

# Start SimRV with GDB RSP server on port 1234 (or --gdb-port <PORT>)
simrv -m hello.elf --gdb

# Connect from GDB
riscv64-unknown-elf-gdb hello.elf -ex "target remote :1234"

Spike Lockstep Co-Simulation

Verify execution against Spike instruction-by-instruction:

simrv -m hello.elf --lockstep

Use --spike-bin and --spike-elf to override the Spike binary or comparison ELF. Lockstep and GDB are mutually exclusive.


3.x Roadmap

Following the 3.0.0 GA release, the 3.x series focuses on companion tooling, broader host coverage, cycle-accurate ISA qualification, and reproducible performance:

  • 3.1 Beta & Companion Binaries: Dedicated polish for companion tools (simrv-benchmark, simrv-tools, simrv-act, simrv-vector, simrv-parity, simrv-config-wizard), including aligned setup vs. runtime benchmark timing, UTC timestamps + version metadata in JSON reports, Raspberry Pi 5 / ARM64 presets, and CI cycle-accurate smoke coverage (3stage/5stage).
  • Full Cycle-Accurate RVA23 Qualification: Closing remaining cycle-mode ACT4 edge cases (Ssnpm pointer masking, two-stage translation, S_Zicntr) and qualifying multi-hart atomicity and wide-access fault precision for Zacas and Zabha.
  • Optional RVA23 Extensions: Expanding cycle-accurate and functional verification for optional U64/S64 expansions (Svadu, Zfh/Zvfh, vector cryptography) beyond the mandatory RVA23 baseline.
  • Native Performance & RTL Parity: Evaluating PGO/ThinLTO and host-tuned AArch64/x86_64 execution against Spike alongside expanded RTL parity and microarchitectural model presets.

See TODO.md and the compliance scope for active milestones and detailed verification boundaries.


License

SimRV is licensed under the MIT License.

Citation

If you use SimRV in academic work, please cite the metadata in CITATION.cff.

About

Dual-width RV32/RV64 RISC-V system simulator for functional and cycle-accurate modeling, full-system Linux, and runtime CFU/MMIO plugins.

Topics

Resources

Contributing

Security policy

Stars

5 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages