How mpimienta/risc-v works
This repository implements an 8-bit, 16-bit-instruction RISC-V-inspired CPU for an FPGA, plus a Python assembler. The principal workflow is assembling instructions into machine-code output and executing them in a multicycle fetch-high, fetch-low, execute design. The documented ISA and MMIO map define the CPU’s instruction and I/O domains; the tree also includes display, keypad, and OLED modules. Source excerpts cover only the assembler, so hardware wiring beyond the README’s documented stages and memory map is left unverified.
Main entry points: riscv.vhd CPU Core · io_memory Memory-Mapped I/O · display_subsystem.vhd Display Subsystem · top_level.vhd FPGA Top Level
Components 22
Assembly Software
- Assembler
compiler/assembler.py
CPU Core
- FPGA Top Level
modules/top_level.vhd - CPU Core
modules/riscv.vhd - Fetch High
modules - Fetch Low
modules - Execute
modules - Instruction Decode
modules/control/decoder.vhd - Control Unit
modules/control/control_unit.vhd - Datapath
modules/datapath - Hazard and Forwarding
modules/control
Memory and I/O
- Instruction ROM
modules/io_memory/rom_instructions.vhd - Data RAM
modules/io_memory/ram_data.vhd - Memory-Mapped I/O
modules/io_memory
Board Peripherals
- Keypad Controller
modules/io_memory/keypad_controller.vhd - Display Subsystem
modules/display/display_subsystem.vhd - Display Manager
modules/display/display_manager.vhd - LCD Controller
modules/display/lcd_controller.vhd - I2C Master
modules/display/i2c_master.vhd - OLED SPI MMIO
modules/oled_noRGB/oled_spi_mmio.vhd
Other components
- Assembly Source
- Machine Code
- Basys 3 Board
Connections 20
- Assembly Source → Assembler: reads
compiler/assembler.py - Assembler → Machine Code: writes
compiler/assembler.py - FPGA Top Level → CPU Core: integrates
- CPU Core → Fetch High: fetches
- Fetch High → Fetch Low: continues fetch
README.md - Fetch Low → Execute: then executes
README.md - CPU Core → Instruction Decode: decodes
- CPU Core → Control Unit: controls
- CPU Core → Datapath: uses
- CPU Core → Hazard and Forwarding: uses
- CPU Core → Instruction ROM: fetches instructions
- CPU Core → Data RAM: accesses data
- CPU Core → Memory-Mapped I/O: maps I/O
- Memory-Mapped I/O → Keypad Controller: routes input
- Memory-Mapped I/O → Display Subsystem: routes output
- Display Subsystem → Display Manager: uses
- Display Subsystem → LCD Controller: uses
- LCD Controller → I2C Master: uses
- Memory-Mapped I/O → OLED SPI MMIO: routes output
- FPGA Top Level → Basys 3 Board: targets