riscv-rust

Build Status Crate npm version

riscv-rust is a RISC-V processor emulator project written in Rust.

Demo

You can run Linux or xv6 on the emulator in your browser. Online demo is here

Screenshots

animation

Documents

Features

Instructions/Features support status

etc...

How to import into your Rust project

This module is released at crates.io. Add the following line into Cargo.toml of your Rust project.

[dependencies] riscv_emu_rust = "0.1.0"

Refer to cli/src/main.rs as sample code.

How to build core library

sh $ git clone https://github.com/takahirox/riscv-rust.git $ cd riscv-rust $ cargo build --release

How to run Linux or xv6 as CLI application

```sh $ cd riscv-rust/cli

Run Linux

$ cargo run --release ../resources/linux/bbl -f ../resources/linux/busybear.bin -d ../resources/linux/dtb.dtb

Run xv6

$ cargo run --release ../resources/xv6/kernel -f ../resources/xv6/fs.img ```

How to build WebAssembly and run in the browser

Prerequirements - Install wasm-bindgen client

```sh $ cd riscv-rust/wasm $ bash build.sh

boot local server and access riscv-rust/wasm/web/index.html

```

How to install WebAssembly npm package

sh $ npm install riscv_emu_rust_wasm

How to run riscv-tests

Prerequirements - Install riscv-gnu-toolchain - Install riscv-tests

sh $ cd riscv-rust/cli $ cargo run $path_to_riscv_tets/isa/rv32ui-p-add -n

Links

Linux RISC-V port

Linux RISC-V port

xv6-riscv

xv6-riscv is the RISC-V port of xv6 which is UNIX V6 rewritten by MIT for x86 in the current C language.

Specifications