Skip to content

Commit efdadeb

Browse files
committed
ebmc: benchmarking in CI
This runs the HWMCC 2008 competition benchmarks in CI, using the results by abc as expected outcome.
1 parent bd5891b commit efdadeb

File tree

2 files changed

+107
-0
lines changed

2 files changed

+107
-0
lines changed

.github/workflows/pull-request-checks.yaml

+34
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,40 @@ jobs:
105105
run: make -C regression/verilog test-z3
106106
- name: Print ccache stats
107107
run: ccache -s
108+
- name: Upload the ebmc binary
109+
uses: actions/upload-artifact@v4
110+
with:
111+
name: ebmc-binary
112+
retention-days: 5
113+
path: src/ebmc/ebmc
114+
115+
# This job takes approximately 4 minutes
116+
benchmarking:
117+
runs-on: ubuntu-20.04
118+
needs: check-ubuntu-20_04-make-clang
119+
steps:
120+
- uses: actions/checkout@v4
121+
with:
122+
submodules: recursive
123+
- name: Fetch dependencies
124+
env:
125+
# This is needed in addition to -yq to prevent apt-get from asking for
126+
# user input
127+
DEBIAN_FRONTEND: noninteractive
128+
run: |
129+
sudo apt-get update
130+
sudo apt-get install --no-install-recommends z3
131+
- name: Confirm z3 solver is available and log the version installed
132+
run: z3 --version
133+
- name: Get the ebmc binary
134+
uses: actions/download-artifact@v4
135+
with:
136+
name: ebmc-binary
137+
path: ebmc
138+
- name: Try the ebmc binary
139+
run: chmod a+x ./ebmc/ebmc ; ./ebmc/ebmc --version
140+
- name: HWMCC08 benchmarks
141+
run: PATH=$PATH:$PWD/ebmc benchmarking/hwmcc08.sh
108142

109143
# This job takes approximately 15 minutes
110144
check-centos8-make-gcc:

benchmarking/hwmcc08.sh

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/sh
2+
3+
# This runs ebmc in BMC mode on the HWMCC08 benchmarks.
4+
5+
if [ ! -e aiger/. ] ; then
6+
echo Downloading and building the AIGER tools
7+
git clone https://github.com/arminbiere/aiger
8+
(cd aiger ; ./configure.sh ; make aigtosmv )
9+
fi
10+
11+
if [ ! -e hwmcc08/. ] ; then
12+
echo Downloading HWMCC08 benchmark archive
13+
wget -q http://fmv.jku.at/hwmcc/hwmcc08public.tar.bz2
14+
bunzip2 hwmcc08public.tar.bz2
15+
tar xf hwmcc08public.tar
16+
rm hwmcc08public.tar
17+
fi
18+
19+
if [ ! -e hwmcc08public-smv/. ] ; then
20+
echo Converting AIGER to SMV
21+
mkdir hwmcc08public-smv
22+
(cd hwmcc08; for FILE in *.aig ; do
23+
SMV=`echo "$FILE" | sed s/.aig/.smv/`
24+
../aiger/aigtosmv -b "$FILE" "../hwmcc08public-smv/$SMV"
25+
done)
26+
fi
27+
28+
# expected answers
29+
# from the abc result column in https://fmv.jku.at/hwmcc08/hwmcc08results.csv
30+
31+
if [ ! -e hwmcc08results.csv ] ; then
32+
echo Downloading HWMCC08 result table
33+
wget -q https://fmv.jku.at/hwmcc08/hwmcc08results.csv
34+
fi
35+
36+
echo Running ebmc on the HWMCC08 benchmarks
37+
38+
(# ignore first three lines of hwmcc08results.csv
39+
read -r line
40+
read -r line
41+
read -r line
42+
# now process the lines
43+
while read -r line; do
44+
BENCHMARK=` echo "$line" | cut -d ',' -f 1 | tr -d '"'`
45+
if [ ! -e "hwmcc08public-smv/${BENCHMARK}.smv" ] ; then
46+
echo benchmark $BENCHMARK not found
47+
else
48+
RESULT=` echo "$line" | cut -d ',' -f 3 | tr -d '"'`
49+
if [ "$RESULT" = "uns" ] ; then
50+
ebmc --bound 2 "hwmcc08public-smv/${BENCHMARK}.smv" > ebmc.out
51+
if [ $? = 10 ] ; then
52+
echo $BENCHMARK: got unexpected counterexample
53+
exit 1
54+
else
55+
echo $BENCHMARK: ok "(UNSAT)"
56+
fi
57+
fi
58+
if [ "$RESULT" = "sat" ] ; then
59+
LENGTH=` echo "$line" | cut -d ',' -f 2`
60+
if [ "$LENGTH" = "\"*\"" ] ; then
61+
echo $BENCHMARK: no counterexample length
62+
else
63+
ebmc --bound $LENGTH "hwmcc08public-smv/${BENCHMARK}.smv" > ebmc.out
64+
if [ $? = 10 ] ; then
65+
echo $BENCHMARK: ok "(SAT $LENGTH)"
66+
else
67+
echo $BENCHMARK: failed to find counterexample at bound $LENGTH
68+
exit 1
69+
fi
70+
fi
71+
fi
72+
fi
73+
done ) < hwmcc08results.csv

0 commit comments

Comments
 (0)