blob: b3e9e2cc603ca918f442cba848fc38ed162a0659 [file] [log] [blame]
:name: HPS
:description: This script runs the HPS Demo
$name?="matcha"
using sysbus
mach create $name
EnsureTypeIsLoaded "Antmicro.Renode.Peripherals.CPU.RiscV32"
include @sim/config/shodan_infrastructure/SpringbokRiscV32.cs
EnsureTypeIsLoaded "Antmicro.Renode.Peripherals.CPU.SpringbokRiscV32"
EnsureTypeIsLoaded "Antmicro.Renode.Peripherals.CPU.SpringbokRiscV32_ControlBlock"
include @sim/config/shodan_infrastructure/SmcRiscV32.cs
include @sim/config/shodan_infrastructure/Mailbox.cs
include @sim/config/shodan_infrastructure/AddressRangeStub.cs
include @sim/config/shodan_infrastructure/CamCtrl.cs
include @sim/config/shodan_infrastructure/DoubleBufferDMA.cs
machine LoadPlatformDescription @sim/config/platforms/hps.repl
cam_i2c.camera AddFrame @out/springbok_iree/quant_models/hps_0_quant_input
cam_i2c.camera AddFrame @out/springbok_iree/quant_models/hps_1_quant_input
cam_i2c.camera AddFrame @out/springbok_iree/quant_models/hps_2_quant_input
cam_i2c.camera AddFrame @out/springbok_iree/quant_models/hps_3_quant_input
cam_i2c.camera AddFrame @out/springbok_iree/quant_models/hps_4_quant_input
cam_i2c.camera AddFrame @out/springbok_iree/quant_models/hps_5_quant_input
$term_port?=3456
emulation CreateServerSocketTerminal $term_port "term" false
connector Connect uart5 term
# for a client, bash users may consider this inline script:
#
# stty sane -echo -icanon; socat TCP:localhost:$term_port -; stty sane
#
# tmux users may consider adding a binding to ~/.tmux.conf
#
# bind-key k split-window "stty -echo -icanon; socat TCP:localhost:$term_port -"
# Hook up the analyzers to the uarts so we can see their output in the main
# Renode log
showAnalyzer "uart0-analyzer" sysbus.uart0 Antmicro.Renode.Analyzers.LoggingUartAnalyzer
showAnalyzer "uart5-analyzer" sysbus.uart5 Antmicro.Renode.Analyzers.LoggingUartAnalyzer
# Set the uarts host/virt timestamp format. Options: None, Virtual, Host, Full.
uart0-analyzer TimestampFormat None
uart5-analyzer TimestampFormat None
# Load the bootrom into the 32k rom at 0x8000 (useVirtualAddress = false, allowLoadsOnlyToMemory = true)
sysbus LoadELF @out/shodan_boot_rom/multihart_boot_rom.elf false true cpu0
# Load the tarball of Tock on SEC, Tock on SMC, and HPS model.
$tar ?= @out/hps_ext_flash_release.tar
sysbus LoadBinary $tar 0x44000000
# Start cpu0 at the bootrom reset vector, which is stored immediately after the
# bootrom interrupt vector table at 0x8080.
# (see https://ibex-core.readthedocs.io/en/latest/03_reference/exception_interrupts.html for details)
sysbus.cpu0 PC 0x8080
# Start the vector core at address 0 of its instruction TCM.
sysbus.cpu2 PC 0x34000000
# Set the vector core to be less interactive to IO for faster execution
$vector_core_mips ?= 1000
sysbus.cpu2 PerformanceInMips $vector_core_mips
# Start GDB and halt both cores so we can connect GDB before the bootrom has
# started.
$gdb_port?=3333
machine StartGdbServer $gdb_port false cpu0
machine StartGdbServer $gdb_port false cpu1
machine StartGdbServer $gdb_port false cpu2
cpu0 IsHalted true
cpu1 IsHalted true
cpu2 IsHalted true