Skip to content

Commit 917f62d

Browse files
committed
First benchmark scripts for the Sat attack
1 parent 0f580f4 commit 917f62d

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

test/run_sat_attack.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
3+
dirs="sat_attack"
4+
5+
cd benchmarks
6+
7+
for dir in $dirs
8+
do
9+
mkdir -p "${dir}"
10+
done
11+
12+
function run_benchmark () {
13+
benchmark=$1
14+
name=$(basename "${benchmark}" .blif)
15+
echo "Running benchmark ${name}"
16+
log_file="sat_attack/${name}.log"
17+
script_file="scripts/${name}.ys"
18+
echo "read_blif -sop ${benchmark}" > "${script_file}"
19+
echo "flatten; synth" >> "${script_file}"
20+
# Apply the locking
21+
echo "logic_locking -key-bits 64 -key 555555555555555555555555555555555555555" >> "${script_file}"
22+
# Sat attack
23+
echo "ll_sat_attack -time-limit 10 -key 555555555555555555555555555555555555555" >> "${script_file}"
24+
cmd="timeout 600 yosys -m moosic -s ${script_file} > ${log_file}"
25+
eval "$cmd" && { echo "Finished ${name}"; } || { echo "Failure on ${name}: ${cmd}"; }
26+
}
27+
28+
if [ "$1" = "-all" ]
29+
then
30+
echo "Executing full benchmark set"
31+
for benchmark in blif/iscas85*.blif blif/iscas89*.blif blif/iscas99*.blif blif/lgsynth*.blif blif/mcnc*.blif blif/epfl*.blif
32+
do
33+
run_benchmark "${benchmark}"
34+
done
35+
wait
36+
elif [ "$1" != "" ]
37+
then
38+
echo "Invalid argument; only -all is accepted"
39+
exit 1
40+
else
41+
echo "Executing small benchmark set"
42+
for benchmark in blif/iscas85*.blif
43+
do
44+
run_benchmark "${benchmark}"
45+
done
46+
fi
47+
48+
cd ..
49+
tar -c benchmarks/sat_attack | xz -9 - > sat_attack.tar.xz

0 commit comments

Comments
 (0)