#!/usr/bin/env bash for i in $(seq 0 100); do echo "INFO: Run ${i}" dir="$(dirname "$(find /mnt/data/projects/verismith/runs/yosys_0.8/run_5 -name 'reduce*' -type f | shuf | head -1)")" dest="$(pwd)/run_${i}" interesting="${dest}/creduce/interesting.sh" vfile="${dest}/creduce/rtl.v" orig="$(pwd)" echo "INFO: Picked ${dir}" cp -r $dir $dest mkdir -p "${dest}/creduce" if [[ -f "${dest}/reduce_yosys.v" ]]; then echo "INFO: Detected crash" cat >$interesting <yosys.log 2>&1 grep "vector::_M_range_check:" yosys.log exit \$? EOF elif [[ -f "${dest}/reduce_identity_yosys.v" ]]; then echo "INFO: Detected mis-synthesis" cat >$interesting <yosys1.log 2>&1 || exit 1 grep -v "Warning: Resizing cell port" yosys1.log >yosys.log grep "Warning" yosys.log greturn=\$? if [[ \$greturn -eq 0 ]]; then exit 1; fi sed -i -E 's/((module[0-9]+)|top)/\1_2/' syn_yosys.v sed -E 's/((module[0-9]+)|top)/\1_1/' rtl.v >syn_identity.v sby -f proof.sby >symbiyosys.log 2>&1 grep "FAIL" symbiyosys.log >/dev/null 2>&1 || exit 1 exit 0 EOF else echo "WARNING: No original reduction found" continue fi cp "${dest}/identity/syn_identity.v" "$vfile" chmod +x "$interesting" cd "${dest}/creduce" time creduce --abs-timing --no-c ./interesting.sh rtl.v >creduce.log cd "${orig}" echo "INFO: Done" done