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>
26 lines
1.2 KiB
Tcl
26 lines
1.2 KiB
Tcl
# Timing build of the core alone: vivado -mode batch -source bench/build.tcl
|
|
# MULT/DIV environment variables set the clock (default 9/10 = 90 MHz).
|
|
set root [file normalize [file dirname [info script]]/..]
|
|
set out $root/build/bench
|
|
file mkdir $out
|
|
set mult [expr {[info exists ::env(MULT)] ? $::env(MULT) : 9.0}]
|
|
set div [expr {[info exists ::env(DIV)] ? $::env(DIV) : 10.0}]
|
|
puts "CPU clock: [expr {100.0 * $mult / $div}] MHz"
|
|
|
|
read_verilog $root/rtl/rv32_cpu.v $root/bench/cpu_bench.v
|
|
read_mem $root/bench/bench.mem
|
|
read_xdc $root/bench/bench.xdc
|
|
synth_design -top cpu_bench -part xc7a35tcpg236-1 -generic MULT=$mult -generic DIV=$div
|
|
opt_design -directive Explore
|
|
place_design -directive ExtraTimingOpt
|
|
phys_opt_design -directive AggressiveExplore
|
|
route_design -directive Explore
|
|
phys_opt_design -directive AggressiveExplore
|
|
report_utilization -file $out/utilization.rpt
|
|
report_utilization -hierarchical -file $out/util_hier.rpt
|
|
report_timing_summary -file $out/timing.rpt
|
|
report_timing -max_paths 20 -nworst 1 -unique_pins -file $out/paths.rpt
|
|
write_bitstream -force $out/cpu_bench.bit
|
|
set wns [get_property SLACK [get_timing_paths -max_paths 1 -setup]]
|
|
puts "Worst setup slack: $wns ns"
|