RV64emu is a riscv64 emulator written in rust,It can run CoreMark
,RT-thread
and Linux
now. And it is easy to add new devices and support new instructions. The rv64emu is now as a crate, you can use it in your project. Due to RUST's cross-platform feature, it can run on Linux, Windows and MacOS.Even on the embedded device, such as ESP32
and STM32
which support Embeded RUST
.
ISA Specification: - [x] RV64I - [x] RV64M - [x] RV64A - [x] RV64C - [ ] RV64F - [ ] RV64D - [x] MachineMode - [x] SupervisorMode - [x] UserMode - [x] Sv39 - [x] Sv48 - [x] Sv57 - [ ] PMP
Caches: - [x] InstCache - [x] DecodeCache - [x] DataCache (no performance optimization) - [x] Tlb
Devices - [x] SifiveUart (full support, including interrupt) - [x] 16550AUart (basic support, no interrupt) - [x] SifiveClint - [x] SifivePlic
The simplest example of using rv64emu as a crate.You can find it in examples
directory.
features
|Name|Function|Comment| |----|--------|-------| |devicesdl2|support sdl2 device,|such vga and keyboard| |supportam|support AM environment, use ebread to terminate emulation|AM github AM pdf| |caches|support caches,including instcache and decodecache|| |rvdebugtrace|support debug trace,including itrace and ftrace|the log file is in /tmp|
Run abstract machine applications
The following command will run hello.bin
,which is a simple application in ready_to_run
directory. And for details of ysyx_am_system
example, please refer to examples/ysyx_am_system.rs
.
bash
cargo run --release --example=ysyx_am_system --features="std device_sdl2" -- --img ready_to_run/hello.bin
Apart from hello.bin
, there are other applications in ready_to_run
directory:
- hello.bin
- coremark-riscv64-nemu.bin
- nanos-lite-riscv64-nemu.bin
- rtthread.bin
These applications above were build for AM
environment.
Run linux
bash
cargo run --release --example=linux_system -- --img ready_to_run/linux.elf
Please refer to rv64emu-sdk for details.
test with riscv-tests
bash
cargo riscv-tests
test with riscof
todo!
What a magic feature of rust! You can run rv64emu
on the embedded device, such as ESP32 and STM32 which support embeded rust.
But before build your embeded project, you need to disable some features, such as device_sdl2
,rv_debug_trace
.
+ device_sdl2: because the embedded device does not support sdl2,and some devices, such as vga and keyboard are based on sdl2.
rvdebugtrace: because it used crossbeam-channel
crate,which is not support no_std
. More over, the embedded device does not support file system,and the log file is too large to store.
caches: because the embedded device does not have enough memory