RISC-V Processor and I/O Simulator

RV32IM assembly, instruction encoding, memory-mapped peripherals, and machine interrupts
Conceptualized by Adelson Chua
⌘

Assembly

main.s
Live assembly
Examples are editableUTF-8 · RV32IM

Diagnostics

▦

Machine state

PROGRAM COUNTER0x00000000
Instructions Ran0
32 registers · x0 is hardwired to zero
REGISTERABIVALUE
NEXT INSTRUCTIONEnter a program to begin

Connected I/O

0 devices

Connect a device, assign its memory address, then use loads and stores to control it.

Address map and assembly symbols

Reserve space for I/O

The new RAM space reaches I/O addresses. Choose where the reserved MMIO range starts. Addresses in this range are used for peripherals.

Corresponding .equ addresses update automatically. Your remaining assembly code is preserved.

Load Binary

Load this file's raw bytes into RAM at the destination address. Loading restarts the current program. Reset restores the program and loaded binary data.

Save Project

Save your project changes?

Your current assembly and I/O mapping have unsaved changes. Save a project file before opening another project or source.

Add I/O peripheral

Build your experiment. Choose a device, configure its size or probe connections, then assign its memory address.

RISC-V instruction encoding

Peripheral quick guide

Getting started

Write a RISC-V program, connect I/O devices, and watch how instructions change registers, memory, and hardware. This guide and each peripheral's quick guide open inside the simulator.

  1. Connect a peripheral. Use Add I/O peripheral, choose an illustrated board, and assign its memory address. For input devices, select polling or interrupts.
  2. Try its example. Each connected device has a Load example control. Input devices provide polling and interrupt examples using your configured mapping.
  3. Edit and run. Source code assembles as you type. Resolve any diagnostics, then use Run or Step.
  4. See what each instruction does. Inspect registers, memory, and CSRs. Open Assembly → Machine code and select a row for its encoding explanation.
  5. Save the experiment. Use File → Save Project to keep the assembly, connected devices, mappings, breakpoints, and view settings together.

Project files and assembly files

Load Project restores the saved design at its entry point. Load Assembly replaces the source while keeping your connected I/O. Save Assembly exports the source as a .s file. New Project starts a fresh program with no connected devices.

Arrange your experiment

Drag the divider between Assembly and Machine state to adjust their widths. Drag the divider below them to adjust their height together. Reorder a peripheral by its title bar and resize it from a corner.

About this simulator

When I teach I/O interfaces in computer architecture, I've always felt that something was missing. We discuss polling and interrupts, trace through assembly code, and explain how processors communicate with the outside world. But students rarely get the chance to actually put these concepts into practice. After all, what good is learning about I/O if you never get to interact with anything?

That's why I wanted to build this simulator. Give students a RISC-V processor, some virtual I/O devices, and the freedom to experiment, program, and create something of their own. Let them discover what they can do beyond the examples we discuss in class. Computer architecture doesn't have to be all diagrams, equations, and assembly instructions. Learning can be fun, too.

— Adel

Conceptualized by Adelson Chua.

Development is ongoing; feedback is appreciated!

From EEEI, UP Diliman, for computer architecture students.

Feel free to explore, experiment, and make something creative!