This commit is contained in:
Blaise Tine
2021-04-04 23:44:06 -07:00
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 exists, a make clean command is ran before the build. Script waits
until the inteldev script or quartus program is finished running. 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: Options:
-c -c
Core count (1, 2, 4, 8, or 16). Core count (1, 2, 4, 8, or 16).
-p -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". opae directory to include/exclude "+define+PERF_ENABLE".
-w
Wait for the build to complete
_______________________________________________________________________________ _______________________________________________________________________________

View File

@@ -1,10 +1,23 @@
#!/bin/bash #!/bin/bash
while getopts c:p: flag BUILD_DIR=../../hw/syn/opae
perf=0
wait=0
while getopts c:pwh flag
do do
case "${flag}" in case "${flag}" in
c) cores=${OPTARG};; #1, 2, 4, 8, 16 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 esac
done done
@@ -13,25 +26,22 @@ if [[ ! "$cores" =~ ^(1|2|4|8|16)$ ]]; then
exit 1 exit 1
fi fi
cd ../../hw/syn/opae cd ${BUILD_DIR}
sources_file="./sources_${cores}c.txt" sources_file="./sources_${cores}c.txt"
if [ ${perf:0:1} = "n" ]; then if [ ${perf} = 1 ]; 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 grep -Fxq '#+define+PERF_ENABLE' ${sources_file}; then if grep -Fxq '#+define+PERF_ENABLE' ${sources_file}; then
sed -i 's/+define+PERF_ENABLE/#+define+PERF_ENABLE/' ${sources_file} sed -i 's/+define+PERF_ENABLE/#+define+PERF_ENABLE/' ${sources_file}
elif ! grep -Fxq '+define+PERF_ENABLE' ${sources_file}; then elif ! grep -Fxq '+define+PERF_ENABLE' ${sources_file}; then
sed -i '1s/^/+define+PERF_ENABLE\n/' ${sources_file} sed -i '1s/^/+define+PERF_ENABLE\n/' ${sources_file}
fi fi
else else
echo 'Invalid parameter for argument -p (y/n expected)' if grep -v '^ *#' ${sources_file} | grep -Fxq '+define+SYNTHESIS'; then
exit 1 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 fi
if [ -d "./build_fpga_{$cores}c" ]; then if [ -d "./build_fpga_{$cores}c" ]; then
@@ -39,12 +49,12 @@ if [ -d "./build_fpga_{$cores}c" ]; then
fi fi
make "fpga-${cores}c" make "fpga-${cores}c"
sleep 30 if [ ${wait} = 1 ]; then
sleep 30
pids=($(pgrep -f "${OPAE_PLATFORM_ROOT}|quartus")) pids=($(pgrep -f "${OPAE_PLATFORM_ROOT}|quartus"))
for pid in ${pids[@]}; do for pid in ${pids[@]}; do
while kill -0 ${pid} 2> /dev/null; do while kill -0 ${pid} 2> /dev/null; do
sleep 30 sleep 30
done
done done
done fi

View File

@@ -2,6 +2,6 @@
for ((i=1; i <= 16; i=i*2)); do for ((i=1; i <= 16; i=i*2)); do
echo "Building ${i} core build..." echo "Building ${i} core build..."
./build.sh -c ${i} -p y ./build.sh -c ${i} -p -w
echo "Done ${i} core build." echo "Done ${i} core build."
done done

View File

@@ -3,7 +3,7 @@
+define+SYNTHESIS +define+SYNTHESIS
+define+QUARTUS +define+QUARTUS
#+define+SCOPE #+define+SCOPE
#+define+PERF_ENABLE ##+define+PERF_ENABLE
#+define+DBG_PRINT_CORE_ICACHE #+define+DBG_PRINT_CORE_ICACHE
#+define+DBG_PRINT_CORE_DCACHE #+define+DBG_PRINT_CORE_DCACHE

View File

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

View File

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