Files
Basys3Terminal/scripts/sim.sh
T
brad ArantandClaude Opus 5.5 59d5e617f2 Z-80 computer with Dartmouth-style BASIC as the terminal's console
SW15 switches the terminal from the PC's serial line to a Z-80 running at
90 MHz from its own clock, with 64 KB of block RAM preloaded with BASIC.

- rtl/z80_cpu.v: Z-80 built for speed (one clock per memory access, next
  byte read during decode), full documented instruction set plus the
  common undocumented forms; no interrupts.
- rtl/z80_system.v: RAM, console/timer/7-segment ports, toggle handshakes
  to the terminal clock.
- basic/: BASIC interpreter in C for SDCC, start-up code, prebuilt image.
- tools/z80emu.py, tools/cputest.py, scripts/cpusim.sh: reference emulator
  and random tests comparing the CPU after every instruction.
- SW14 feeds the PC's UART into the Z-80 for pasting programs; BTND
  resets the Z-80 only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 20:25:41 -08:00

18 lines
640 B
Bash
Executable File

#!/bin/bash
# Run the testbench in Vivado's simulator; output lands in sim/work.
set -e
cd "$(dirname "$0")/.."
ROOT=$(pwd)
source scripts/vivado_env.sh
mkdir -p sim/work
cd sim/work
xvlog -d SIMULATION -d FONT_FILE="\"$ROOT/font/font.mem\"" -d MEM_FILE="\"$ROOT/basic/basic.mem\"" "$ROOT"/rtl/*.v "$ROOT"/sim/tb_terminal.v
xelab -debug off tb_terminal -s tb_terminal
xsim tb_terminal -R
if command -v python3 >/dev/null; then
for f in frame_*.ppm; do
python3 -c "import sys; from PIL import Image; Image.open(sys.argv[1]).save(sys.argv[2])" \
"$f" "${f%.ppm}.png" && echo "wrote sim/work/${f%.ppm}.png"
done
fi