fpga: tools: Add do file for ModelSim
Original-commit: 99982799869267550844d34a64fe82dfb1aaa79d
This commit is contained in:
@@ -43,6 +43,8 @@ function print_color {
|
|||||||
# Launch ModelSim
|
# Launch ModelSim
|
||||||
#------------------------------------------
|
#------------------------------------------
|
||||||
|
|
||||||
|
SCRIPT_DIR=$(dirname "$(realpath "$0")")
|
||||||
|
|
||||||
# Using -voptargs=+acc makes everything visible in the simulator for GUI mode
|
# Using -voptargs=+acc makes everything visible in the simulator for GUI mode
|
||||||
# and avoids some cases where simulation mismatch could otherwise occur.
|
# and avoids some cases where simulation mismatch could otherwise occur.
|
||||||
# Setting -onfinish to "stop" prevents the simulator from immediately trying to
|
# Setting -onfinish to "stop" prevents the simulator from immediately trying to
|
||||||
@@ -50,23 +52,6 @@ function print_color {
|
|||||||
# error detection in batch mode.
|
# error detection in batch mode.
|
||||||
MSIM_DEFAULT="-voptargs=+acc -quiet -L unisims_ver -onfinish stop"
|
MSIM_DEFAULT="-voptargs=+acc -quiet -L unisims_ver -onfinish stop"
|
||||||
|
|
||||||
# DO file to execute in batch mode. This script runs the simulation and adds
|
|
||||||
# detection of error/failure assertions so that non-zero values are returned by
|
|
||||||
# ModelSim when the testbench doesn't pass. Calling std.env.finish() or
|
|
||||||
# $finish() will return 0. Detecting $fatal() requires that -onfinish be set to
|
|
||||||
# stop so the simulator doesn't quit before the DO file finishes.
|
|
||||||
DO_SCRIPT="\
|
|
||||||
quietly set BreakOnAssertion 2 ;\
|
|
||||||
quietly set SIM_ERROR 0 ;\
|
|
||||||
onbreak { ;\
|
|
||||||
quietly set FINISH [lindex [runStatus -full] 2] ;\
|
|
||||||
if {\$FINISH eq \"unknown\"} { set SIM_ERROR 255 } ;\
|
|
||||||
} ;\
|
|
||||||
onerror { set SIM_ERROR 255 } ;\
|
|
||||||
run -all ;\
|
|
||||||
quit -force -code \$SIM_ERROR ;\
|
|
||||||
"
|
|
||||||
|
|
||||||
# Use specified modelsim.ini, if set
|
# Use specified modelsim.ini, if set
|
||||||
if [[ -z $MSIM_MODELSIM_INI ]]; then
|
if [[ -z $MSIM_MODELSIM_INI ]]; then
|
||||||
MODELSIMINI_ARG=""
|
MODELSIMINI_ARG=""
|
||||||
@@ -92,7 +77,7 @@ if [ $MSIM_MODE == "gui" ]; then
|
|||||||
if [ ${exit_status} -ne 0 ]; then exit ${exit_status}; fi
|
if [ ${exit_status} -ne 0 ]; then exit ${exit_status}; fi
|
||||||
elif [ $MSIM_MODE == "batch" ]; then
|
elif [ $MSIM_MODE == "batch" ]; then
|
||||||
echo "* Launching ModelSim"
|
echo "* Launching ModelSim"
|
||||||
vsim -batch -do "$DO_SCRIPT" $MODELSIMINI_ARG $MSIM_DEFAULT $MSIM_ARGS $MSIM_LIB_ARGS $MSIM_SIM_TOP 2>&1 | while IFS= read -r line; do
|
vsim -batch -do $SCRIPT_DIR/modelsim.do $MODELSIMINI_ARG $MSIM_DEFAULT $MSIM_ARGS $MSIM_LIB_ARGS $MSIM_SIM_TOP 2>&1 | while IFS= read -r line; do
|
||||||
print_color $line
|
print_color $line
|
||||||
done
|
done
|
||||||
exit_status=${PIPESTATUS[0]}
|
exit_status=${PIPESTATUS[0]}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#
|
||||||
|
# Copyright 2024 Ettus Research, a National Instruments Brand
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
#
|
||||||
|
# ModelSim DO file to run a simulation in batch mode. This script adds
|
||||||
|
# detection of error/failure assertions so that non-zero values are returned by
|
||||||
|
# ModelSim when the testbench doesn't pass. Calling std.env.finish() or
|
||||||
|
# $finish() will return 0. Detecting $fatal() requires that -onfinish be set to
|
||||||
|
# stop so the simulator doesn't quit before the DO file finishes.
|
||||||
|
#
|
||||||
|
|
||||||
|
quietly set BreakOnAssertion 2
|
||||||
|
quietly set SIM_ERROR 0
|
||||||
|
onbreak {
|
||||||
|
quietly set FINISH [lindex [runStatus -full] 2]
|
||||||
|
if {$FINISH eq "unknown"} { set SIM_ERROR 255 }
|
||||||
|
}
|
||||||
|
onerror { set SIM_ERROR 255 }
|
||||||
|
run -all
|
||||||
|
quit -force -code $SIM_ERROR
|
||||||
Reference in New Issue
Block a user