blob: 2dd06246d4580d13750a2fb37d9d3f41bc296de6 [file] [log] [blame]
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Renode script for testing the 3-core version of the Sancha platform
$name?="sencha"
using sysbus
mach create $name
include @sim/config/shodan_infrastructure/MpactCPU.cs
EnsureTypeIsLoaded "Antmicro.Renode.Peripherals.MpactCPU.MpactBaseCPU"
EnsureTypeIsLoaded "Antmicro.Renode.Peripherals.MpactCPU.MpactPeripheral"
include @sim/config/shodan_infrastructure/MpactCheriotCPU.cs
EnsureTypeIsLoaded "Antmicro.Renode.Peripherals.MpactCPU.MpactCheriotCPU"
EnsureTypeIsLoaded "Antmicro.Renode.Peripherals.CPU.RiscV32"
include @sim/config/shodan_infrastructure/KelvinCPU.cs
EnsureTypeIsLoaded "Antmicro.Renode.Peripherals.CPU.KelvinCPU"
EnsureTypeIsLoaded "Antmicro.Renode.Peripherals.CPU.MlTopControlBlock"
include @sim/config/shodan_infrastructure/SmcCheriotCPU.cs
include @sim/config/shodan_infrastructure/Mailbox.cs
include @sim/config/shodan_infrastructure/AddressRangeStub.cs
include @sim/config/shodan_infrastructure/MatchaI2S.cs
EnsureTypeIsLoaded "Antmicro.Renode.Peripherals.Sound.MatchaI2S"
$repl_file ?= @sim/config/platforms/sencha.repl
machine LoadPlatformDescription $repl_file
$term_port?=3456
emulation CreateServerSocketTerminal $term_port "term" false
connector Connect uart5 term
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 boot rom into the 32k rom at 0x8000 (useVirtualAddress = false, allowLoadsOnlyToMemory = true)
sysbus LoadELF @out/sencha/hw/boot_rom.elf false true cpu0
# 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
cpu1 IsHalted true
$cheriotLibrary ?= @out/cheriot/sim/librenode_mpact_cheriot.so
sysbus.cpu1 CpuLibraryPath $cheriotLibrary
# Override cli_port to enable the command line interface on the specified port.
$cli_port?= 0
$wait_for_cli ?= false
sysbus.cpu1 CLIPort $cli_port
sysbus.cpu1 WaitForCLI $wait_for_cli
$tar ?= @out/cheriot/sencha/release/ext_flash.tar
$spi_flash_load_address ?= 0x44000000
$sc_bin ?= @out/cantrip/shodan/release/tmp/matcha-tock-bundle.bin
$eflash_address ?= 0x20000000
sysbus LoadBinary $tar $spi_flash_load_address
sysbus LoadBinary $sc_bin $eflash_address
#sysbus LoadSymbolsFrom $cheriot_elf
# If we have a I2S peripheral, setup an audio file that we can use
# for sampling data. Note that the format for these files is raw
# sample data, left channel followed by right.
$i2s_mic_audio_file ?= @sim/config/shodan_infrastructure/test.raw
$i2s_speaker_audio_file ?= @/tmp/speaker.raw
# Uncomment these lines to enable audio
i2s0 InputFile $i2s_mic_audio_file
#i2s0 OutputFile $i2s_speaker_audio_file
$kelvinLibrary ?= @out/kelvin/sim/librenode_kelvin.so
sysbus.cpu2 CpuLibraryPath $kelvinLibrary
# Start the vector core at address 0 of its instruction TCM.
sysbus.cpu2 PC 0x80000000
# Set the vector core to be less interactive to IO for faster execution
$vector_core_mips ?= 1000
sysbus.cpu2 PerformanceInMips $vector_core_mips
# TOOD: enable for soundstream until model is properly packaged
#$kelvin_bin?=@out/cheriot/sim/kelvin.bin
#sysbus LoadBinary $kelvin_bin 0x5A000000
# Start GDB and halt both cores so we can connect GDB before the bootrom has
# started.
# cpu2 does not support GDB. Please follow docs/KelvinIssDebugging.md to debug
# Kelvin programs.
$gdb_port?=3333
machine StartGdbServer $gdb_port false cpu0
# TODO(sleffler) temp disable due to breakage
machine StartGdbServer $gdb_port false cpu1
cpu0 IsHalted true
cpu1 IsHalted true
cpu2 IsHalted true
# Enable for instruction & memory profiling. Data are written to
# $ROOTDIR/cache/renode/mpact_cheriot_renode* (to be fixed).
cpu1 SymbolFile $cheriot_elf
#cpu1 InstProfile true
#cpu1 MemProfile true