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>
44 lines
1.8 KiB
Tcl
44 lines
1.8 KiB
Tcl
# Program the Basys 3 over its USB-JTAG port.
|
|
# vivado -mode batch -source scripts/program.tcl (SRAM, lost at power-off)
|
|
# vivado -mode batch -source scripts/program.tcl -tclargs flash (QSPI flash, survives power-off)
|
|
set root [file normalize [file dirname [info script]]/..]
|
|
set mode [expr {[llength $argv] > 0 ? [lindex $argv 0] : "sram"}]
|
|
|
|
open_hw_manager
|
|
connect_hw_server
|
|
open_hw_target
|
|
set dev [lindex [get_hw_devices xc7a35t*] 0]
|
|
current_hw_device $dev
|
|
refresh_hw_device -update_hw_probes false $dev
|
|
|
|
if {$mode eq "flash"} {
|
|
# Board revisions differ: older Basys 3s have Spansion flash, newer ones Macronix.
|
|
# Vivado checks the chip ID before erasing, so a wrong guess is harmless.
|
|
set done 0
|
|
foreach part {mx25l3273f-spi-x1_x2_x4 s25fl032p-spi-x1_x2_x4} {
|
|
create_hw_cfgmem -hw_device $dev [lindex [get_cfgmem_parts $part] 0]
|
|
set mem [get_property PROGRAM.HW_CFGMEM $dev]
|
|
set_property PROGRAM.FILES [list $root/build/basys3_terminal.mcs] $mem
|
|
set_property PROGRAM.ADDRESS_RANGE use_file $mem
|
|
set_property PROGRAM.ERASE 1 $mem
|
|
set_property PROGRAM.CFG_PROGRAM 1 $mem
|
|
set_property PROGRAM.VERIFY 1 $mem
|
|
create_hw_bitstream -hw_device $dev [get_property PROGRAM.HW_CFGMEM_BITFILE $dev]
|
|
program_hw_devices $dev
|
|
if {![catch {program_hw_cfgmem -hw_cfgmem $mem}]} {
|
|
set done 1
|
|
break
|
|
}
|
|
delete_hw_cfgmem $mem
|
|
}
|
|
if {!$done} { error "flash part not recognised" }
|
|
# reload the FPGA from flash (works when JP1 is set to QSPI)
|
|
boot_hw_device $dev
|
|
puts "Flash programmed; with JP1 on QSPI the board now boots from it."
|
|
} else {
|
|
set_property PROGRAM.FILE $root/build/basys3_terminal.bit $dev
|
|
program_hw_devices $dev
|
|
puts "FPGA configured."
|
|
}
|
|
close_hw_manager
|