All Projects → franzflasch → riscv_em

franzflasch / riscv_em

Licence: GPL-3.0 license
Simple risc-v emulator, able to run linux, written in C.

Programming Languages

c
50402 projects - #5 most used programming language
shell
77523 projects
CMake
9771 projects
assembly
5116 projects

Projects that are alternatives of or similar to riscv em

rv32emu
RISC-V RV32I[MAC] emulator with ELF support
Stars: ✭ 61 (+19.61%)
Mutual labels:  emulator, riscv, risc-v, riscv32, riscv-emulator
hero-sdk
⛔ DEPRECATED ⛔ HERO Software Development Kit
Stars: ✭ 21 (-58.82%)
Mutual labels:  embedded-systems, riscv, risc-v, riscv32
Zelda.RISCV.Emulator
A System Level RISCV32 Emulator Over x86_64: capable of booting RISCV Linux
Stars: ✭ 18 (-64.71%)
Mutual labels:  riscv, risc-v, riscv32, riscv-emulator
Riscv Rust
RISC-V processor emulator written in Rust+WASM
Stars: ✭ 253 (+396.08%)
Mutual labels:  emulator, riscv, risc-v
sedna
Sedna - a pure Java RISC-V emulator.
Stars: ✭ 52 (+1.96%)
Mutual labels:  emulator, riscv, risc-v
nuclei-sdk
Nuclei RISC-V Software Development Kit
Stars: ✭ 65 (+27.45%)
Mutual labels:  embedded-systems, riscv, risc-v
arv
ARV: Asynchronous RISC-V Go High-level Functional Model
Stars: ✭ 18 (-64.71%)
Mutual labels:  riscv, risc-v, riscv32
yarvi
Yet Another RISC-V Implementation
Stars: ✭ 59 (+15.69%)
Mutual labels:  riscv, risc-v, riscv32
ravel
A RISC-V simulator
Stars: ✭ 24 (-52.94%)
Mutual labels:  emulator, riscv, risc-v
Xassette-Asterisk
Evaluation board for AllWinner's RISC-V 64 SoC F133/D1s
Stars: ✭ 168 (+229.41%)
Mutual labels:  risc-v, riscv64
Rvemu For Book
Reference implementation for the book "Writing a RISC-V Emulator in Rust".
Stars: ✭ 141 (+176.47%)
Mutual labels:  emulator, riscv
platform-shakti
Shakti: development platform for PlatformIO
Stars: ✭ 26 (-49.02%)
Mutual labels:  riscv, risc-v
Rv8
RISC-V simulator for x86-64
Stars: ✭ 476 (+833.33%)
Mutual labels:  emulator, riscv
Unicorn
Unicorn CPU emulator framework (ARM, AArch64, M68K, Mips, Sparc, PowerPC, RiscV, X86)
Stars: ✭ 4,934 (+9574.51%)
Mutual labels:  emulator, riscv
Rvemu
RISC-V emulator for CLI and Web written in Rust with WebAssembly. It supports xv6 and Linux (ongoing).
Stars: ✭ 289 (+466.67%)
Mutual labels:  emulator, riscv
riscv-meta
RISC-V Instruction Set Metadata
Stars: ✭ 33 (-35.29%)
Mutual labels:  riscv, risc-v
riscvm
Tiny RISC-V virtual machine
Stars: ✭ 26 (-49.02%)
Mutual labels:  risc-v, riscv-emulator
9444
9444 RISC-V 64IMA CPU and related tools and peripherals.
Stars: ✭ 18 (-64.71%)
Mutual labels:  risc-v, risc-v64
Rt Thread
RT-Thread is an open source IoT operating system.
Stars: ✭ 6,466 (+12578.43%)
Mutual labels:  embedded-systems, risc-v
KyogenRV
The Simple 5-staged pipeline RISC-V written in chisel3 for intel FPGA.
Stars: ✭ 37 (-27.45%)
Mutual labels:  riscv, risc-v

riscv_em

This is a risc-v emulator written in plain C.
It started as a fun project a while ago and is now capable of doing a few things (but still just a hobby, won't be big and professional like qemu ;)

Ever wanted to know what the absolute minimum requirements are to run linux?

riscv_em is the answer. Yes, the emulator is capable of running Linux.

One goal of this project is to be easily able to understand its source code and thus also the risc-v isa. You can also see this project as an attempt to directly translate the RISC-V ISA specs (Currently Unprivileged Spec v.20191213 and Privileged Spec v.20190608) into plain C.
Implementation focus is simplicity NOT efficiency! Altough I always try to improve it's performance whenever possible, as long as the code does not suffer losses in readability!

Currently the emulator supports RV32IMA and RV64IMA instructions.
Furthermore it implements a CLINT (Core-Local Interrupt Controller) and also a PLIC (Platform Level Interrupt Controller), as well as a simple UART.

UPDATE 2021: Now the emulator also fully implements PMP and MMU.

Please see https://github.com/franzflasch/linux_for_riscv_em for a how-to-build appropriate linux images.

  • MMU support is currently only available for RV32 (Sv32). Support for RV64 MMU (Sv39, Sv48) will follow.
  • NOMMU is currently only supported for RV64 due to the kernel at the time of this writing only supports this for RV64.

How-To build RV64-nommu:

mkdir build && cd build  
cmake -DRV_ARCH=64 ..  
make  

How-To build RV32-mmu:

mkdir build && cd build  
cmake -DRV_ARCH=32 ..  
make  

Build the device tree binaries for RV64-nommu and RV32-mmu (device-tree-compiler needed):

cd dts
./build_dtb.sh

Build a linux image for this emulator:

Please see https://github.com/franzflasch/linux_for_riscv_em

Start the emulator and load (uc)linux (RV64-nommu):

./build/riscv_em -f <linux_for_riscv_em-path>/output/linux/loader_64.bin -d dts/riscv_em.dtb

Start the emulator and load a full blown linux with opensbi (RV32-mmu):

./build/riscv_em -f <linux_for_riscv_em-path>/output_mmu_rv32/opensbi/build/platform/generic/firmware/fw_payload.bin -d dts/riscv_em32_linux.dtb
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].