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

Subversion Repositories radiohdl

[/] [radiohdl/] [trunk/] [quartus/] [run_term] - 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) 2010
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
# Run this tool with at least the commandline arguments:
25
#   run_term buildset node_num
26
# example:
27
#   run_term unb1 0
28
 
29
# read generic functions/definitions
30
. ${RADIOHDL_GEAR}/generic.sh
31
 
32
# helper function for command parsing
33
exit_with_error() {
34
    hdl_error_noexit $0 "$@"
35
    cat <<@EndOfHelp@
36
Usage: $(basename $0) [options] buildset node [--cable=]
37
Arguments: buildset   Name of the buildset to create the app for.
38
           node       Nodenumber to use (0..7) or [0..3][0..7] to specify board and node.
39
Options: --cable=*:   ???
40
--> Note: It does not matter where the options are placed: before, in between or after the arguments.
41
@EndOfHelp@
42
    exit 1
43
}
44
 
45
# parse cmdline
46
POSITIONAL=()
47
cable=1
48
# parse cmdline
49
while [[ $# -gt 0 ]]
50
do
51
    case $1 in
52
        --cable=*)
53
            cable=${1#*=}
54
            ;;
55
        -*|--*)
56
            exit_with_error "Unknown option: "$1
57
            ;;
58
        *)  POSITIONAL+=("$1")
59
            ;;
60
    esac
61
    shift
62
done
63
if [ ${#POSITIONAL[@]} -gt 0 ]; then
64
    set -- "${POSITIONAL[@]}"
65
fi
66
 
67
# check the positional parameters
68
if [ $# -ne 2 ]; then
69
    exit_with_error "Wrong number of arguments specified."
70
fi
71
buildset=$1
72
node=$2
73
# read in the configuration based on the user arguments
74
. ${RADIOHDL_GEAR}/quartus/set_quartus ${buildset}
75
 
76
#Convert user passed node to actual FPGA JTAG ID
77
#===============================================
78
# convert single digit into board+node
79
if [ ${#node} -eq 1 ]; then
80
    node="1"${node}
81
fi
82
 
83
# In the UniRack, the JTAG board IDs for board 0 (JTAG ID 1..8) and board 1 (JTAG ID 9..16) are swapped.
84
# This makes it use counter loops and such, so we'll just use an associative array to map
85
# the multi-board IDs to actual FPGA JTAG ID.
86
declare -A node_jtag=(\
87
      ["00"]="9"\
88
      ["01"]="10"\
89
      ["02"]="11"\
90
      ["03"]="12"\
91
      ["04"]="13"\
92
      ["05"]="14"\
93
      ["06"]="15"\
94
      ["07"]="16"\
95
      ["10"]="1"\
96
      ["11"]="2"\
97
      ["12"]="3"\
98
      ["13"]="4"\
99
      ["14"]="5"\
100
      ["15"]="6"\
101
      ["16"]="7"\
102
      ["17"]="8"\
103
      ["20"]="17"\
104
      ["21"]="18"\
105
      ["22"]="19"\
106
      ["23"]="20"\
107
      ["24"]="21"\
108
      ["25"]="22"\
109
      ["26"]="23"\
110
      ["27"]="24"\
111
      ["30"]="25"\
112
      ["31"]="26"\
113
      ["32"]="27"\
114
      ["33"]="28"\
115
      ["34"]="29"\
116
      ["35"]="30"\
117
      ["36"]="31"\
118
      ["37"]="32"\
119
    )
120
 
121
fpga="${node_jtag[$node]:-}"
122
if [ -z "${fpga}" ]; then
123
    hdl_error $0 "Invalid node ID. Use [0..7] (single board) or [0..3][0..7] (multi board)"
124
fi
125
 
126
hdl_info $0 "Opening NIOS II terminal on cable ${cable}"
127
hdl_exec $0  nios2-terminal --device $fpga --cable=${cable}

powered by: WebSVN 2.1.0

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