summaryrefslogtreecommitdiff
path: root/tests/memories/run-test.sh
blob: eccd401009314b018006e7f5ac123a0cb7434d3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

set -e
bash ../tools/autotest.sh -G *.v

for f in `egrep -l 'expect-(wr|rd)-ports' *.v`; do
	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
		grep -q "parameter \\\\WR_PORTS $(gawk '/expect-wr-ports/ { print $3; }' amber23_sram_byte_en.v)\$" amber23_sram_byte_en.dmp ||
				{ echo " ERROR: Unexpected number of write ports."; false; }
	fi
	if grep -q expect-rd-ports $f; then
		grep -q "parameter \\\\RD_PORTS $(gawk '/expect-rd-ports/ { print $3; }' amber23_sram_byte_en.v)\$" amber23_sram_byte_en.dmp ||
				{ echo " ERROR: Unexpected number of read ports."; false; }
	fi
	echo " ok."
done