All Projects → sysprog21 → rv32emu

sysprog21 / rv32emu

Licence: MIT license
RISC-V RV32I[MAC] emulator with ELF support

Programming Languages

c
50402 projects - #5 most used programming language
Makefile
30231 projects
C++
36643 projects - #6 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to rv32emu

riscv em
Simple risc-v emulator, able to run linux, written in C.
Stars: ✭ 51 (-16.39%)
Mutual labels:  emulator, riscv, risc-v, riscv32, riscv-emulator
Zelda.RISCV.Emulator
A System Level RISCV32 Emulator Over x86_64: capable of booting RISCV Linux
Stars: ✭ 18 (-70.49%)
Mutual labels:  riscv, risc-v, riscv32, riscv-emulator
hero-sdk
⛔ DEPRECATED ⛔ HERO Software Development Kit
Stars: ✭ 21 (-65.57%)
Mutual labels:  riscv, risc-v, riscv32
Riscv Rust
RISC-V processor emulator written in Rust+WASM
Stars: ✭ 253 (+314.75%)
Mutual labels:  emulator, riscv, risc-v
mdepx
MDEPX — A BSD-style RTOS
Stars: ✭ 17 (-72.13%)
Mutual labels:  riscv, bare-metal, risc-v
yarvi
Yet Another RISC-V Implementation
Stars: ✭ 59 (-3.28%)
Mutual labels:  riscv, risc-v, riscv32
ravel
A RISC-V simulator
Stars: ✭ 24 (-60.66%)
Mutual labels:  emulator, riscv, risc-v
arv
ARV: Asynchronous RISC-V Go High-level Functional Model
Stars: ✭ 18 (-70.49%)
Mutual labels:  riscv, risc-v, riscv32
sedna
Sedna - a pure Java RISC-V emulator.
Stars: ✭ 52 (-14.75%)
Mutual labels:  emulator, riscv, risc-v
Unicorn
Unicorn CPU emulator framework (ARM, AArch64, M68K, Mips, Sparc, PowerPC, RiscV, X86)
Stars: ✭ 4,934 (+7988.52%)
Mutual labels:  emulator, riscv
Rv8
RISC-V simulator for x86-64
Stars: ✭ 476 (+680.33%)
Mutual labels:  emulator, riscv
platform-shakti
Shakti: development platform for PlatformIO
Stars: ✭ 26 (-57.38%)
Mutual labels:  riscv, risc-v
Rvemu
RISC-V emulator for CLI and Web written in Rust with WebAssembly. It supports xv6 and Linux (ongoing).
Stars: ✭ 289 (+373.77%)
Mutual labels:  emulator, riscv
Rvemu For Book
Reference implementation for the book "Writing a RISC-V Emulator in Rust".
Stars: ✭ 141 (+131.15%)
Mutual labels:  emulator, riscv
Riscv Fs
F# RISC-V Instruction Set formal specification
Stars: ✭ 173 (+183.61%)
Mutual labels:  riscv, risc-v
riscvm
Tiny RISC-V virtual machine
Stars: ✭ 26 (-57.38%)
Mutual labels:  risc-v, riscv-emulator
derzforth
Bare-metal Forth implementation for RISC-V
Stars: ✭ 25 (-59.02%)
Mutual labels:  bare-metal, risc-v
Diosix
A lightweight, secure, multiprocessor bare-metal hypervisor written in Rust for RISC-V
Stars: ✭ 116 (+90.16%)
Mutual labels:  riscv, risc-v
riscv-meta
RISC-V Instruction Set Metadata
Stars: ✭ 33 (-45.9%)
Mutual labels:  riscv, risc-v
nuclei-sdk
Nuclei RISC-V Software Development Kit
Stars: ✭ 65 (+6.56%)
Mutual labels:  riscv, risc-v

RISC-V RV32I[MAC] emulator with ELF support

rv32emu is an instruction set architecture (ISA) emulator implementing the 32 bit RISC-V processor model.

Build and Verify

rv32emu relies on some 3rd party packages to be fully usable and to provide you full access to all of its features. You need to have a working SDL2 library on your target system.

  • macOS: brew install sdl2
  • Ubuntu Linux / Debian: sudo apt install libsdl2-dev

Build the emulator.

make

Run sample RV32I[MA] programs:

make check

Run Doom, the classical video game, via rv32emu:

make demo

The build script will then download data file for Doom automatically. SDL2 based window should appear when Doom is loaded and executed.

riscv-arch-test

The RISC-V Architectural Tests, riscv-arch-test, is the basic set of tests that can ensure the risc-v model's behavior that matches RISC-V specifications while implementing specific software.(not a substitute for rigorous design verification)

There are reference signatures that generated by the formal RISC-V model RISC-V SAIL and the Executable and Linkable Format(ELF) files. The ELF files such as cadd-01.elf that contain several testing instructions, data, and signatures. The test signatures are the specific data locations that need to be written by testing model(this emulator) during the test. Once the test is executed, the test signatures will be written and compared to the reference signature. The test will pass if both signatures exactly match.

riscv-arch-test is integrated with submodule, and the setup was done.Once the submodule riscv-arch-test is pulled, run all the available riscv-arch-test via command:

make arch-test
  • To run the tests for specific extension, set the environmental variable RISCV_DEVICE to one of I,M,C,Zifencei,privilege.
make arch-test RISCV_DEVICE=I
  • To run a specific test case,set both RISCV_DEVICE and RISCV_TEST.For example:
make arch-test RISCV_DEVICE=M RISCV_TEST=div-01

The details about the setup environment variables can be found in the RISC-V Architectural Testing Framework, 5.1 Setup environment variables.

Current progress of this emulator in riscv-arch-test(RV32):

  • Passed Tests
    • I: Base Integer Instruction Set
    • M: Standard Extension for Integer Multiplication and Division
    • Zifencei: Instruction-Fetch Fence
  • Failed Tests
    • C: Standard Extension for Compressed Instruction
      • cebreak
    • privilege: RISCV Privileged Specification
      • 2 system calls
        • ebreak
        • ecall
      • 5 misaligned CB-type instructions
        • misalign-beq
        • misalign-bge
        • misalign-bgeu
        • misalign-blt
        • misalign-bltu
      • 1 misaligned CL-type instructions
        • misalign-lw
      • 1 misaligned CS-type instructions
        • misalign-sw
  • Unsupported tests
    • F Standard Extension for Single-Precision Floating-Point

Detail in riscv-arch-test:

Customization

rv32emu is configurable, and you can modify Makefile to fit your expectations:

  • ENABLE_RV32M: Standard Extension for Integer Multiplication and Division
  • ENABLE_RV32A: Standard Extension for Atomic Instructions
  • ENABLE_RV32C: Standard Extension for Compressed Instructions (RV32C.F excluded)
  • Zicsr: Control and Status Register (CSR)
  • Zifencei: Instruction-Fetch Fence

Add -D to enable and -U to disable the specific ISA extensions.

Reference

License

rv32emu is released under the MIT License. Use of this source code is governed by a MIT license that can be found in the LICENSE file.

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].