Skip to content

hidetatz/rv

Repository files navigation

rv

rv is a 64-bit RISC-V emulator written in Go.

Limitation

  • 32-bit, 128-bit aren't supported.
    • Only RV39 is supported as memory translation.
  • Multi-core emulation isn't supported.
  • release/acquire bits are not handled in AMO instructions.
    • rv currently emulates only one hart, so this is not really a problem.
  • fence instructions do nothing.
    • rv currently does not apply any optimizations and no out-of-order execution occurs, so it should be fine.

Installation

go install github.com/hidetatz/rv@latest

Usage

Pass an ELF program to run to rv.

rv -p ./hello

Debug log will be enabled if -d option is passed (note that this dumps all the executed instructions and some other information).

Test

rv uses riscv-tests as its E2E test. You can run that by following command:

go test -v ./...

Supported instructions

  • RV64G ISA
    • RV64I
    • RV64M
    • RV64A
    • RV64F
    • RV64D
    • Zifencei
    • Zicsr
  • RV64C ISA
  • Privileged ISA

For the full list of the implemented instructions, see instruction.go.

LICENSE

MIT