Skip to content

youriai/RISC-V

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RISC-V emulator

Overview

A lightweight RISC-V emulator, written in C99.

This emulator uses the RISC-V RV32I Instruction set. Support for extensions will be added in future versions.

Requirements

  • CMake ≥ 3.20
  • C99 compiler

Quick Start

Clone this repository:

git clone git@github.com:youriai/RISC-V.git
cd RISC-V

Then use CMake and compile:

cmake -S . -B build
cmake --build build

Lastly run the executable with an argument to the path of the binary file:

./build/risc-v programs/fibonacci.bin

Assembling RISC-V

For assembling RISC-V binaries, I personally use bronzebeard.

Example programs

All these programs are in the programs folder

  • Fibonacci sequence: fibonacci.asm
  • No duplicate instruction print challenge: hey.asm

Future vision

  • Support every RV32I instructions
  • Support most Linux Kernal syscalls
  • Support both 32-bit and 64-bit architectures
  • Support most RV32/RV64 extension
  • Allow for multi threaded code
  • Graphical calls and interrupts
  • Customize memory size
  • Example programs
  • A full C99 assembler (maybe?)

Licensing

This repository is licensed under the MIT License.

References used

  1. RISC-V ISA Specifications
  2. RISC-V ISA Encoder and Decoder
  3. RISC-V Wikipedia
  4. Linux kernel RV32 Syscall Table

About

A RISC-V emulator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors