OpenCores
URL https://opencores.org/ocsvn/radiohdl/radiohdl/trunk

Subversion Repositories radiohdl

[/] [radiohdl/] [trunk/] [quartus/] [run_qcomp] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 danv
#!/bin/bash -eu
2
# -------------------------------------------------------------------------- #
3
#
4
# Copyright (C) 2012
5
# ASTRON (Netherlands Institute for Radio Astronomy) 
6
# JIVE (Joint Institute for VLBI in Europe) 
7
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
8
#
9
# This program is free software: you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation, either version 3 of the License, or
12
# (at your option) any later version.
13
#
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
# GNU General Public License for more details.
18
#
19
# You should have received a copy of the GNU General Public License
20
# along with this program.  If not, see .
21
#
22
# -------------------------------------------------------------------------- #
23
#
24
 
25
# Run this tool with at least the commandline arguments:
26
#   run_qcomp buildset design_name
27
# example:
28
#   run_qcomp unb2 unb2_minimal
29
 
30
# read generic functions/definitions
31
. ${RADIOHDL_GEAR}/generic.sh
32
 
33
# helper function for command parsing
34
exit_with_error() {
35
    hdl_error_noexit $0 "$@"
36
    cat <<@EndOfHelp@
37
Usage: $(basename $0) buildset project [options]
38
Arguments: buildset     Name of the buildset to create the registermap for.
39
           project      Project file to use.
40
 
41
Options: --rev=*        which revision to use.
42
         --clk=*        ???
43
         --seed=*       ???
44
         --32bit        Create 32 bit code.
45
--> Note: It does not matter where the options are placed: before, in between or after the arguments.
46
@EndOfHelp@
47
    exit 1
48
}
49
 
50
# parse cmdline
51
POSITIONAL=()
52
rev=
53
SEED=1
54
CLK=
55
os=
56
while [[ $# -gt 0 ]]
57
do
58
    case $1 in
59
        --rev=*)
60
            rev=${1#*=}
61
            ;;
62
        --seed=*)
63
            SEED=${1#*=}
64
            ;;
65
        --clk=*)
66
            CLK=${1#*=}
67
            ;;
68
        --32bit)
69
            os=32
70
            ;;
71
        -*|--*)
72
            exit_with_error "Unknown option: "$1
73
            ;;
74
        *)  POSITIONAL+=("$1")
75
            ;;
76
    esac
77
    shift
78
done
79
if [ ${#POSITIONAL[@]} -gt 0 ]; then
80
    set -- "${POSITIONAL[@]}"
81
fi
82
 
83
# check the positional parameters
84
if [ $# -lt 2 ]; then
85
    exit_with_error "Wrong number of arguments specified."
86
fi
87
 
88
buildset=$1
89
project=$2
90
# read in the configuration based on the user arguments
91
. ${RADIOHDL_GEAR}/quartus/set_quartus ${buildset}
92
 
93
PRJS="${RADIOHDL_BUILD_DIR}"
94
PRJ=
95
for prj in ${PRJS}
96
    do
97
        hdl_info $0 "check if project '${project}' in dir '${prj}'"
98
        if [ -d "${prj}/${buildset}/quartus/${project}" ]; then
99
            PRJ=${prj}
100
        fi
101
    done
102
if [ -z "${project}" -o -z "${PRJ}" ]; then
103
    hdl_error $0 "Please enter a valid project name"
104
fi
105
 
106
# check if the quartus project directory is there
107
quartusdir="${PRJ}/${buildset}/quartus/${project}"
108
hdl_exec $0 msg=no test -d ${quartusdir}
109
 
110
if [ -z "${rev}" ]; then
111
  project_rev="${project}"
112
  hdl_info $0 "No project revision passed, defaulting to ${project_rev}"
113
else
114
  if [ -f "${quartusdir}/${rev}.qsf" ]; then
115
    project_rev="${rev}"
116
    hdl_info $0 "Selecting project revision ${project_rev}"
117
  else
118
    hdl_error $0 "Invalid project revision"
119
  fi
120
fi
121
 
122
cd ${quartusdir}
123
 
124
if [ -z "${os}" ]; then
125
  hdl_info $0 "Assuming 64-bit OS. Pass '--32bit' to use 32-bit"
126
  mem_width='--64bit'
127
else
128
  hdl_info $0 "Using 32-bit mode"
129
  mem_width=
130
fi
131
 
132
 
133
for i in $(echo $SEED | sed "s/,/ /g")
134
do
135
    # Add the seed value to the QSF. We can simply append it because Quartus removes previous (duplicate) assignments.
136
    hdl_info $0 "Adding fitter seed value of ${i} to ${project_rev}.qsf"
137
    echo -e "\nset_global_assignment -name SEED ${i}\n" >> ${quartusdir}/${project_rev}.qsf
138
 
139
    hdl_info $0 "Performing full compile of project ${project_rev}"
140
    quartus_sh $mem_width --flow compile ${project_rev} | grep -v Info
141
    hdl_info $0 "compile done"
142
 
143
    if [ $? -eq 0 ]
144
    then
145
      # Successful compile.
146
      # . Add SVN rev to SOF file name
147
      if [ -n "${HDL_GIT_REVISION_SHORT}" ]; then
148
        git_revision=`echo ${HDL_GIT_REVISION_SHORT}`  # ${HDL_GIT_REVISION_SHORT} looks like: "7d81650af"
149
        hdl_info $0 "copy file ${quartusdir}/${project_rev}.sof to ${quartusdir}/${project_rev}-r${git_revision}.sof"
150
        cp -p ${quartusdir}/${project_rev}.sof ${quartusdir}/${project_rev}-r${git_revision}.sof
151
      fi
152
      # . Check if user passed a clk
153
      if [ -z "${CLK}" ]
154
      then
155
          :
156
      else
157
          fmax_str=`quartus_fmax.sh ${quartusdir}/${project_rev}.sta.rpt $CLK`
158
          fmax=`echo $fmax_str | cut -f1 -d"." | sed 's/[^0-9]//g'`
159
          # . Report fMax
160
          hdl_info $0 "fMax of ${CLK}: ${fmax} MHz"
161
          # . Copy quartus output dir preserving the meta file information, add fMax portfix
162
          cp -rp ${quartusdir} ${quartusdir}_${fmax}MHz
163
      fi
164
      # Print critical warnings
165
      hdl_warning $0 "Listing Critical Warnings"
166
      # Print pin location warnings, if any
167
      cat *.fit.rpt | grep -H --color=auto 'No exact pin location' | grep -H --color=auto 'Critical Warning'
168
      # . print corresponding info
169
      grep -H --color=auto 'not assigned to an exact location' *.fit.rpt
170
      # Print remaining critical warnings, EXCEPT the always presetn TSE warning
171
      cat *.rpt | grep -v 'mixed_port_feed_through_mode\" parameter of RAM atom' | grep -H --color=auto 'Critical Warning'
172
      hdl_info $0 "Full compile successful."
173
    else
174
      # Compile failed
175
      # . Print the errors
176
      cd ${quartusdir}
177
      hdl_warning $0 "Listing Critical Warnings"
178
      # Print pin location warnings, if any
179
      cat *.fit.rpt | grep -H --color=auto 'No exact pin location' | grep -H --color=auto 'Critical Warning'
180
      # . print corresponding info
181
      grep -H --color=auto 'not assigned to an exact location' *.fit.rpt
182
      # Print remaining critical warnings, EXCEPT the always presetn TSE warning
183
      cat *.rpt | grep -v 'mixed_port_feed_through_mode\" parameter of RAM atom' | grep -H --color=auto 'Critical Warning'
184
      hdl_error_noexit $0 "Error(s) occured"
185
      # Print error messages
186
      cat *.rpt | grep -v 'Error detection' | grep -H --color=auto 'Error'
187
      hdl_error $0 "Full compile failed"
188
    fi
189
 
190
done

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.