From d544bbfe21cccede728c99141cca7f8cced4bd7e Mon Sep 17 00:00:00 2001 From: Mikael Henriksson <mike.zx@hotmail.com> Date: Wed, 15 Sep 2021 09:51:48 +0200 Subject: [PATCH] Added support for conditionaly excluding sweep ponits with negative slack (UNTESTED). --- sweep.bash | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/sweep.bash b/sweep.bash index b75735c..0048b87 100755 --- a/sweep.bash +++ b/sweep.bash @@ -63,7 +63,7 @@ MAX_CONCURRENCY=12 WAIT_FOR_LICENSE="YES" # String that will be appended to the top sweep directory name. Could, for -# example, be used to append technology, corrner or other vital info to the +# example, be used to append technology, corrner or other vital info to the # sweep directory name. Leave blank if unused. TOP_DIR_APPEND="" @@ -82,15 +82,19 @@ AREA_DIM="um^2" # Generate a CSV sweep result file from a sweep result. Only the sweeps whose # slack where not violated are extracted. function sweep_to_csv() { - local data_dir="${1}" + local sweep_data_dir="${1}" local csv_out="${2}" - # Extract non-slack violated resulting subdirectories and periods. - local non_violated_dirs - local periods - non_violated_dirs=$(grep -riL "(VIOLATED)" "${data_dir}"/*/timing.txt) - periods=$(perl -C -lne 'print for /(\d+\.\d+?)\/timing\.txt/ig' <<< \ - "${non_violated_dirs}" | sort -rh) + local timing_files + if [ "${EXCLUDE_NEGATIVE_SLACK}" -eq "YES" ]; then + # Extract non-slack violated 'timing.txt' files. + timing_files=$(grep -riL "(VIOLATED)" "${sweep_data_dir}"/*/timing.txt) + else # ${EXCLUDE_NEGATIVE_SLACK} -eq "NO" + # Extract all all 'timing.txt' files. + timing_files=$(echo "${sweep_data_dir}"/*/timing.txt) + fi + local periods=$(perl -C -lne 'print for /(\d+\.\d+?)\/timing\.txt/ig' <<< \ + "${timing_files}" | sort -rh) # Create CSV file and write CSV header. touch "${csv_out}" @@ -101,7 +105,7 @@ function sweep_to_csv() { # constraints met. while IFS='' read -r period; do # Extract data. - cur_dir="${data_dir}/${period}" + cur_dir="${sweep_data_dir}/${period}" power=$(awk '/Total\s+[0-9\.e-]+\s[a-z]{0,1}W/{print $(NF-1)}' \ "${cur_dir}/power.txt") area=$(awk '/Total cell area:/{print $NF}' "${cur_dir}/area.txt") @@ -227,12 +231,15 @@ for file in "${DESIGN_FILES[@]}"; do exit 1 fi done +if [[ "${EXCLUDE_NEGATIVE_SLACK}" ~= ^(YES)|(NO)$ ]]; then + echo "Error: \${EXCLUDE_NEGATIVE_SLACK} not in { 'YES', 'NO' };" +fi if ! [[ "$RETIME_ENABLE" =~ ^(YES)|(NO)$ ]]; then - echo "Error: \$RETIME_ENABLE not in { "YES", "NO" }." + echo "Error: \$RETIME_ENABLE not in { 'YES', 'NO' }." exit 1 fi if ! [[ "${WAIT_FOR_LICENSE}" =~ ^(YES)|(NO)$ ]]; then - echo "Error: \$WAIT_FOR_LICENSE not in { "YES", "NO" }." + echo "Error: \$WAIT_FOR_LICENSE not in { 'YES', 'NO' }." exit 1 fi -- GitLab