2023-08-11 20:59:39 -05:00
|
|
|
#!/usr/bin/env bash
|
2017-07-27 04:42:05 -05:00
|
|
|
|
2024-03-05 07:37:33 -06:00
|
|
|
set -e
|
2017-07-27 04:42:05 -05:00
|
|
|
|
2017-07-28 08:33:30 -05:00
|
|
|
prefix=${1%.ok}
|
|
|
|
prefix=${prefix%.sv}
|
|
|
|
prefix=${prefix%.vhd}
|
|
|
|
test -f $prefix.sv -o -f $prefix.vhd
|
2017-07-27 04:42:05 -05:00
|
|
|
|
|
|
|
generate_sby() {
|
|
|
|
cat <<- EOT
|
|
|
|
[options]
|
|
|
|
mode bmc
|
|
|
|
depth 10
|
|
|
|
expect $1
|
|
|
|
|
|
|
|
[engines]
|
|
|
|
smtbmc yices
|
|
|
|
|
|
|
|
[script]
|
|
|
|
EOT
|
|
|
|
|
2017-07-28 08:33:30 -05:00
|
|
|
if [ -f $prefix.sv ]; then
|
|
|
|
if [ "$1" = "fail" ]; then
|
2022-05-09 02:01:57 -05:00
|
|
|
echo "read -sv ${prefix}_fail.sv"
|
2017-07-28 08:33:30 -05:00
|
|
|
else
|
2022-05-09 02:01:57 -05:00
|
|
|
echo "read -sv $prefix.sv"
|
2017-07-28 08:33:30 -05:00
|
|
|
fi
|
2017-07-27 04:42:05 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f $prefix.vhd ]; then
|
2022-05-09 02:01:57 -05:00
|
|
|
echo "read -vhdl $prefix.vhd"
|
2017-07-27 04:42:05 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
cat <<- EOT
|
|
|
|
prep -top top
|
2018-02-18 09:35:06 -06:00
|
|
|
chformal -early -assume
|
2017-07-27 04:42:05 -05:00
|
|
|
|
|
|
|
[files]
|
|
|
|
EOT
|
|
|
|
|
2017-07-28 08:33:30 -05:00
|
|
|
if [ -f $prefix.sv ]; then
|
|
|
|
echo "$prefix.sv"
|
|
|
|
fi
|
|
|
|
|
2017-07-27 04:42:05 -05:00
|
|
|
if [ -f $prefix.vhd ]; then
|
|
|
|
echo "$prefix.vhd"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "fail" ]; then
|
|
|
|
cat <<- EOT
|
|
|
|
|
|
|
|
[file ${prefix}_fail.sv]
|
|
|
|
\`define FAIL
|
|
|
|
\`include "$prefix.sv"
|
|
|
|
EOT
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-05-09 08:04:01 -05:00
|
|
|
if [ -f $prefix.ys ]; then
|
2024-03-05 07:37:33 -06:00
|
|
|
set -x
|
2022-05-09 08:04:01 -05:00
|
|
|
$PWD/../../yosys -q -e "Assert .* failed." -s $prefix.ys
|
|
|
|
elif [ -f $prefix.sv ]; then
|
2017-07-28 08:33:30 -05:00
|
|
|
generate_sby pass > ${prefix}_pass.sby
|
|
|
|
generate_sby fail > ${prefix}_fail.sby
|
2024-03-05 07:37:33 -06:00
|
|
|
|
|
|
|
# Check that SBY is up to date enough for this yosys version
|
|
|
|
if sby --help | grep -q -e '--status'; then
|
|
|
|
set -x
|
|
|
|
sby --yosys $PWD/../../yosys -f ${prefix}_pass.sby
|
|
|
|
sby --yosys $PWD/../../yosys -f ${prefix}_fail.sby
|
|
|
|
else
|
|
|
|
echo "sva test '${prefix}' requires an up to date SBY, skipping"
|
|
|
|
fi
|
2017-07-28 08:33:30 -05:00
|
|
|
else
|
|
|
|
generate_sby pass > ${prefix}.sby
|
2024-03-05 07:37:33 -06:00
|
|
|
|
|
|
|
# Check that SBY is up to date enough for this yosys version
|
|
|
|
if sby --help | grep -q -e '--status'; then
|
|
|
|
set -x
|
|
|
|
sby --yosys $PWD/../../yosys -f ${prefix}.sby
|
|
|
|
else
|
|
|
|
echo "sva test '${prefix}' requires an up to date SBY, skipping"
|
|
|
|
fi
|
2017-07-28 08:33:30 -05:00
|
|
|
fi
|
2017-07-27 04:42:05 -05:00
|
|
|
|
2024-03-05 07:37:33 -06:00
|
|
|
{ set +x; } &>/dev/null
|
|
|
|
|
2017-07-27 04:42:05 -05:00
|
|
|
touch $prefix.ok
|
|
|
|
|