Add tests

This commit is contained in:
Eddie Hung 2019-02-04 16:46:24 -08:00
parent 266511b29e
commit 3f0bb441f8
16 changed files with 109 additions and 8 deletions

5
tests/aig/and.aag Normal file
View File

@ -0,0 +1,5 @@
aag 3 2 0 1 1
2
4
6
6 2 4

3
tests/aig/buffer.aag Normal file
View File

@ -0,0 +1,3 @@
aag 1 1 0 1 0
2
2

3
tests/aig/cnt1.aag Normal file
View File

@ -0,0 +1,3 @@
aag 1 0 1 0 0 1
2 3
2

8
tests/aig/cnt1e.aag Normal file
View File

@ -0,0 +1,8 @@
aag 5 1 1 0 3 1
2
4 10
4
6 5 3
8 4 2
10 9 7
b0 AIGER_NEVER

1
tests/aig/empty.aag Normal file
View File

@ -0,0 +1 @@
aag 0 0 0 0 0

2
tests/aig/false.aag Normal file
View File

@ -0,0 +1,2 @@
aag 0 0 0 1 0
0

14
tests/aig/halfadder.aag Normal file
View File

@ -0,0 +1,14 @@
aag 7 2 0 2 3
2
4
6
12
6 13 15
12 2 4
14 3 5
i0 x
i1 y
o0 s
o1 c
c
half adder

3
tests/aig/inverter.aag Normal file
View File

@ -0,0 +1,3 @@
aag 1 1 0 1 0
2
3

4
tests/aig/notcnt1.aag Normal file
View File

@ -0,0 +1,4 @@
aag 1 0 1 0 0 1
2 3
3
b0 AIGER_NEVER

8
tests/aig/notcnt1e.aag Normal file
View File

@ -0,0 +1,8 @@
aag 5 1 1 0 3 1
2
4 10
5
6 5 3
8 4 2
10 9 7
b0 AIGER_NEVER

5
tests/aig/or.aag Normal file
View File

@ -0,0 +1,5 @@
aag 3 2 0 1 1
2
4
7
6 3 5

20
tests/aig/run-test.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
OPTIND=1
seed="" # default to no seed specified
while getopts "S:" opt
do
case "$opt" in
S) arg="${OPTARG#"${OPTARG%%[![:space:]]*}"}" # remove leading space
seed="SEED=$arg" ;;
esac
done
shift "$((OPTIND-1))"
# check for Icarus Verilog
if ! which iverilog > /dev/null ; then
echo "$0: Error: Icarus Verilog 'iverilog' not found."
exit 1
fi
exec ${MAKE:-make} -f ../tools/autotest.mk $seed *.aag EXTRA_FLAGS="-f aiger"

14
tests/aig/toggle-re.aag Normal file
View File

@ -0,0 +1,14 @@
aag 7 2 1 2 4
2
4
6 8
6
7
8 4 10
10 13 15
12 2 6
14 3 7
i0 enable
i1 reset
o0 Q
o1 !Q

4
tests/aig/toggle.aag Normal file
View File

@ -0,0 +1,4 @@
aag 1 0 1 2 0
2 3
2
3

2
tests/aig/true.aag Normal file
View File

@ -0,0 +1,2 @@
aag 0 0 0 1 0
1

View File

@ -86,8 +86,9 @@ shift $((OPTIND - 1))
for fn
do
bn=${fn%.v}
if [ "$bn" == "$fn" ]; then
bn=${fn%.*}
ext=${fn##*.}
if [[ "$ext" != "v" ]] && [[ "$ext" != "aag" ]]; then
echo "Invalid argument: $fn" >&2
exit 1
fi
@ -109,10 +110,14 @@ do
fn=$(basename $fn)
bn=$(basename $bn)
egrep -v '^\s*`timescale' ../$fn > ${bn}_ref.v
if [[ "$ext" == "v" ]]; then
egrep -v '^\s*`timescale' ../$fn > ${bn}_ref.${ext}
else
cp ../$fn ${bn}_ref.${ext}
fi
if [ ! -f ../${bn}_tb.v ]; then
"$toolsdir"/../../yosys -f "$frontend $include_opts" -b "test_autotb $autotb_opts" -o ${bn}_tb.v ${bn}_ref.v
"$toolsdir"/../../yosys -f "$frontend $include_opts" -b "test_autotb $autotb_opts" -o ${bn}_tb.v ${bn}_ref.${ext}
else
cp ../${bn}_tb.v ${bn}_tb.v
fi
@ -138,16 +143,16 @@ do
fi
if [ -n "$scriptfiles" ]; then
test_passes -f "$frontend $include_opts" ${bn}_ref.v $scriptfiles
test_passes -f "$frontend $include_opts" ${bn}_ref.${ext} $scriptfiles
elif [ -n "$scriptopt" ]; then
test_passes -f "$frontend $include_opts" -p "$scriptopt" ${bn}_ref.v
test_passes -f "$frontend $include_opts" -p "$scriptopt" ${bn}_ref.${ext}
elif [ "$frontend" = "verific" ]; then
test_passes -p "verific -vlog2k ${bn}_ref.v; verific -import -all; opt; memory;;"
elif [ "$frontend" = "verific_gates" ]; then
test_passes -p "verific -vlog2k ${bn}_ref.v; verific -import -gates -all; opt; memory;;"
else
test_passes -f "$frontend $include_opts" -p "hierarchy; proc; opt; memory; opt; fsm; opt -full -fine" ${bn}_ref.v
test_passes -f "$frontend $include_opts" -p "hierarchy; synth -run coarse; techmap; opt; abc -dff" ${bn}_ref.v
test_passes -f "$frontend $include_opts" -p "hierarchy; proc; opt; memory; opt; fsm; opt -full -fine" ${bn}_ref.${ext}
test_passes -f "$frontend $include_opts" -p "hierarchy; synth -run coarse; techmap; opt; abc -dff" ${bn}_ref.${ext}
fi
touch ../${bn}.log
}