aboutsummaryrefslogtreecommitdiffstats
path: root/tests/tools/autotest.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tools/autotest.sh')
-rwxr-xr-xtests/tools/autotest.sh65
1 files changed, 53 insertions, 12 deletions
diff --git a/tests/tools/autotest.sh b/tests/tools/autotest.sh
index 7bccd9a5a..50f5cb580 100755
--- a/tests/tools/autotest.sh
+++ b/tests/tools/autotest.sh
@@ -6,38 +6,52 @@ use_xsim=false
use_modelsim=false
verbose=false
keeprunning=false
+makejmode=false
+frontend="verilog"
backend_opts="-noattr -noexpr"
+autotb_opts=""
scriptfiles=""
scriptopt=""
toolsdir="$(cd $(dirname $0); pwd)"
+warn_iverilog_git=false
if [ ! -f $toolsdir/cmp_tbdata -o $toolsdir/cmp_tbdata.c -nt $toolsdir/cmp_tbdata ]; then
( set -ex; gcc -Wall -o $toolsdir/cmp_tbdata $toolsdir/cmp_tbdata.c; ) || exit 1
fi
-while getopts xml:wkvrs:p: opt; do
+while getopts xmGl:wkjvref:s:p:n: opt; do
case "$opt" in
x)
use_xsim=true ;;
m)
use_modelsim=true ;;
+ G)
+ warn_iverilog_git=true ;;
l)
libs="$libs $(cd $(dirname $OPTARG); pwd)/$(basename $OPTARG)";;
w)
genvcd=true ;;
k)
keeprunning=true ;;
+ j)
+ makejmode=true ;;
v)
verbose=true ;;
r)
backend_opts="$backend_opts -norename" ;;
+ e)
+ backend_opts="$( echo " $backend_opts " | sed 's, -noexpr ,,; s,^ ,,; s, $,,;'; )" ;;
+ f)
+ frontend="$OPTARG" ;;
s)
[[ "$OPTARG" == /* ]] || OPTARG="$PWD/$OPTARG"
scriptfiles="$scriptfiles $OPTARG" ;;
p)
scriptopt="$OPTARG" ;;
+ n)
+ autotb_opts="$autotb_opts -n $OPTARG" ;;
*)
- echo "Usage: $0 [-x|-m] [-w] [-k] [-v] [-r] [-l libs] [-s script] [-p cmdstring] verilog-files\n" >&2
+ echo "Usage: $0 [-x|-m] [-w] [-k] [-j] [-v] [-r] [-e] [-l libs] [-f frontend] [-s script] [-p cmdstring] verilog-files\n" >&2
exit 1
esac
done
@@ -77,17 +91,26 @@ do
exit 1
fi
[[ "$bn" == *_tb ]] && continue
- echo -n "Test: $bn "
- rm -f ${bn}.{err,log}
+ if $makejmode; then
+ status_prefix="Test: $bn "
+ else
+ status_prefix=""
+ echo -n "Test: $bn "
+ fi
+
+ rm -f ${bn}.{err,log,sikp}
mkdir -p ${bn}.out
rm -rf ${bn}.out/*
body() {
cd ${bn}.out
+ fn=$(basename $fn)
+ bn=$(basename $bn)
+
cp ../$fn $fn
if [ ! -f ../${bn}_tb.v ]; then
- "$toolsdir"/../../yosys -b autotest -o ${bn}_tb.v $fn
+ "$toolsdir"/../../yosys -b "test_autotb $autotb_opts" -o ${bn}_tb.v $fn
else
cp ../${bn}_tb.v ${bn}_tb.v
fi
@@ -98,7 +121,7 @@ do
test_count=0
test_passes() {
- "$toolsdir"/../../yosys -b "verilog $backend_opts" "$@" -o ${bn}_syn${test_count}.v $fn $scriptfiles
+ "$toolsdir"/../../yosys -b "verilog $backend_opts" -o ${bn}_syn${test_count}.v "$@"
compile_and_run ${bn}_tb_syn${test_count} ${bn}_out_syn${test_count} \
${bn}_tb.v ${bn}_syn${test_count}.v $libs \
"$toolsdir"/../../techlibs/common/simlib.v \
@@ -108,13 +131,22 @@ do
test_count=$(( test_count + 1 ))
}
+ if [ "$frontend" = "verific" -o "$frontend" = "verific_gates" ] && grep -q VERIFIC-SKIP $fn; then
+ touch ../${bn}.skip
+ return
+ fi
+
if [ -n "$scriptfiles" ]; then
- test_passes
+ test_passes $fn $scriptfiles
elif [ -n "$scriptopt" ]; then
- test_passes -p "$scriptopt"
+ test_passes -f "$frontend" -p "$scriptopt" $fn
+ elif [ "$frontend" = "verific" ]; then
+ test_passes -p "verific -vlog2k $fn; verific -import -all; opt; memory;;"
+ elif [ "$frontend" = "verific_gates" ]; then
+ test_passes -p "verific -vlog2k $fn; verific -import -gates -all; opt; memory;;"
else
- test_passes -p "hierarchy; proc; opt; memory; opt; fsm; opt"
- test_passes -p "hierarchy; proc; opt; memory; opt; fsm; opt; techmap; opt; abc -dff; opt"
+ test_passes -f "$frontend" -p "hierarchy; proc; opt; memory; opt; fsm; opt -fine" $fn
+ test_passes -f "$frontend" -p "hierarchy; synth -run coarse; techmap; opt; abc -dff" $fn
fi
touch ../${bn}.log
}
@@ -129,8 +161,17 @@ do
if [ -f ${bn}.log ]; then
mv ${bn}.err ${bn}.log
- echo "-> ok"
- else echo "-> ERROR!"; $keeprunning || exit 1; fi
+ echo "${status_prefix}-> ok"
+ elif [ -f ${bn}.skip ]; then
+ mv ${bn}.err ${bn}.skip
+ echo "${status_prefix}-> skip"
+ else
+ echo "${status_prefix}-> ERROR!"
+ if $warn_iverilog_git; then
+ echo "Note: Make sure that 'iverilog' is an up-to-date git checkout of icarus verilog."
+ fi
+ $keeprunning || exit 1
+ fi
done
exit 0