Skip to content

Repository files navigation

rv64-vm

NOTE: As for now, JIT is being actively reworked, and so it slow af. Consider compiling with USE_JIT=0

A software emulator for the RISC-V instruction set architecture (ISA) written in C++. This project aims to provide a functional emulator, capable of running XV6, OpenSBI, U-Boot, and so on. The emulator supports RV64GC ISA, privileged ISA and peripheral devices. See the "Features List" section section for the details of features.

Running

Available arguments are:

  --bios: File with Machine Level program (bootloader)
  --kernel: File with Supervisor Level program
  --image: File with Image file that will put on VirtIO-BLK
  --dtb: Use specified FDT instead of auto-generated
  --dumpdtb: Dumps auto-generated FDT to file
  --gdb: Starts GDB Stub on port 1512
  --append: Append command line arguments
  --harts (-S): Set custom harts count (Default is 1)
  --framebuffer (-fb): Enables framebuffer with defined size (F.e. 640x480)
  --memsize (-M): Set custom memory size (Default is 512 MB)

Features List

The emulator supports the following features:

  • RV64G ISA
    • RV64I
    • RV64M
    • RV64A (No atomicity for now)
    • RV64F
    • RV64D
    • Zifencei
    • Zicsr
  • RV64C
  • Bit manipulations
    • Zba
    • Zbb
    • Zbc
    • Zbs
    • Zbkb
  • Other instruction sets
    • Zicboz (for faster memory zeroing)
  • Privileged ISA
  • Control and status registers (CSRs)
    • Machine-level CSRs
    • Supervisor-level CSRs
    • User-level CSRs
  • Devices
    • UART: universal asynchronous receiver-transmitter
    • CLINT: core local interruptor
    • PLIC: platform level interrupt controller
    • Virtio-BLK: virtual I/O Block Device
    • Framebuffer: virtual simple screen
    • OpenCores I2C: Inter-Integrated Circuit
    • HID-over-I2C: Human Interface Device over Inter-Integrated Circuit
      • Boot keyboard: Basic usable keyboard(for now without Numpad support)
  • FDT

Build

git clone https://github.com/Spalishe/rv64-vm
cd rv64-vm
make

Output program will be located in corresponding target and architecture folder(f.e. build.linux.x86_64/)

Library

You can also compile emulator as lib:

git clone https://github.com/Spalishe/rv64-vm
cd rv64-vm
make lib

And static lib as well:

git clone https://github.com/Spalishe/rv64-vm
cd rv64-vm
make slib

See Getting Started with libraries and API Reference

Dependencies

You can install all required dependencies using:

Arch:

sudo pacman -S make gcc git

Ubuntu:

sudo apt install make gcc git

License

This project is licensed under the Apache 2.0 License – see the LICENSE

About

RISC-V Emulator, capable of running XV6, Linux

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages