[syn] Fail a bit more gracefully if something goes wrong

This commit is contained in:
Rupert Swarbrick 2021-01-26 13:57:00 +00:00 committed by Rupert Swarbrick
parent b295f07b2d
commit 05b9f51403
2 changed files with 26 additions and 9 deletions

View file

@ -56,7 +56,7 @@ The environment variables that must be set in `syn_setup.sh` are
# Running the synthesis flow
Once `syn_setup.sh` has been created the `syn_yosys.sh` will run the entire
Once `syn_setup.sh` has been created, call `syn_yosys.sh` to run the entire
flow. All outputs are placed under the `syn/syn_out` directory with the prefix
`ibex_` with the current date/time forming the rest of the name, e.g.
`syn/syn_out/ibex_06_01_2020_11_19_15`

View file

@ -7,10 +7,20 @@
# This script drives the experimental Ibex synthesis flow. More details can be
# found in README.md
set -e
set -o pipefail
error () {
echo >&2 "$@"
exit 1
}
teelog () {
tee "$LR_SYNTH_OUT_DIR/log/$1.log"
}
if [ ! -f syn_setup.sh ]; then
echo "Must provide syn_setup.sh file"
echo "See example in syn_setup.example.sh and README.md for instructions"
exit 1
error "No syn_setup.sh file: see README.md for instructions"
fi
#-------------------------------------------------------------------------
@ -28,6 +38,12 @@ mkdir -p "$LR_SYNTH_OUT_DIR/reports/timing"
for file in ../rtl/*.sv; do
module=`basename -s .sv $file`
# Skip packages
if echo "$module" | grep -q '_pkg$'; then
continue
fi
sv2v \
--define=SYNTHESIS \
../rtl/*_pkg.sv \
@ -37,9 +53,6 @@ for file in ../rtl/*.sv; do
> $LR_SYNTH_OUT_DIR/generated/${module}.v
done
# remove generated *pkg.v files (they are empty files and not needed)
rm -f $LR_SYNTH_OUT_DIR/generated/*_pkg.v
# remove tracer (not needed for synthesis)
rm -f $LR_SYNTH_OUT_DIR/generated/ibex_tracer.v
@ -48,9 +61,13 @@ rm -f $LR_SYNTH_OUT_DIR/generated/ibex_tracer.v
rm -f $LR_SYNTH_OUT_DIR/generated/ibex_register_file_ff.v
rm -f $LR_SYNTH_OUT_DIR/generated/ibex_register_file_fpga.v
yosys -c ./tcl/yosys_run_synth.tcl | tee ./$LR_SYNTH_OUT_DIR/log/syn.log
yosys -c ./tcl/yosys_run_synth.tcl |& teelog syn || {
error "Failed to synthesize RTL with Yosys"
}
sta ./tcl/sta_run_reports.tcl | tee ./$LR_SYNTH_OUT_DIR/log/sta.log
sta ./tcl/sta_run_reports.tcl |& teelog sta || {
error "Failed to run static timing analysis"
}
./translate_timing_rpts.sh