blob: a67de6ad77bef6a2815746c255002ec6d870df0e [file] [log] [blame] [edit]
#!/bin/bash
path=$1
# This assumes that all these files exist
tritonRoute_log="${path}/logs/routing/tritonRoute.log"
yosys_rprt=${path}/reports/synthesis/yosys_*.stat.rpt
runtime_rpt=${path}/reports/runtime.txt
wns_rpt=${path}/reports/synthesis/opensta_wns.rpt
HPWL_rpt=${path}/reports/placement/replace_hpwl.rpt
yosys_log=${path}/logs/synthesis/yosys.log
cell_count=$(cat ${yosys_rprt} | grep "cells" | sed -r 's/.*[^0-9]//')
if ! [[ $cell_count ]]; then cell_count=-1; fi
runtime=$(sed 's/.*in //' $runtime_rpt)
if ! [[ $runtime ]]; then runtime=-1; fi
violations=$(grep "number of violations" $tritonRoute_log | tail -1 | sed -r 's/.*[^0-9]//')
if ! [[ $violations ]]; then violations=-1; fi
wire_length=$(grep "total wire length =" $tritonRoute_log | tail -1 | sed -r 's/[^0-9]*//g')
if ! [[ $wire_length ]]; then wire_length=-1; fi
vias=$(grep "total number of vias =" $tritonRoute_log | tail -1 | sed -r 's/[^0-9]*//g')
if ! [[ $vias ]]; then vias=-1; fi
wns=$(grep "wns" $wns_rpt | sed -r 's/wns //')
if ! [[ $wns ]]; then wns=-1; fi
hpwl=$(cat $HPWL_rpt)
if ! [[ $hpwl ]]; then hpwl=-1; fi
declare -a metrics=(
"Number of wire bits:"
"Number of public wire bits:"
"Number of cells:"
"\$_DFF_"
"\$_XOR"
"\$_XNOR"
"\$_MUX"
)
metrics_vals=()
for metric in "${metrics[@]}"; do
val=$(grep " \+${metric}[^0-9]\+ \+[0-9]\+" $yosys_log | head -1 | sed -r 's/.*[^0-9]([0-9]+)$/\1/')
if ! [[ $val ]]; then val=-1; fi
metrics_vals+=("$val")
done
input_output=$(grep -e "ABC: netlist" $yosys_log | sed -r 's/ABC: netlist[^0-9]*([0-9]+)\/ *([0-9]+).*/\1 \2/')
if ! [[ $input_output ]]; then input_output="-1 -1"; fi
level=$(grep -e "ABC: netlist" $yosys_log | sed -r 's/.*lev.*[^0-9]([0-9]+)$/\1/')
if ! [[ $input_output ]]; then input_output="-1 -1"; fi
result="$runtime $cell_count $violations $wire_length $vias $wns $hpwl"
for val in "${metrics_vals[@]}"; do
result+=" $val"
done
result+=" $input_output"
result+=" $level"
echo "$result"