diff --git a/tests/vloghtb/.gitignore b/tests/vloghtb/.gitignore index da1ffa41d..63db2fba3 100644 --- a/tests/vloghtb/.gitignore +++ b/tests/vloghtb/.gitignore @@ -5,3 +5,5 @@ scripts spec check_yosys vloghammer_tb.tar.bz2 +temp +log_test_* diff --git a/tests/vloghtb/common.sh b/tests/vloghtb/common.sh new file mode 100644 index 000000000..dc8aec086 --- /dev/null +++ b/tests/vloghtb/common.sh @@ -0,0 +1,7 @@ +log_pass() { + printf "%-15s %s %s %s\n" "$1" "$2" "`printf "%20s" "$2" | tr -d a-zA-Z0-9_ | tr ' ' .`" "pass." +} + +log_fail() { + printf "%-15s %s %s %s\n" "$1" "$2" "`printf "%20s" "$2" | tr -d a-zA-Z0-9_ | tr ' ' .`" "FAIL." +} diff --git a/tests/vloghtb/run-test.sh b/tests/vloghtb/run-test.sh index 9bef44502..6b3c26519 100755 --- a/tests/vloghtb/run-test.sh +++ b/tests/vloghtb/run-test.sh @@ -7,5 +7,6 @@ wget http://www.clifford.at/yosys/nogit/vloghammer_tb.tar.bz2 tar --strip=1 -xjf vloghammer_tb.tar.bz2 make clean -make -j4 YOSYS_BIN=$PWD/../../yosys YOSYS_SCRIPT="proc;;" check_yosys +make -j4 EXIT_ON_ERROR=1 YOSYS_BIN=$PWD/../../yosys YOSYS_SCRIPT="proc;;" check_yosys +make -j4 -f test_makefile MODE=share diff --git a/tests/vloghtb/test_makefile b/tests/vloghtb/test_makefile new file mode 100644 index 000000000..174dbbc2c --- /dev/null +++ b/tests/vloghtb/test_makefile @@ -0,0 +1,9 @@ + +MODE := share +TESTS := $(shell ls rtl/ | sed 's,\.v$$,,' ) + +run: $(addprefix log_test_$(MODE)/,$(addsuffix .txt,$(TESTS))) + +log_test_$(MODE)/%.txt: rtl/%.v + @bash test_$(MODE).sh $< + diff --git a/tests/vloghtb/test_share.sh b/tests/vloghtb/test_share.sh new file mode 100644 index 000000000..52b5a1428 --- /dev/null +++ b/tests/vloghtb/test_share.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +set -e +mkdir -p log_test_share +source common.sh + +f=$1 +n=$(basename ${f%.v}) + +rm -f log_test_share/$n.txt +rm -f log_test_share/$n.err + +if ! ../../yosys -q -l log_test_share/$n.out - 2> /dev/null <<- EOT + read_verilog $f + proc;; + + copy $n gold + rename $n work + + cd work + share -aggressive + cd .. + + miter -equiv -ignore_gold_x -make_outputs -make_outcmp gold work miter + flatten miter + sat -verify -prove trigger 0 -show-inputs -show-outputs miter +EOT +then + log_fail test_share $n + mv log_test_share/$n.out log_test_share/$n.err + exit 1 +fi + +log_pass test_share $n +mv log_test_share/$n.out log_test_share/$n.txt +exit 0 +