Basys 3 RISC-V computer

The Basys 3 Z-80 computer with the Z-80 replaced by an RV32IM processor
written from scratch (rtl/rv32_cpu.v): multi-cycle, 90 MHz, CSRs and
traps, interrupts, two hardware triggers and a resumable NMI for the
monitor. Passes riscv-tests rv32ui/um/mi.

rv32_system.v keeps all the Z-80 machine's peripherals, with I/O port N
at FFFFFF00h + N, 80 KB of RAM with BASIC preloaded, and a 32 KB monitor
ROM. BASIC, the five games and the monitor (with an RV32 disassembler,
assembler, breakpoints and single step) are ported to RISC-V GCC. Python
emulator and tests in tools/; full-system simulation in sim/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
brad ArantandClaude Opus 5.5 committed 2026-11-30 18:09:18 -08:00
commit 5930b958b4
103 files changed
+55677

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
# setjmp/longjmp: ra, sp and s0-s11 (newlib's jmp_buf has room).
.text
.globl setjmp, longjmp
setjmp:
sw ra, 0(a0)
sw sp, 4(a0)
sw s0, 8(a0)
sw s1, 12(a0)
sw s2, 16(a0)
sw s3, 20(a0)
sw s4, 24(a0)
sw s5, 28(a0)
sw s6, 32(a0)
sw s7, 36(a0)
sw s8, 40(a0)
sw s9, 44(a0)
sw s10, 48(a0)
sw s11, 52(a0)
li a0, 0
ret
longjmp:
lw ra, 0(a0)
lw sp, 4(a0)
lw s0, 8(a0)
lw s1, 12(a0)
lw s2, 16(a0)
lw s3, 20(a0)
lw s4, 24(a0)
lw s5, 28(a0)
lw s6, 32(a0)
lw s7, 36(a0)
lw s8, 40(a0)
lw s9, 44(a0)
lw s10, 48(a0)
lw s11, 52(a0)
seqz a0, a1
add a0, a0, a1 # 0 becomes 1
ret