2014-07-18 06:25:19 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
2016-09-15 03:00:29 -05:00
|
|
|
|
|
|
|
OPTIND=1
|
|
|
|
seed="" # default to no seed specified
|
2019-06-27 21:54:09 -05:00
|
|
|
abcopt=""
|
|
|
|
while getopts "A:S:" opt
|
2016-09-15 03:00:29 -05:00
|
|
|
do
|
|
|
|
case "$opt" in
|
2019-06-27 21:54:09 -05:00
|
|
|
A) abcopt="-A $OPTARG" ;;
|
2020-09-16 12:58:16 -05:00
|
|
|
S) seed="$OPTARG" ;;
|
2016-09-15 03:00:29 -05:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift "$((OPTIND-1))"
|
|
|
|
|
2020-09-16 12:58:16 -05:00
|
|
|
${MAKE:-make} -f ../tools/autotest.mk SEED="$seed" EXTRA_FLAGS="$abcopt" *.v
|
2014-07-18 06:25:19 -05:00
|
|
|
|
2019-06-24 20:32:58 -05:00
|
|
|
for f in `egrep -l 'expect-(wr-ports|rd-ports|rd-clk)' *.v`; do
|
2014-07-18 06:25:19 -05:00
|
|
|
echo -n "Testing expectations for $f .."
|
|
|
|
../../yosys -qp "proc; opt; memory -nomap;; dump -outfile ${f%.v}.dmp t:\$mem" $f
|
|
|
|
if grep -q expect-wr-ports $f; then
|
2014-07-18 06:45:25 -05:00
|
|
|
grep -q "parameter \\\\WR_PORTS $(gawk '/expect-wr-ports/ { print $3; }' $f)\$" ${f%.v}.dmp ||
|
2014-07-18 06:25:19 -05:00
|
|
|
{ echo " ERROR: Unexpected number of write ports."; false; }
|
|
|
|
fi
|
|
|
|
if grep -q expect-rd-ports $f; then
|
2014-07-18 06:45:25 -05:00
|
|
|
grep -q "parameter \\\\RD_PORTS $(gawk '/expect-rd-ports/ { print $3; }' $f)\$" ${f%.v}.dmp ||
|
2014-07-18 06:25:19 -05:00
|
|
|
{ echo " ERROR: Unexpected number of read ports."; false; }
|
|
|
|
fi
|
2019-06-24 20:32:58 -05:00
|
|
|
if grep -q expect-rd-clk $f; then
|
|
|
|
grep -q "connect \\\\RD_CLK \\$(gawk '/expect-rd-clk/ { print $3; }' $f)\$" ${f%.v}.dmp ||
|
|
|
|
{ echo " ERROR: Unexpected read clock."; false; }
|
|
|
|
fi
|
2019-07-02 07:27:37 -05:00
|
|
|
if grep -q expect-no-rd-clk $f; then
|
|
|
|
grep -q "connect \\\\RD_CLK 1'x\$" ${f%.v}.dmp ||
|
|
|
|
{ echo " ERROR: Expected no read clock."; false; }
|
|
|
|
fi
|
2014-07-18 06:25:19 -05:00
|
|
|
echo " ok."
|
|
|
|
done
|
|
|
|
|