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

Subversion Repositories radiohdl

[/] [radiohdl/] [trunk/] [quartus/] [run_term] - Rev 4

Compare with Previous | Blame | View Log

#!/bin/bash -eu
# -------------------------------------------------------------------------- #
#
# Copyright (C) 2010                                                        
# 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_term buildset node_num
# example:
#   run_term unb1 0

# 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) [options] buildset node [--cable=]
Arguments: buildset   Name of the buildset to create the app for.
           node       Nodenumber to use (0..7) or [0..3][0..7] to specify board and node.
Options: --cable=*:   ???
--> Note: It does not matter where the options are placed: before, in between or after the arguments.
@EndOfHelp@
    exit 1
}

# parse cmdline
POSITIONAL=()
cable=1
# parse cmdline
while [[ $# -gt 0 ]]
do
    case $1 in
        --cable=*)           
            cable=${1#*=}
            ;;
        -*|--*)
            exit_with_error "Unknown option: "$1
            ;;
        *)  POSITIONAL+=("$1")
            ;;
    esac
    shift
done
if [ ${#POSITIONAL[@]} -gt 0 ]; then
    set -- "${POSITIONAL[@]}"
fi

# check the positional parameters
if [ $# -ne 2 ]; then
    exit_with_error "Wrong number of arguments specified."
fi
buildset=$1
node=$2
# read in the configuration based on the user arguments
. ${RADIOHDL_GEAR}/quartus/set_quartus ${buildset}

#Convert user passed node to actual FPGA JTAG ID
#===============================================
# convert single digit into board+node
if [ ${#node} -eq 1 ]; then
    node="1"${node}
fi

# In the UniRack, the JTAG board IDs for board 0 (JTAG ID 1..8) and board 1 (JTAG ID 9..16) are swapped.
# This makes it use counter loops and such, so we'll just use an associative array to map 
# the multi-board IDs to actual FPGA JTAG ID.
declare -A node_jtag=(\
      ["00"]="9"\
      ["01"]="10"\
      ["02"]="11"\
      ["03"]="12"\
      ["04"]="13"\
      ["05"]="14"\
      ["06"]="15"\
      ["07"]="16"\
      ["10"]="1"\
      ["11"]="2"\
      ["12"]="3"\
      ["13"]="4"\
      ["14"]="5"\
      ["15"]="6"\
      ["16"]="7"\
      ["17"]="8"\
      ["20"]="17"\
      ["21"]="18"\
      ["22"]="19"\
      ["23"]="20"\
      ["24"]="21"\
      ["25"]="22"\
      ["26"]="23"\
      ["27"]="24"\
      ["30"]="25"\
      ["31"]="26"\
      ["32"]="27"\
      ["33"]="28"\
      ["34"]="29"\
      ["35"]="30"\
      ["36"]="31"\
      ["37"]="32"\
    )

fpga="${node_jtag[$node]:-}"
if [ -z "${fpga}" ]; then
    hdl_error $0 "Invalid node ID. Use [0..7] (single board) or [0..3][0..7] (multi board)"
fi

hdl_info $0 "Opening NIOS II terminal on cable ${cable}"
hdl_exec $0  nios2-terminal --device $fpga --cable=${cable}

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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