Skip to content

Full system RISC-V emulator (runs full Debian), in Rust, runs on cli and brower

License

Notifications You must be signed in to change notification settings

tommythorn/simmerv

 
 

Repository files navigation

Simmerv

Simmerv is a RISC-V SoC emulator written in Rust and compilable to WebAssembly. It started as a fork of Takahiro's riscv-rust emulator, but by now 98% of the code has been rewritten, making it far more complete and faster. Ultimately, we expect it to become substantially faster, but this work is delayed until we are able to run standard benchmarks and off-the-shelf Linux distributions.

Online Demo

You can run Linux on the emulator in your browser: online demo is here

Screenshots

animation debugger

Features

  • Emulates RISC-V RV64GC_Zba_Zicond processor and peripheral devices (PLIC, CLINT, virtio block device and a UART)
  • Targets native and WASM

Instructions/Features support status

  • RV64IMAC
  • RV64FD (PARTIALLY flags/rounding modes very lacking)
  • RV64Zifencei
  • RV64Zicsr
  • Svnapot
  • Zba (part of "B", RVA22)
  • Zbb (part of "B", RVA22)
  • Zbs (part of "B", RVA22)
  • Zicond
  • CSR (nearly complete)
  • Sv39, Sv48, Sv57
  • Privileged instructions
  • [-] PMP (this is intensionally not implemented as it will negatively affect performance)

The emulator supports all instructions listed above but some (like many FP instructions) are not 100% to the spec.

  • Boots Buildroot and Debian Trixie
  • Linux OpenSBI and legacy BBL boot support

Current Issues Being Worked

  • Newer Linux kernel have issues (which is a problem for newer binaries)
  • U-boot loads but hangs before hand-off; might be an issue with ELF loading

High Priority Work Post Issues

  • Amortized decoding and instruction fusion via a instruction translation cache <<

  • Snapshot and resume

  • Disk support without an in-memory copy (can WASM support this?)

  • Improve the disassembler to recognize pseudo ops like li, mv, ret, etc. (This requires a structural change).

How to run Linux

$ cargo b -r --all
$ target/release/simmerv_cli linux/fw_payload.elf -f linux/rootfs.img

How to run riscv-tests

$ ./run-riscv-tests.sh

How to import and use WebAssembly RISC-V emulator in a web browser

See wasm/web

How to install and use WebAssembly RISC-V emulator npm package

See wasm/npm

Links

Linux RISC-V port

Running 64-bit RISC-V Linux on QEMU

Specifications

About

Full system RISC-V emulator (runs full Debian), in Rust, runs on cli and brower

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • Rust 94.6%
  • JavaScript 2.7%
  • Python 1.6%
  • HTML 0.6%
  • CSS 0.4%
  • Shell 0.1%