2014-07-21 07:08:13 -05:00
|
|
|
log_pass()
|
|
|
|
{
|
2014-07-20 06:20:52 -05:00
|
|
|
printf "%-15s %s %s %s\n" "$1" "$2" "`printf "%20s" "$2" | tr -d a-zA-Z0-9_ | tr ' ' .`" "pass."
|
|
|
|
}
|
|
|
|
|
2014-07-21 07:08:13 -05:00
|
|
|
log_fail()
|
|
|
|
{
|
2014-07-20 06:20:52 -05:00
|
|
|
printf "%-15s %s %s %s\n" "$1" "$2" "`printf "%20s" "$2" | tr -d a-zA-Z0-9_ | tr ' ' .`" "FAIL."
|
|
|
|
}
|
2014-07-21 07:08:13 -05:00
|
|
|
|
2014-07-27 14:13:23 -05:00
|
|
|
test_autotest()
|
|
|
|
{
|
|
|
|
# Usage:
|
2014-07-28 02:15:40 -05:00
|
|
|
# test_autotest <test_name> <synth_script> <mod_name> <vlog_file>
|
2014-07-27 14:13:23 -05:00
|
|
|
|
|
|
|
test_name="$1"
|
2014-07-28 02:15:40 -05:00
|
|
|
synth_cmd="$2"
|
|
|
|
mod_name="$3"
|
|
|
|
vlog_file="$4"
|
2014-07-27 14:13:23 -05:00
|
|
|
|
|
|
|
mkdir -p log_test_$test_name
|
|
|
|
rm -rf log_test_$test_name/$mod_name.*
|
|
|
|
|
2014-07-28 02:15:40 -05:00
|
|
|
../../yosys -q -l log_test_$test_name/$mod_name.out -o log_test_$test_name/$mod_name.v -p "$synth_cmd" "$vlog_file"
|
|
|
|
cat spec/${mod_name}_spec.v scripts/check.v >> log_test_$test_name/$mod_name.v
|
|
|
|
iverilog -o log_test_$test_name/$mod_name.bin -D"REFDAT_FN=\"refdat/${mod_name}_refdat.txt\"" log_test_$test_name/$mod_name.v
|
2014-07-27 14:13:23 -05:00
|
|
|
|
2014-07-28 02:15:40 -05:00
|
|
|
if log_test_$test_name/$mod_name.bin 2>&1 | tee -a log_test_$test_name/$mod_name.out | grep -q '++OK++'; then
|
|
|
|
mv log_test_$test_name/$mod_name.out log_test_$test_name/$mod_name.txt
|
2014-07-27 14:13:23 -05:00
|
|
|
log_pass test_$test_name $mod_name
|
|
|
|
else
|
2014-07-28 02:15:40 -05:00
|
|
|
mv log_test_$test_name/$mod_name.out log_test_$test_name/$mod_name.err
|
2014-07-27 14:13:23 -05:00
|
|
|
log_fail test_$test_name $mod_name
|
2014-07-28 02:15:40 -05:00
|
|
|
exit 1
|
2014-07-27 14:13:23 -05:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-07-21 07:08:13 -05:00
|
|
|
test_equiv()
|
|
|
|
{
|
|
|
|
# Usage:
|
|
|
|
# test_equiv <test_name> <synth_script> <sat_options> <mod_name> <vlog_file>
|
|
|
|
|
|
|
|
mkdir -p log_test_$1
|
|
|
|
rm -f log_test_$1/$4.txt
|
|
|
|
rm -f log_test_$1/$4.err
|
|
|
|
|
|
|
|
if ! ../../yosys -q -l log_test_$1/$4.out - 2> /dev/null <<- EOT
|
|
|
|
read_verilog $5
|
|
|
|
proc;;
|
|
|
|
|
|
|
|
copy $4 gold
|
|
|
|
rename $4 work
|
|
|
|
|
|
|
|
cd work
|
|
|
|
$2
|
|
|
|
cd ..
|
|
|
|
|
2014-07-21 14:39:59 -05:00
|
|
|
miter -equiv -ignore_gold_x -make_outputs -make_outcmp gold work miter
|
|
|
|
flatten miter
|
2014-07-21 07:08:13 -05:00
|
|
|
sat $3 -verify -prove trigger 0 -show-inputs -show-outputs miter
|
|
|
|
EOT
|
|
|
|
then
|
|
|
|
log_fail test_$1 $4
|
|
|
|
mv log_test_$1/$4.out log_test_$1/$4.err
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
log_pass test_$1 $4
|
|
|
|
mv log_test_$1/$4.out log_test_$1/$4.txt
|
|
|
|
}
|
2015-05-17 12:54:00 -05:00
|
|
|
|
|
|
|
test_febe()
|
|
|
|
{
|
|
|
|
# Usage:
|
|
|
|
# test_febe <test_name> <synth_script> <extension> <backend> <frontend> <sat_options> <mod_name> <vlog_file>
|
|
|
|
# $1 $2 $3 $4 $5 $6 $7 $8
|
|
|
|
|
|
|
|
mkdir -p log_test_$1
|
|
|
|
rm -f log_test_$1/$7.txt
|
|
|
|
rm -f log_test_$1/$7.err
|
|
|
|
|
|
|
|
if ! ../../yosys -q -l log_test_$1/$7.out - 2> /dev/null <<- EOT
|
|
|
|
echo on
|
|
|
|
read_verilog $8
|
|
|
|
$2
|
|
|
|
design -save gold
|
|
|
|
dump
|
|
|
|
$4 log_test_$1/$7$3
|
|
|
|
design -reset
|
|
|
|
$5 log_test_$1/$7$3
|
|
|
|
|
|
|
|
design -copy-from gold -as gold $7
|
|
|
|
rename $7 gate
|
|
|
|
|
|
|
|
miter -equiv -flatten -ignore_gold_x -make_outputs -make_outcmp gold gate miter
|
|
|
|
sat $6 -verify -prove trigger 0 -show-inputs -show-outputs miter
|
|
|
|
EOT
|
|
|
|
then
|
|
|
|
log_fail test_$1 $7
|
|
|
|
mv log_test_$1/$7.out log_test_$1/$7.err
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
log_pass test_$1 $7
|
|
|
|
mv log_test_$1/$7.out log_test_$1/$7.txt
|
|
|
|
}
|