1 |
4 |
danv |
#!/bin/bash -eu
|
2 |
|
|
# --------------------------------------------------------------------------
|
3 |
|
|
# Copyright (C) 2016
|
4 |
|
|
# ASTRON (Netherlands Institute for Radio Astronomy)
|
5 |
|
|
# JIVE (Joint Institute for VLBI in Europe)
|
6 |
|
|
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
|
7 |
|
|
#
|
8 |
|
|
# This program is free software: you can redistribute it and/or modify
|
9 |
|
|
# it under the terms of the GNU General Public License as published by
|
10 |
|
|
# the Free Software Foundation, either version 3 of the License, or
|
11 |
|
|
# (at your option) any later version.
|
12 |
|
|
#
|
13 |
|
|
# This program is distributed in the hope that it will be useful,
|
14 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
# GNU General Public License for more details.
|
17 |
|
|
#
|
18 |
|
|
# You should have received a copy of the GNU General Public License
|
19 |
|
|
# along with this program. If not, see .
|
20 |
|
|
# --------------------------------------------------------------------------
|
21 |
|
|
|
22 |
|
|
# Purpose:
|
23 |
|
|
# . Synthesize a list of designs
|
24 |
|
|
# Description:
|
25 |
|
|
# . TODO: Create cronjob; run every friday evening. SVN update this script in
|
26 |
|
|
# the cronjob before executing!
|
27 |
|
|
# . This script will exit to the shell immediately on any errors during
|
28 |
|
|
# run_qcomp.
|
29 |
|
|
# . Raw Binary Files (RBF) will be generated from each design as a final step.
|
30 |
|
|
|
31 |
|
|
# Usage:
|
32 |
|
|
# . ./run_regtest_synth
|
33 |
|
|
|
34 |
|
|
# Curly bracket used to log all following commands (up to the '}')
|
35 |
|
|
LOGFILE=${HOME}/run_regtest_synth.log
|
36 |
|
|
{
|
37 |
|
|
|
38 |
|
|
# Add search paths for executeables to $PATH
|
39 |
|
|
export PATH=${PATH}:\
|
40 |
|
|
${RADIOHDL_GEAR}/quartus
|
41 |
|
|
|
42 |
|
|
# Source generic.sh for functions such as hdl_info
|
43 |
|
|
. ${HOME}/HDL/radiohdl/generic.sh
|
44 |
|
|
|
45 |
|
|
# We're assuming the local 'SVN' dir is up to date. Copy it to a timestamped
|
46 |
|
|
# dirname and work with that.
|
47 |
|
|
SVN_DIR=${HOME}/SVN_$(date -d "today" +"%Y%m%d")
|
48 |
|
|
hdl_info $0 "Copying local SVN dir to ${SVN_DIR}"
|
49 |
|
|
hdl_exec $0 cp -r ${SVN}/ ${SVN_DIR}
|
50 |
|
|
export SVN=${SVN_DIR}
|
51 |
|
|
|
52 |
|
|
# Disable exit on hdl_error (used in hdl_exec)
|
53 |
|
|
NO_EXIT=True
|
54 |
|
|
|
55 |
|
|
# Setup RadioHDL environment for UniBoard2 and new UniBoard1 applications
|
56 |
|
|
hdl_info $0 "Setting up RadioHDL"
|
57 |
|
|
hdl_exec $0 . ${RADIOHDL_GEAR}/setup_radiohdl.sh
|
58 |
|
|
|
59 |
|
|
# Generate all IP
|
60 |
|
|
hdl_info $0 "Generating all IP"
|
61 |
|
|
hdl_exec $0 cd ${RADIOHDL_WORK}/libraries/technology/ip_stratixiv
|
62 |
|
|
#hdl_exec $0 sh generate-all-ip.sh
|
63 |
|
|
|
64 |
|
|
# Run quartus_config.py
|
65 |
|
|
hdl_info $0 "Creating Quartus project build directories"
|
66 |
|
|
hdl_exec $0 python ${RADIOHDL_GEAR}/oneclick/base/quartus_config.py
|
67 |
|
|
|
68 |
|
|
# Build our most important designs
|
69 |
|
|
# . KISS: just put the full commands here; no need for hard to maintain
|
70 |
|
|
# lookup-tables here.
|
71 |
|
|
hdl_info $0 "Building designs"
|
72 |
|
|
# unb1_minimal_qsys
|
73 |
|
|
#hdl_exec $0 run_sopc unb1 unb1_minimal_sopc
|
74 |
|
|
#hdl_exec $0 run_qsys unb1 unb1_minimal_qsys
|
75 |
|
|
#hdl_exec $0 run_qcomp unb1 unb1_minimal_qsys
|
76 |
|
|
#hdl_exec $0 run_rbf unb1 unb1_minimal_qsys
|
77 |
|
|
# apertif_unb1_bn_filterbank
|
78 |
|
|
hdl_exec $0 run_sopc unb1 apertif_unb1_bn_filterbank
|
79 |
|
|
hdl_exec $0 run_qcomp unb1 apertif_unb1_bn_filterbank
|
80 |
|
|
hdl_exec $0 run_rbf unb1 apertif_unb1_bn_filterbank
|
81 |
|
|
|
82 |
|
|
# Put all of the above commands in a logfile
|
83 |
|
|
} 2>&1 | tee ${LOGFILE}
|
84 |
|
|
|
85 |
|
|
# At this point, errors may or may not have occured. Perform checks here.
|
86 |
|
|
# Check if all RBF files have been generated
|
87 |
|
|
NOF_RBF_REQ=1
|
88 |
|
|
FOUND_RBF=$(find ${RADIOHDL_BUILD_DIR} -name *.rbf | grep "\-r")
|
89 |
|
|
NOF_RBF=$(echo ${FOUND_RBF} | grep -c "rbf")
|
90 |
|
|
RESULT=FAILED
|
91 |
|
|
if (( NOF_RBF == NOF_RBF_REQ )); then
|
92 |
|
|
RESULT=PASSED
|
93 |
|
|
fi
|
94 |
|
|
|
95 |
|
|
# Send an email with the result
|
96 |
|
|
RECIPIENTS=schuur@astron.nl,schuur@astron.nl
|
97 |
|
|
MESSAGE="\
|
98 |
|
|
${NOF_RBF_REQ} RBF files required\n\
|
99 |
|
|
${NOF_RBF} RBF files generated:\n\
|
100 |
|
|
${FOUND_RBF}\n"
|
101 |
|
|
# Cat the logfile and use Sed to get rid of color coding characters
|
102 |
|
|
LOG=$(cat ${LOGFILE} | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g")
|
103 |
|
|
SUBJECT="[REGTEST] Synthesis Result: ${RESULT}"
|
104 |
|
|
printf "${MESSAGE} \n ${LOG}" | mail -s "${SUBJECT}" ${RECIPIENTS}
|