From 3df2f4e91eafbddef38d5bdab5d493d0df4adda1 Mon Sep 17 00:00:00 2001 From: stnolting Date: Sat, 21 Dec 2024 09:03:59 +0100 Subject: [PATCH] [sim] cleanup GHDL scripts --- sim/ghdl.run.sh | 46 ---------------------------------------------- sim/ghdl.sh | 43 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 39 insertions(+), 50 deletions(-) delete mode 100755 sim/ghdl.run.sh diff --git a/sim/ghdl.run.sh b/sim/ghdl.run.sh deleted file mode 100755 index daffe7aad..000000000 --- a/sim/ghdl.run.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash - -set -e - -cd $(dirname "$0") -GHDL="${GHDL:-ghdl}" - -# Prepare UART SIM_MODE output files -touch neorv32.uart0_sim_mode.out neorv32.uart1_sim_mode.out -chmod 777 neorv32.uart0_sim_mode.out neorv32.uart1_sim_mode.out - -# Prepare testbench UART log files -touch neorv32_tb.uart0_rx.out neorv32_tb.uart1_rx.out -chmod 777 neorv32_tb.uart0_rx.out neorv32_tb.uart1_rx.out - -# GHDL build directory -mkdir -p build - -# GHDL import -find ../rtl/core ../sim -type f -name '*.vhd' -exec \ - ghdl -i --std=08 --workdir=build --ieee=standard --work=neorv32 {} \; - -# GHDL analyze -$GHDL -m --work=neorv32 --workdir=build --std=08 neorv32_tb - -# GHDL run parameters -if [ -z "$1" ] - then - GHDL_RUN_ARGS="${@:---stop-time=10ms}" - else - # Let's pass down all the parameters to GHDL - GHDL_RUN_ARGS=$@ -fi -echo "GHDL simulation run parameters: $GHDL_RUN_ARGS"; - -# GHDL run -runcmd="$GHDL -r --work=neorv32 --workdir=build --std=08 neorv32_tb \ - --max-stack-alloc=0 \ - --ieee-asserts=disable \ - --assert-level=error $GHDL_RUN_ARGS" - -if [ -n "$GHDL_DEVNULL" ]; then - $runcmd >> /dev/null -else - $runcmd -fi diff --git a/sim/ghdl.sh b/sim/ghdl.sh index 58d754f8f..daffe7aad 100644 --- a/sim/ghdl.sh +++ b/sim/ghdl.sh @@ -1,11 +1,46 @@ #!/usr/bin/env bash -# Abort if any command returns != 0 set -e cd $(dirname "$0") +GHDL="${GHDL:-ghdl}" -echo "[TIP] Compile application with USER_FLAGS+=-DUART[0/1]_SIM_MODE to enable UART[0/1]'s simulation mode (redirect UART output to simulator console)." +# Prepare UART SIM_MODE output files +touch neorv32.uart0_sim_mode.out neorv32.uart1_sim_mode.out +chmod 777 neorv32.uart0_sim_mode.out neorv32.uart1_sim_mode.out -# Run simulation (pass down more than 1 parameter to GHDL) -/bin/bash ghdl.run.sh $@ +# Prepare testbench UART log files +touch neorv32_tb.uart0_rx.out neorv32_tb.uart1_rx.out +chmod 777 neorv32_tb.uart0_rx.out neorv32_tb.uart1_rx.out + +# GHDL build directory +mkdir -p build + +# GHDL import +find ../rtl/core ../sim -type f -name '*.vhd' -exec \ + ghdl -i --std=08 --workdir=build --ieee=standard --work=neorv32 {} \; + +# GHDL analyze +$GHDL -m --work=neorv32 --workdir=build --std=08 neorv32_tb + +# GHDL run parameters +if [ -z "$1" ] + then + GHDL_RUN_ARGS="${@:---stop-time=10ms}" + else + # Let's pass down all the parameters to GHDL + GHDL_RUN_ARGS=$@ +fi +echo "GHDL simulation run parameters: $GHDL_RUN_ARGS"; + +# GHDL run +runcmd="$GHDL -r --work=neorv32 --workdir=build --std=08 neorv32_tb \ + --max-stack-alloc=0 \ + --ieee-asserts=disable \ + --assert-level=error $GHDL_RUN_ARGS" + +if [ -n "$GHDL_DEVNULL" ]; then + $runcmd >> /dev/null +else + $runcmd +fi