Files
Basys3Terminal/scripts/build.tcl
T
brad ArantandClaude Opus 5.5 634e314010 Machine-code monitor, fast serial, memory files, Ctrl-Alt-Del
Monitor: the CPU gets an NMI (taken at an instruction start, or from
HALT) raised by the Pause key, BASIC's MONITOR, two hardware breakpoint
comparators or a step counter. It enters through a trampoline at 0066h
(the same bytes in BASIC's ROM and the monitor's, basic/tramp.s) that
switches in a 32 KB monitor bank over 0000-7FFF. The monitor (monitor/,
C) runs on the terminal's new alternate screen (CSI ?47 h/l, a second
screen page; graphics hidden) and shows registers, flags, a disassembly
from PC, the stack and memory. Commands: Enter/S n step, O step over,
G/X go, B breakpoint, D/M windows, E edit, R registers, and SAVE/LOAD/
DIR for memory files. The disassembler covers every opcode;
monitor/test-disasm.py round-trips all forms through sdasz80. Lockstep
CPU tests still match the reference emulator.

BASIC: MONITOR, CALL addr, BSAVE "N",start,len and BLOAD "N"[,addr]
(memory files: load address then bytes). The DATE clock moves to
F3F8h so the monitor can date files. F000-F3F7 is kept free for
machine code (program area 21076 bytes).

Serial: SW1:0 = 10 is now 921600 and 11 is 3 Mbaud. A 17 KB burst to
BASIC lists back identical at both on the board. send-bas.py reads
the echo while sending; unread, it could stall the PC's flow control.

Ctrl-Alt-Del in Z-80 mode restarts the Z-80 like BTND.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 11:17:54 -08:00

37 lines
1.5 KiB
Tcl

# Non-project Vivado build: vivado -mode batch -source scripts/build.tcl
# The Z-80 clock is 100 MHz * CPU_MULT / CPU_DIV (environment variables).
set root [file normalize [file dirname [info script]]/..]
set out $root/build
file mkdir $out
set mult [expr {[info exists ::env(CPU_MULT)] ? $::env(CPU_MULT) : 9.0}]
set div [expr {[info exists ::env(CPU_DIV)] ? $::env(CPU_DIV) : 10.0}]
set hz [expr {int(round(100e6 * $mult / $div))}]
puts "Z-80 clock: [expr {$hz / 1e6}] MHz"
read_verilog [glob $root/rtl/*.v]
read_mem $root/font/font.mem
read_mem $root/basic/basic.mem
read_mem $root/monitor/monitor.mem
read_xdc $root/constraints/basys3.xdc
synth_design -top basys3_terminal -part xc7a35tcpg236-1 \
-generic CPU_MULT=$mult -generic CPU_DIV=$div -generic CPU_HZ=$hz
opt_design -directive Explore
place_design -directive ExtraTimingOpt
phys_opt_design -directive AggressiveExplore
route_design -directive Explore
phys_opt_design -directive AggressiveExplore
write_checkpoint -force $out/routed.dcp
report_utilization -file $out/utilization.rpt
report_timing_summary -file $out/timing.rpt
report_timing -max_paths 30 -nworst 1 -unique_pins -file $out/paths.rpt
write_bitstream -force $out/basys3_terminal.bit
write_cfgmem -force -format mcs -interface SPIx4 -size 4 \
-loadbit "up 0x0 $out/basys3_terminal.bit" $out/basys3_terminal.mcs
set wns [get_property SLACK [get_timing_paths -max_paths 1 -setup]]
puts "Worst setup slack: $wns ns"
if {$wns < 0} { error "timing not met" }