yosys/tests/memories/run-test.sh

41 lines
1.2 KiB
Bash
Raw Normal View History

2014-07-18 06:25:19 -05:00
#!/bin/bash
set -e
OPTIND=1
seed="" # default to no seed specified
abcopt=""
while getopts "A:S:" opt
do
case "$opt" in
A) abcopt="-A $OPTARG" ;;
2020-09-16 12:58:16 -05:00
S) seed="$OPTARG" ;;
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
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
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