diff --git a/evaluation/scripts/README.txt b/evaluation/scripts/README.txt index 79cbc558..908b0147 100644 --- a/evaluation/scripts/README.txt +++ b/evaluation/scripts/README.txt @@ -5,16 +5,19 @@ Description: Makes the build in the opae directory with the specified core exists, a make clean command is ran before the build. Script waits until the inteldev script or quartus program is finished running. -Usage: ./build.sh -c [1|2|4|8|16] [-p [y|n]] +Usage: ./build.sh -c [1|2|4|8|16] [-p perf] [-w wait] Options: -c Core count (1, 2, 4, 8, or 16). -p - Performance profiling enable (y or n). Changes the source file in the + Performance profiling enable. Changes the source file in the opae directory to include/exclude "+define+PERF_ENABLE". + -w + Wait for the build to complete + _______________________________________________________________________________ diff --git a/evaluation/scripts/build.sh b/evaluation/scripts/build.sh index abb646f1..21b9f345 100755 --- a/evaluation/scripts/build.sh +++ b/evaluation/scripts/build.sh @@ -1,10 +1,23 @@ #!/bin/bash -while getopts c:p: flag +BUILD_DIR=../../hw/syn/opae + +perf=0 +wait=0 + +while getopts c:pwh flag do case "${flag}" in c) cores=${OPTARG};; #1, 2, 4, 8, 16 - p) perf=${OPTARG};; #perf counters enable (y/n) + p) perf=1;; #perf counters enable + w) wait=1;; # wait for build to complete + h) echo "Usage: -c [-p perf] [-w wait] [-h help]" + exit 0 + ;; + \?) + echo "Invalid option: -$OPTARG" 1>&2 + exit 1 + ;; esac done @@ -13,25 +26,22 @@ if [[ ! "$cores" =~ ^(1|2|4|8|16)$ ]]; then exit 1 fi -cd ../../hw/syn/opae +cd ${BUILD_DIR} sources_file="./sources_${cores}c.txt" -if [ ${perf:0:1} = "n" ]; then - if grep -v '^ *#' ${sources_file} | grep -Fxq '+define+SYNTHESIS'; then - sed -i 's/+define+PERF_ENABLE/#+define+PERF_ENABLE/' ${sources_file} - elif ! grep -Fxq '#+define+PERF_ENABLE' ${sources_file}; then - sed -i '1s/^/#+define+PERF_ENABLE\n/' ${sources_file} - fi -elif [ ${perf:0:1} = "y" ]; then +if [ ${perf} = 1 ]; then if grep -Fxq '#+define+PERF_ENABLE' ${sources_file}; then sed -i 's/+define+PERF_ENABLE/#+define+PERF_ENABLE/' ${sources_file} elif ! grep -Fxq '+define+PERF_ENABLE' ${sources_file}; then sed -i '1s/^/+define+PERF_ENABLE\n/' ${sources_file} fi else - echo 'Invalid parameter for argument -p (y/n expected)' - exit 1 + if grep -v '^ *#' ${sources_file} | grep -Fxq '+define+SYNTHESIS'; then + sed -i 's/+define+PERF_ENABLE/#+define+PERF_ENABLE/' ${sources_file} + elif ! grep -Fxq '#+define+PERF_ENABLE' ${sources_file}; then + sed -i '1s/^/#+define+PERF_ENABLE\n/' ${sources_file} + fi fi if [ -d "./build_fpga_{$cores}c" ]; then @@ -39,12 +49,12 @@ if [ -d "./build_fpga_{$cores}c" ]; then fi make "fpga-${cores}c" -sleep 30 - -pids=($(pgrep -f "${OPAE_PLATFORM_ROOT}|quartus")) -for pid in ${pids[@]}; do - while kill -0 ${pid} 2> /dev/null; do - sleep 30 +if [ ${wait} = 1 ]; then + sleep 30 + pids=($(pgrep -f "${OPAE_PLATFORM_ROOT}|quartus")) + for pid in ${pids[@]}; do + while kill -0 ${pid} 2> /dev/null; do + sleep 30 + done done -done - +fi diff --git a/evaluation/scripts/build_all_perf.sh b/evaluation/scripts/build_all_perf.sh index ffcfa211..336bb49e 100755 --- a/evaluation/scripts/build_all_perf.sh +++ b/evaluation/scripts/build_all_perf.sh @@ -2,6 +2,6 @@ for ((i=1; i <= 16; i=i*2)); do echo "Building ${i} core build..." - ./build.sh -c ${i} -p y + ./build.sh -c ${i} -p -w echo "Done ${i} core build." done diff --git a/hw/syn/opae/sources_1c.txt b/hw/syn/opae/sources_1c.txt index a429a492..ea9e56aa 100644 --- a/hw/syn/opae/sources_1c.txt +++ b/hw/syn/opae/sources_1c.txt @@ -3,7 +3,7 @@ +define+SYNTHESIS +define+QUARTUS #+define+SCOPE -#+define+PERF_ENABLE +##+define+PERF_ENABLE #+define+DBG_PRINT_CORE_ICACHE #+define+DBG_PRINT_CORE_DCACHE diff --git a/hw/syn/opae/sources_2c.txt b/hw/syn/opae/sources_2c.txt index a70589f5..068ba8c7 100644 --- a/hw/syn/opae/sources_2c.txt +++ b/hw/syn/opae/sources_2c.txt @@ -2,7 +2,7 @@ +define+SYNTHESIS +define+QUARTUS -#+define+PERF_ENABLE +##+define+PERF_ENABLE vortex_afu.json QI:vortex_afu.qsf diff --git a/hw/syn/opae/sources_4c.txt b/hw/syn/opae/sources_4c.txt index 9ac95cdd..f8de0b37 100644 --- a/hw/syn/opae/sources_4c.txt +++ b/hw/syn/opae/sources_4c.txt @@ -2,7 +2,7 @@ +define+SYNTHESIS +define+QUARTUS -#+define+PERF_ENABLE +##+define+PERF_ENABLE vortex_afu.json QI:vortex_afu.qsf