diff --git a/tools/quartus/quartus_fmax.sh b/tools/quartus/quartus_fmax.sh new file mode 100755 index 0000000000000000000000000000000000000000..5cd97b44a603c01d7e15761699c8e462ad82bed4 --- /dev/null +++ b/tools/quartus/quartus_fmax.sh @@ -0,0 +1,68 @@ +#!/bin/bash +############################################################################### +# +# Copyright (C) 2015 +# ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.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/>. +# +############################################################################### + +# Purpose: +# . Extract fMax from Timequest report file +# Usage: +# . $ quartus_fmax [project].sta.rpt [clk] +# . [clk] is the full path of the clock of interest; copy/paste this from Timequest GUI. + + +if [ ! -z $1 ] +then + # $1 was given + RPT_FILE=$1 +else + : # $1 was not given + echo 'Pass a .sta.rpt file as first argument.' + exit 1 +fi + +if [ ! -z $2 ] +then + : # $2 was given + CLK=$2 +else + : # $2 was not given + echo 'Pass (part of) the clock path as second argument.' + exit 1 +fi + + + + +nof_clk=`awk '/; Slow 900mV 85C Model Fmax Summary/,/This panel reports FMAX/' $RPT_FILE | grep -c $CLK` + +if [ $nof_clk = 0 ] +then + echo 'Clock not found; check provided clock path' + exit 1 +elif [ $nof_clk -gt 1 ] +then + echo 'Multiple clocks found; check provided clock path.' + exit 1 +else + # Good; only one clock found mathing user passed clk path. + awk '/; Slow 900mV 85C Model Fmax Summary/,/This panel reports FMAX/' $RPT_FILE | grep $CLK | cut -d';' -f2 +fi + + diff --git a/tools/quartus/run_qcomp b/tools/quartus/run_qcomp index b706f09f45d5070b8de727238942276720aa4739..b0240679d28863893de89c3c34416f0c9923be19 100755 --- a/tools/quartus/run_qcomp +++ b/tools/quartus/run_qcomp @@ -55,6 +55,7 @@ shift # shift left commandline args: $2 becomes $1 ... ($0 is untouched) project= rev= SEED=1 +CLK= os= # parse cmdline for arg ; do @@ -74,6 +75,12 @@ for arg ; do seed=*) SEED=`echo ${arg} | sed 's/^seed=//'` ;; + --clk=*) + CLK=`echo ${arg} | sed 's/^--clk=//'` + ;; + clk=*) + CLK=`echo ${arg} | sed 's/^clk=//'` + ;; *=* ) # it was an option. skip it - if we wanted to, # we could process them over here @@ -127,9 +134,34 @@ else mem_width= fi -# Add the seed value to the QSF. We can simply append it because Quartus removes previous (duplicate) assignments. -unb_info $0 "Adding fitter seed value of ${SEED} to ${project_rev}.qsf" -echo -e "set_global_assignment -name SEED ${SEED}\n" >> ${quartusdir}/${project_rev}.qsf +#for i in $(seq $SEED); do echo $i; done + +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. + unb_info $0 "Adding fitter seed value of ${i} to ${project_rev}.qsf" + echo -e "set_global_assignment -name SEED ${i}\n" >> ${quartusdir}/${project_rev}.qsf + + unb_info $0 "Performing full compile of project ${project_rev}" + quartus_sh $mem_width --flow compile ${project_rev} + + if [ $? -eq 0 ] + then + unb_info $0 "Full compile successful." + else + unb_error $0 "Full compile failed." + fi + + 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'` + + unb_info $0 "fMax of ${CLK}: ${fmax} MHz" + cp -r ${quartusdir} ${quartusdir}_${fmax}MHz + fi +done -unb_info $0 "Performing full compile of project ${project_rev}" -quartus_sh $mem_width --flow compile ${project_rev}