build scripts update

This commit is contained in:
Blaise Tine 2021-04-05 02:30:08 -04:00
parent 0ea22a059c
commit 9aa4168def
6 changed files with 39 additions and 26 deletions

View file

@ -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
_______________________________________________________________________________

View file

@ -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 <cores> [-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

View file

@ -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

View file

@ -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

View file

@ -2,7 +2,7 @@
+define+SYNTHESIS
+define+QUARTUS
#+define+PERF_ENABLE
##+define+PERF_ENABLE
vortex_afu.json
QI:vortex_afu.qsf

View file

@ -2,7 +2,7 @@
+define+SYNTHESIS
+define+QUARTUS
#+define+PERF_ENABLE
##+define+PERF_ENABLE
vortex_afu.json
QI:vortex_afu.qsf