From b67ff3a6bd1db46bb182855337aaa983bf5e53c2 Mon Sep 17 00:00:00 2001 From: Mikael Henriksson <mikael.henriksson@liu.se> Date: Tue, 13 Oct 2020 11:25:15 +0200 Subject: [PATCH] Added automatic CSV generation. --- sweep.bash | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/sweep.bash b/sweep.bash index 4b83ec0..9e56da5 100755 --- a/sweep.bash +++ b/sweep.bash @@ -39,6 +39,11 @@ CLOCK_NAME="clk" # idealy be set to min{ Computer Cores, Design Compiler Licenses }. MAX_CONCURRENCY=4 +# Resulting units. These will be used for the generated CSV files. +PERIOD_DIM="ns" +POWER_DIM="uW" +AREA_DIM="um^2" + # # ----------------------- # End of global settings. @@ -122,3 +127,48 @@ done # Launch workers according to the max concurrency with xargs. printf "${SYNTH_DIRS%?}" | xargs -L1 -d "|" --max-procs="$MAX_CONCURRENCY" sh ./run_synth.sh + +# +# Generate design CSV files from result. +# +echo "Generating CSV from each design sweept:" +for design_generics in "${GENERICS[@]}"; do + echo " * Design: '$design_generics'" + WORK_DIR="$TOP_DIR/$design_generics" + OUTPUT_FILE="$WORK_DIR/result.csv" + touch "$OUTPUT_FILE" + sub_dirs=$(grep -ri --files-without-match "violated" $WORK_DIR/*/timing.txt | awk -F"/" '{printf("%s\n", $3)}' | sort -rh) + + # Write CSV header. + echo "Period ($PERIOD_DIM), Area ($AREA_DIM), Power ($POWER_DIM)" > "$OUTPUT_FILE" + + # Iterate over successful synthesised results, which had it's timing constraints met. + while IFS='' read -r period; do + # Extract data. + power=$(awk '/Total /{print $(NF-1)}' "$WORK_DIR/$period/power.txt") + area=$(awk '/Total cell area:/{print $NF}' "$WORK_DIR/$period/area.txt") + + # Append to CSV. + echo "$period, $area, $power" >> "$OUTPUT_FILE" + done <<< "$sub_dirs" +done + +# +# Compile all CSV files into one top CSV result file. +# +TOP_RESULT="$TOP_DIR/result.csv" +echo "Compiling CSV results into '$TOP_RESULT'." +touch "$TOP_RESULT" + +# Generate top CSV header. +echo "Design, Period ($PERIOD_DIM), Area ($AREA_DIM), Power ($POWER_DIM)" > "$TOP_RESULT" + +# Append results from design sweeps. +for design_generics in "${GENERICS[@]}"; do + WORK_DIR="$TOP_DIR/$design_generics" + tail --lines=+2 "$WORK_DIR/result.csv" | sed "s/^\(.*\)/$design_generics, \1/" >> "$TOP_RESULT" +done + +# Script finished. +echo "Sweep finished." + -- GitLab