URL
https://opencores.org/ocsvn/radiohdl/radiohdl/trunk
Subversion Repositories radiohdl
[/] [radiohdl/] [trunk/] [quartus/] [run_qcomp] - Rev 4
Compare with Previous | Blame | View Log
#!/bin/bash -eu
# -------------------------------------------------------------------------- #
#
# Copyright (C) 2012
# ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
# JIVE (Joint Institute for VLBI in Europe) <http://www.jive.nl/>
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# -------------------------------------------------------------------------- #
#
# Run this tool with at least the commandline arguments:
# run_qcomp buildset design_name
# example:
# run_qcomp unb2 unb2_minimal
# read generic functions/definitions
. ${RADIOHDL_GEAR}/generic.sh
# helper function for command parsing
exit_with_error() {
hdl_error_noexit $0 "$@"
cat <<@EndOfHelp@
Usage: $(basename $0) buildset project [options]
Arguments: buildset Name of the buildset to create the registermap for.
project Project file to use.
Options: --rev=* which revision to use.
--clk=* ???
--seed=* ???
--32bit Create 32 bit code.
--> Note: It does not matter where the options are placed: before, in between or after the arguments.
@EndOfHelp@
exit 1
}
# parse cmdline
POSITIONAL=()
rev=
SEED=1
CLK=
os=
while [[ $# -gt 0 ]]
do
case $1 in
--rev=*)
rev=${1#*=}
;;
--seed=*)
SEED=${1#*=}
;;
--clk=*)
CLK=${1#*=}
;;
--32bit)
os=32
;;
-*|--*)
exit_with_error "Unknown option: "$1
;;
*) POSITIONAL+=("$1")
;;
esac
shift
done
if [ ${#POSITIONAL[@]} -gt 0 ]; then
set -- "${POSITIONAL[@]}"
fi
# check the positional parameters
if [ $# -lt 2 ]; then
exit_with_error "Wrong number of arguments specified."
fi
buildset=$1
project=$2
# read in the configuration based on the user arguments
. ${RADIOHDL_GEAR}/quartus/set_quartus ${buildset}
PRJS="${RADIOHDL_BUILD_DIR}"
PRJ=
for prj in ${PRJS}
do
hdl_info $0 "check if project '${project}' in dir '${prj}'"
if [ -d "${prj}/${buildset}/quartus/${project}" ]; then
PRJ=${prj}
fi
done
if [ -z "${project}" -o -z "${PRJ}" ]; then
hdl_error $0 "Please enter a valid project name"
fi
# check if the quartus project directory is there
quartusdir="${PRJ}/${buildset}/quartus/${project}"
hdl_exec $0 msg=no test -d ${quartusdir}
if [ -z "${rev}" ]; then
project_rev="${project}"
hdl_info $0 "No project revision passed, defaulting to ${project_rev}"
else
if [ -f "${quartusdir}/${rev}.qsf" ]; then
project_rev="${rev}"
hdl_info $0 "Selecting project revision ${project_rev}"
else
hdl_error $0 "Invalid project revision"
fi
fi
cd ${quartusdir}
if [ -z "${os}" ]; then
hdl_info $0 "Assuming 64-bit OS. Pass '--32bit' to use 32-bit"
mem_width='--64bit'
else
hdl_info $0 "Using 32-bit mode"
mem_width=
fi
for i in $(echo $SEED | sed "s/,/ /g")
do
# Add the seed value to the QSF. We can simply append it because Quartus removes previous (duplicate) assignments.
hdl_info $0 "Adding fitter seed value of ${i} to ${project_rev}.qsf"
echo -e "\nset_global_assignment -name SEED ${i}\n" >> ${quartusdir}/${project_rev}.qsf
hdl_info $0 "Performing full compile of project ${project_rev}"
quartus_sh $mem_width --flow compile ${project_rev} | grep -v Info
hdl_info $0 "compile done"
if [ $? -eq 0 ]
then
# Successful compile.
# . Add SVN rev to SOF file name
if [ -n "${HDL_GIT_REVISION_SHORT}" ]; then
git_revision=`echo ${HDL_GIT_REVISION_SHORT}` # ${HDL_GIT_REVISION_SHORT} looks like: "7d81650af"
hdl_info $0 "copy file ${quartusdir}/${project_rev}.sof to ${quartusdir}/${project_rev}-r${git_revision}.sof"
cp -p ${quartusdir}/${project_rev}.sof ${quartusdir}/${project_rev}-r${git_revision}.sof
fi
# . Check if user passed a clk
if [ -z "${CLK}" ]
then
:
else
fmax_str=`quartus_fmax.sh ${quartusdir}/${project_rev}.sta.rpt $CLK`
fmax=`echo $fmax_str | cut -f1 -d"." | sed 's/[^0-9]//g'`
# . Report fMax
hdl_info $0 "fMax of ${CLK}: ${fmax} MHz"
# . Copy quartus output dir preserving the meta file information, add fMax portfix
cp -rp ${quartusdir} ${quartusdir}_${fmax}MHz
fi
# Print critical warnings
hdl_warning $0 "Listing Critical Warnings"
# Print pin location warnings, if any
cat *.fit.rpt | grep -H --color=auto 'No exact pin location' | grep -H --color=auto 'Critical Warning'
# . print corresponding info
grep -H --color=auto 'not assigned to an exact location' *.fit.rpt
# Print remaining critical warnings, EXCEPT the always presetn TSE warning
cat *.rpt | grep -v 'mixed_port_feed_through_mode\" parameter of RAM atom' | grep -H --color=auto 'Critical Warning'
hdl_info $0 "Full compile successful."
else
# Compile failed
# . Print the errors
cd ${quartusdir}
hdl_warning $0 "Listing Critical Warnings"
# Print pin location warnings, if any
cat *.fit.rpt | grep -H --color=auto 'No exact pin location' | grep -H --color=auto 'Critical Warning'
# . print corresponding info
grep -H --color=auto 'not assigned to an exact location' *.fit.rpt
# Print remaining critical warnings, EXCEPT the always presetn TSE warning
cat *.rpt | grep -v 'mixed_port_feed_through_mode\" parameter of RAM atom' | grep -H --color=auto 'Critical Warning'
hdl_error_noexit $0 "Error(s) occured"
# Print error messages
cat *.rpt | grep -v 'Error detection' | grep -H --color=auto 'Error'
hdl_error $0 "Full compile failed"
fi
done