Cindy Liu | ee965fc | 2022-03-15 17:37:10 -0700 | [diff] [blame] | 1 | #! /bin/bash |
| 2 | # Run verilator testbench simulation. |
| 3 | |
| 4 | if [[ $# -lt 4 || $1 == "--help" ]]; then |
| 5 | echo "Usage: run-chip-verilator-sim.sh <verilator testbech> <rom binary> <flash binary> <otp binary> [OPTIONS]" |
| 6 | exit 0 |
| 7 | fi |
| 8 | |
| 9 | VCHIP_TB=$1 |
| 10 | ROM_BIN=$2 |
| 11 | FLASH_BIN=$3 |
| 12 | OTP_BIN=$4 |
| 13 | |
| 14 | shift 4 |
| 15 | |
| 16 | if [[ ! -f $(realpath ${VCHIP_TB}) ]]; then |
| 17 | echo "Verilator testbench not found. Please run \`m matcha_hw_verilator_sim\` or generate the testbench first." |
| 18 | exit 1 |
| 19 | fi |
| 20 | |
| 21 | if [[ ! -f $(realpath ${ROM_BIN}) ]] || [[ ! -f $(realpath ${FLASH_BIN}) ]] || |
| 22 | [[ ! -f $(realpath ${OTP_BIN}) ]]; then |
| 23 | echo "Software binaries not found. Please run \`m opentitan_sw_verilator_sim\` or generate the SW binaries first." |
| 24 | exit 1 |
| 25 | fi |
| 26 | |
| 27 | ${VCHIP_TB} \ |
| 28 | "--meminit=rom,${ROM_BIN}" \ |
| 29 | "--meminit=flash,${FLASH_BIN}" \ |
| 30 | "--meminit=otp,${OTP_BIN}" $@ |