Skip to content

alankuo04/rv32I-emulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RV32I emulator

RV32I emulator is a visual emulator built for RV32I Base Integer Instruction Set

Usage

RV32I emulator can be used to do such as:

  • How an executable file of RV32I be disassembled.
  • How machine code is executed in a single-cycle processor of RV32I machine.
  • How register and memory modified by machine.
  • How elf header, program header and section header look like in an ELF file.

The Assembly View

The text editor in left hand side show the disassembled RISC-V instruction in ELF file compiled for RV32I machine. The file will be opened in read-only mode, you can't modify the ELF file by yourself. Also, there will show pc (program counter) in the left of the editor.

The Register View

The register in this emulator will show the temporary value of running ELF file. While running the program, the value changing in the same time.

The Memory View

The memory in this emulator will show the temporary value of running ELF file. Memory can be allocated in a wide range, so it can't show the whole memory value at the same time. When you scroll your scroll bar to the temporary upper or lower bound, it will change the upper or lower bound to show more value of memory. In addition, there are two combo box for going to specified memory position by selecting different register or section.

The Console View

There is a console for showing the stdout in this RV32I emulator. In the top-right, a delete icon can clear the console output directly.

Controlling of emulator

The toolbar have five icons for controlling the RV32I emulator.

icon Name Usage
Reset Reset the emulator, set the program counter to the entry point and reset the register and memory.
Step Run next step of instruction, showing the register and memory value.
Run Start running the emulator with the specified interval setting by user.
End Execute the emulator without showing register and memory modified in each step, the ecall functions will still be printed to console. It will stop at an exit ecall.
Stop Stop running the emulator.
SpinBox A spinobox to set the interval of running the instruction.

ELF File Header View

In the menu bar Help >> About, It will show the elf header, program header and section header by pressed each button.

Downloading

Windows

There is a prebuilt binary for Windows in Releases, or just downloading the source code and build it in Qt Creator.

Linux

There are the steps for compiling Qt project on Linux.

First, installing the qmake.

sudo apt-get install qt5-default qt5-doc-html qt5-qmake qt5-doc qt5-image-formats-plugins

Then, cloning the rv32I-emulator repository.

git clone https://github.com/alankuo04/rv32I-emulator.git

Next, change the directory to src, and run qmake.

cd src/
qmake

The Makefile will generate by qmake, then run make to compile the project.

make

Finally, you get the executable file RV32I_emulator, and you can run it on your pc.

./RV32I_emulator

However, some icons are in wrong position, it will be fixed in the future.