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

Subversion Repositories radiohdl

[/] [radiohdl/] [trunk/] [modelsim/] [cli_modelsim] - Rev 4

Compare with Previous | Blame | View Log

#!/bin/bash -eu
###############################################################################
#
# Copyright (C) 2014-2018
# 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/>.
#
###############################################################################

# General tool and project settings
# - use '. <script>.sh' to have the settings apply in this shell, otherwise they get lost when <script>.sh returns

# 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 [.do-file]
Arguments: buildset     Name of the buildset to start modelsim for.
           project      Command file to use.
@EndOfHelp@
    exit 1
}

# parse cmdline
POSITIONAL=()
while [[ $# -gt 0 ]]
do
    case $1 in
        -*|--*)
            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 1 ] && [ $# -ne 2 ]; then
    exit_with_error "Wrong number of arguments specified."
fi
buildset=$1
do_file=${2:-}

. ${RADIOHDL_GEAR}/modelsim/set_modelsim ${buildset}

if [ -z "${do_file}" ]; then
    # Start the Modelsim command line with commands.do
    hdl_exec $0 $MODELSIM_DIR/$MODELSIM_PLATFORM/vsim -c -do ${RADIOHDL_GEAR}/modelsim/commands.do
else   
    # Start the Modelsim command line with user passed .do file
    # Typically the do-file should start with 'do ${RADIOHDL_GEAR}/modelsim/commands.do' and end with 'quit -f'.
    hdl_exec $0 $MODELSIM_DIR/$MODELSIM_PLATFORM/vsim -c -do ${do_file} 
fi

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.