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>
21 lines
1.0 KiB
Bash
Executable File
21 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Compile the monitor and write monitor.mem (its 32 KB bank) and monitor.bin;
|
|
# also out/monitor-host, the disassembler and assembler for the PC (tests).
|
|
set -e
|
|
cd "$(dirname "$0")"
|
|
source ../scripts/rv_env.sh
|
|
mkdir -p out
|
|
CFLAGS="$RV_ARCH -Os -mno-relax -ffunction-sections -fdata-sections -fno-common -Wall -I../include"
|
|
${RV_PREFIX}gcc $CFLAGS -c -o out/crt0.o crt0.S
|
|
${RV_PREFIX}gcc $CFLAGS -c -o out/monitor.o monitor.c
|
|
${RV_PREFIX}gcc $CFLAGS -c -o out/string.o ../lib/string.c
|
|
${RV_PREFIX}gcc $CFLAGS -c -o out/setjmp.o ../lib/setjmp.S
|
|
${RV_PREFIX}gcc $RV_ARCH -nostdlib -nostartfiles -T monitor.ld -Wl,--no-relax -Wl,--gc-sections \
|
|
-Wl,--build-id=none -Wl,-Map,out/monitor.map -o out/monitor.elf \
|
|
out/crt0.o out/monitor.o out/string.o out/setjmp.o -lgcc
|
|
${RV_PREFIX}objcopy -O binary -j .text -j .data out/monitor.elf monitor.bin
|
|
${RV_PREFIX}nm -n out/monitor.elf > out/monitor.sym
|
|
python3 ../tools/bin2mem.py monitor.bin monitor.mem 8192
|
|
${RV_PREFIX}size out/monitor.elf
|
|
cc -O1 -Wall -o out/monitor-host monitor.c
|