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 .."
|
2021-05-27 13:54:29 -05:00
|
|
|
../../yosys -qp "proc; opt; memory -nomap;; dump -outfile ${f%.v}.dmp t:\$mem_v2" $f
|
2014-07-18 06:25:19 -05:00
|
|
|
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
|
2021-05-29 10:45:05 -05:00
|
|
|
if grep -q expect-wr-wide-continuation $f; then
|
|
|
|
grep -q "parameter \\\\WR_WIDE_CONTINUATION $(gawk '/expect-wr-wide-continuation/ { print $3; }' $f)\$" ${f%.v}.dmp ||
|
|
|
|
{ echo " ERROR: Unexpected write wide continuation."; false; }
|
|
|
|
fi
|
2014-07-18 06:25:19 -05:00
|
|
|
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
|
2021-05-27 14:08:11 -05:00
|
|
|
if grep -q expect-rd-en $f; then
|
|
|
|
grep -q "connect \\\\RD_EN \\$(gawk '/expect-rd-en/ { print $3; }' $f)\$" ${f%.v}.dmp ||
|
|
|
|
{ echo " ERROR: Unexpected read enable."; false; }
|
|
|
|
fi
|
|
|
|
if grep -q expect-rd-srst-sig $f; then
|
|
|
|
grep -q "connect \\\\RD_SRST \\$(gawk '/expect-rd-srst-sig/ { print $3; }' $f)\$" ${f%.v}.dmp ||
|
|
|
|
{ echo " ERROR: Unexpected read sync reset."; false; }
|
|
|
|
fi
|
|
|
|
if grep -q expect-rd-srst-val $f; then
|
|
|
|
grep -q "parameter \\\\RD_SRST_VALUE $(gawk '/expect-rd-srst-val/ { print $3; }' $f)\$" ${f%.v}.dmp ||
|
|
|
|
{ echo " ERROR: Unexpected read sync reset value."; false; }
|
|
|
|
fi
|
|
|
|
if grep -q expect-rd-arst-sig $f; then
|
|
|
|
grep -q "connect \\\\RD_ARST \\$(gawk '/expect-rd-arst-sig/ { print $3; }' $f)\$" ${f%.v}.dmp ||
|
|
|
|
{ echo " ERROR: Unexpected read async reset."; false; }
|
|
|
|
fi
|
|
|
|
if grep -q expect-rd-arst-val $f; then
|
|
|
|
grep -q "parameter \\\\RD_ARST_VALUE $(gawk '/expect-rd-arst-val/ { print $3; }' $f)\$" ${f%.v}.dmp ||
|
|
|
|
{ echo " ERROR: Unexpected read async reset value."; false; }
|
|
|
|
fi
|
|
|
|
if grep -q expect-rd-init-val $f; then
|
|
|
|
grep -q "parameter \\\\RD_INIT_VALUE $(gawk '/expect-rd-init-val/ { print $3; }' $f)\$" ${f%.v}.dmp ||
|
|
|
|
{ echo " ERROR: Unexpected read init value."; false; }
|
|
|
|
fi
|
2021-05-29 10:45:05 -05:00
|
|
|
if grep -q expect-rd-wide-continuation $f; then
|
|
|
|
grep -q "parameter \\\\RD_WIDE_CONTINUATION $(gawk '/expect-rd-wide-continuation/ { print $3; }' $f)\$" ${f%.v}.dmp ||
|
|
|
|
{ echo " ERROR: Unexpected read wide continuation."; 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
|
|
|
|
|