Various improvements in test/vloghtb
authorClifford Wolf <clifford@clifford.at>
Mon, 21 Jul 2014 12:08:13 +0000 (14:08 +0200)
committerClifford Wolf <clifford@clifford.at>
Mon, 21 Jul 2014 12:40:57 +0000 (14:40 +0200)
tests/vloghtb/common.sh
tests/vloghtb/run-test.sh
tests/vloghtb/test_mapopt.sh [new file with mode: 0644]
tests/vloghtb/test_share.sh

index dc8aec086f6382070a2d29ae62f10c7c93b5ff70..704afdd989c8220ec01d6b9174b5ee47c4b79853 100644 (file)
@@ -1,7 +1,42 @@
-log_pass() {
+log_pass()
+{
        printf "%-15s %s %s %s\n" "$1" "$2" "`printf "%20s" "$2" | tr -d a-zA-Z0-9_ | tr ' ' .`" "pass."
 }
 
-log_fail() {
+log_fail()
+{
        printf "%-15s %s %s %s\n" "$1" "$2" "`printf "%20s" "$2" | tr -d a-zA-Z0-9_ | tr ' ' .`" "FAIL."
 }
+
+test_equiv()
+{
+       # Usage:
+       # test_equiv <test_name> <synth_script> <sat_options> <mod_name> <vlog_file>
+
+       mkdir -p log_test_$1
+       rm -f log_test_$1/$4.txt
+       rm -f log_test_$1/$4.err
+
+       if ! ../../yosys -q -l log_test_$1/$4.out - 2> /dev/null <<- EOT
+               read_verilog $5
+               proc;;
+
+               copy $4 gold
+               rename $4 work
+
+               cd work
+               $2
+               cd ..
+
+               miter -equiv -flatten -ignore_gold_x -make_outputs -make_outcmp gold work miter
+               sat $3 -verify -prove trigger 0 -show-inputs -show-outputs miter
+       EOT
+       then
+               log_fail test_$1 $4
+               mv log_test_$1/$4.out log_test_$1/$4.err
+               exit 1
+       fi
+
+       log_pass test_$1 $4
+       mv log_test_$1/$4.out log_test_$1/$4.txt
+}
index 0e01fd6467ae44622b6dea39005c98402a0c344a..3b8a3e9e2ddd689c2dc8e95544d0d8689b82442c 100755 (executable)
@@ -7,8 +7,9 @@ wget http://www.clifford.at/yosys/nogit/vloghammer_tb.tar.bz2
 tar --strip=1 -xjf vloghammer_tb.tar.bz2
 
 make clean
-make -j4 EXIT_ON_ERROR=1 YOSYS_BIN=$PWD/../../yosys YOSYS_SCRIPT="proc;;" check_yosys
-
 rm -rf log_test_*
+
+make -j4 EXIT_ON_ERROR=1 YOSYS_BIN=$PWD/../../yosys YOSYS_SCRIPT="proc;;" check_yosys
 make -j4 -f test_makefile MODE=share
+make -j4 -f test_makefile MODE=mapopt
 
diff --git a/tests/vloghtb/test_mapopt.sh b/tests/vloghtb/test_mapopt.sh
new file mode 100644 (file)
index 0000000..9099e2b
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -e
+source common.sh
+
+f=$1
+n=$(basename ${f%.v})
+
+test_equiv mapopt "opt; techmap; opt" "-set-def-inputs" $n $f
+
+exit 0
index 88e0428172fcc0ffd8d160cbd234f586b79f5f64..da22116243f161dbe5c0cd4807995d06018773b5 100644 (file)
@@ -1,36 +1,11 @@
 #!/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
+test_equiv share "share -aggressive" "-ignore_div_by_zero" $n $f
 
-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 -flatten -ignore_gold_x -make_outputs -make_outcmp gold work miter
-       sat -set-def-inputs -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
-