All Projects → Engineev → ravel

Engineev / ravel

Licence: other
A RISC-V simulator

Programming Languages

C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language
assembly
5116 projects
python
139335 projects - #7 most used programming language
CMake
9771 projects

Projects that are alternatives of or similar to ravel

Jupiter
RISC-V Assembler and Runtime Simulator
Stars: ✭ 326 (+1258.33%)
Mutual labels:  simulator, riscv, risc-v
Riscv Rust
RISC-V processor emulator written in Rust+WASM
Stars: ✭ 253 (+954.17%)
Mutual labels:  emulator, riscv, risc-v
riscv em
Simple risc-v emulator, able to run linux, written in C.
Stars: ✭ 51 (+112.5%)
Mutual labels:  emulator, riscv, risc-v
Rv8
RISC-V simulator for x86-64
Stars: ✭ 476 (+1883.33%)
Mutual labels:  emulator, simulator, riscv
Rars
RARS -- RISC-V Assembler and Runtime Simulator
Stars: ✭ 413 (+1620.83%)
Mutual labels:  simulator, riscv, risc-v
sedna
Sedna - a pure Java RISC-V emulator.
Stars: ✭ 52 (+116.67%)
Mutual labels:  emulator, riscv, risc-v
rv32emu
RISC-V RV32I[MAC] emulator with ELF support
Stars: ✭ 61 (+154.17%)
Mutual labels:  emulator, riscv, risc-v
Rvemu
RISC-V emulator for CLI and Web written in Rust with WebAssembly. It supports xv6 and Linux (ongoing).
Stars: ✭ 289 (+1104.17%)
Mutual labels:  emulator, riscv
Unicorn
Unicorn CPU emulator framework (ARM, AArch64, M68K, Mips, Sparc, PowerPC, RiscV, X86)
Stars: ✭ 4,934 (+20458.33%)
Mutual labels:  emulator, riscv
yarvi
Yet Another RISC-V Implementation
Stars: ✭ 59 (+145.83%)
Mutual labels:  riscv, risc-v
Awesome Emulators Simulators
A curated list of software emulators and simulators of PCs, home computers, mainframes, consoles, robots and much more...
Stars: ✭ 94 (+291.67%)
Mutual labels:  emulator, simulator
ts-c99-compiler
ANSI C 16bit Compiler + NASM Assembler + Intel 8086 / 80186 + X87 emulator written entirely in TypeScript
Stars: ✭ 78 (+225%)
Mutual labels:  emulator, simulator
Assembler Simulator
Simple 8-bit Assembler Simulator with Angular.js
Stars: ✭ 792 (+3200%)
Mutual labels:  emulator, simulator
Rvemu For Book
Reference implementation for the book "Writing a RISC-V Emulator in Rust".
Stars: ✭ 141 (+487.5%)
Mutual labels:  emulator, riscv
PokemonBattleEngine
A C# library that can emulate Pokémon battles.
Stars: ✭ 92 (+283.33%)
Mutual labels:  emulator, simulator
facebook-send-api-emulator
Facebook Messenger Emulator & Facebook Send API Emulator functionality allowing you to test web hooks on developer's machine.
Stars: ✭ 24 (+0%)
Mutual labels:  emulator, simulator
I8086.js
16bit Intel 8086 / 80186 + X87 emulator written in TypeScript with REPL assembly compiler and tiny C compiler
Stars: ✭ 54 (+125%)
Mutual labels:  emulator, simulator
platform-shakti
Shakti: development platform for PlatformIO
Stars: ✭ 26 (+8.33%)
Mutual labels:  riscv, risc-v
Metroboy
MetroBoy - A playable, circuit-level simulation of an entire Game Boy
Stars: ✭ 169 (+604.17%)
Mutual labels:  emulator, simulator
riscv-meta
RISC-V Instruction Set Metadata
Stars: ✭ 33 (+37.5%)
Mutual labels:  riscv, risc-v

ravel

master dev
Build Status Build Status

Introduction

ravel is a RISC-V simulator written for the compiler course taught at Shanghai Jiao Tong University, and the students in this course are usually second-year undergraduates at ACM Honers Class. In this course, students are required to implement a toy compiler that turns Mx* (a toy language used in the course) to RISC-V assembly. This simulator is used to test the correctness of the implementation and measure the quality of the optimization.

Getting started

The only prerequisites are CMake (>= 3.12) and a cpp-17 supporting compiler. You can install the simulator with the following commands.

git clone https://github.com/Engineev/ravel.git
cd ravel
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/opt  # or any directory you want
make 
make install
export PATH="/usr/local/opt/bin:$PATH"  # optional

The easiest way to start a simulation is to use the OJ mode, that is,

ravel --oj-mode

Under this mode, the simulator takes test.s and builtin.s as the source code, test.in as the input and redirect the program output into test.out. The results (e.g. exit code) of the simulation will still be outputted directly to stdout. This is equivalent to

ravel --input-file=test.in --output-file=test.out test.s builtin.s
# By default, cache is disabled. You can use --enable-cache to turn it on.

If you'd like to see the instructions being executed, you may pass in command line option --print-instructions, but note that this will significantly slow down the simulation. Also, if --keep-debug-info is passed in, ravel will perform more checks on memory accesses and will print additional information like the call stack when an error occurred.

Ravel as a static library

It's possible to use ravel as a static library. In fact, make insatll will also install the library libravel-sim.a into ${CMAKE_INSTALL_PREFIX}/lib and the corresponding headers into ${CMAKE_INSTALL_PREFIX}/include. See ./test/test-ravel-sim.cpp for a minimal example. If you installed ravel into /usr/local/opt, then you can build the test with

g++ -std=c++17 ./test/test-ravel-sim.cpp -I/usr/local/opt/include -L/usr/local/opt/lib/ -lravel-sim

Support

In short, if the assembly resembles the one generated with the following command,

riscv32-unknown-linux-gnu-gcc -S -std=c99 -fno-section-anchors main.c

where the build of gcc is configured with

./configure --prefix=/opt/riscv --with-arch=rv32ima --with-abi=ilp32

then in most cases it is supported by the simulator.

See this for information on the risc-v toolchain. For detail on supported directives, instructions and libc functions, see doc/support.md.

Computing the running time

The output of ravel contains a time filed. This is computed in the following way. For each type of instructions, the number of execution is recorded during the interpretation, and time is computed by a weighted summation. The default weights are listed in the following table. You can change the weights by passing in command line options like -wsimple=2. By default, cache is disabled. You may enable it by passing in --enable-cache.

Type Weight
simple 1
cache 4
mul 4
br 8
div 8
mem 64
libcIO 64
libcMem function-dependent

Note: Unconditional jumps are viewed as simple instructions.

Pronunciation

This project is named after the French composer Maurice Ravel, so the most correct way to pronounce the project name in English is /rəˈvɛl/ or /ræˈvɛl/, though I'm also OK with the pronunciation /ˈravəl/.

In any case, how about checking this colorful piano concerto by Ravel?

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