From 095b0888409a6c29dcae24b2c0743508fa15a631 Mon Sep 17 00:00:00 2001
From: Erik Kooistra <kooistra@astron.nl>
Date: Fri, 6 Jun 2014 09:26:22 +0000
Subject: [PATCH] Added bash script run_msim and run_quartus to start the GUI
 for target default, unb1 or unb2 and the correct tool version.

---
 tools/modelsim/modelsim_version.sh | 39 +++++++++++++++++++++++
 tools/modelsim/run_msim            | 50 ++++++++++++++++++++++++++++++
 tools/quartus/quartus_generic.sh   | 46 +++++++++++++++++++++++++++
 tools/quartus/quartus_version.sh   | 36 +++++++++++++++++++++
 tools/quartus/run_quartus          | 49 +++++++++++++++++++++++++++++
 5 files changed, 220 insertions(+)
 create mode 100755 tools/modelsim/modelsim_version.sh
 create mode 100755 tools/modelsim/run_msim
 create mode 100755 tools/quartus/quartus_generic.sh
 create mode 100755 tools/quartus/quartus_version.sh
 create mode 100755 tools/quartus/run_quartus

diff --git a/tools/modelsim/modelsim_version.sh b/tools/modelsim/modelsim_version.sh
new file mode 100755
index 0000000000..7d9215fec0
--- /dev/null
+++ b/tools/modelsim/modelsim_version.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+###############################################################################
+#
+# Copyright (C) 2014
+# 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/>.
+#
+###############################################################################
+
+# Only run this script once
+if [ -z "${MODELSIM_VERSION_SH}" ]; then
+export MODELSIM_VERSION_SH=true
+
+MODELSIM_VERSION=${1}
+echo "Select Modelsim version: ${MODELSIM_VERSION}"
+
+# First modelsim 6.6c,f was stored at /modeltech, subsequent versions are stored at their /<version number>/modeltech
+MODELSIM_VERSION_DIR=${MODELSIM_VERSION}
+if [ "${MODELSIM_VERSION}" = "6.6c" ]; then
+  MODELSIM_VERSION_DIR=""
+fi
+
+# Must not define MODEL_TECH, because it gets defined when the tool starts. Therefore define MODEL_TECH_DIR to denote the modeltech version directory
+export MODEL_TECH_DIR=/home/software/Mentor/${MODELSIM_VERSION_DIR}/modeltech
+
+fi
\ No newline at end of file
diff --git a/tools/modelsim/run_msim b/tools/modelsim/run_msim
new file mode 100755
index 0000000000..250276731c
--- /dev/null
+++ b/tools/modelsim/run_msim
@@ -0,0 +1,50 @@
+#!/bin/bash
+###############################################################################
+#
+# Copyright (C) 2014
+# 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
+
+# Select target
+TARGET=${1:-}
+if [ "${TARGET}" = "" ]; then
+  TARGET="default"
+fi
+echo "Start Modelsim GUI for RadioHDL with target: ${TARGET}"
+
+# Select tool version
+if [ "${TARGET}" = "default" ]; then
+  . ${RADIOHDL}/tools/quartus/quartus_version.sh 11.1
+  . ${RADIOHDL}/tools/modelsim/modelsim_version.sh 6.6c
+elif [ "${TARGET}" = "unb1" ]; then
+  . ${RADIOHDL}/tools/quartus/quartus_version.sh 11.1
+  . ${RADIOHDL}/tools/modelsim/modelsim_version.sh 6.6c
+elif [ "${TARGET}" = "unb2" ]; then
+  #. ${RADIOHDL}/tools/quartus/quartus_version.sh 13.1
+  . ${RADIOHDL}/tools/quartus/quartus_version.sh 13.1a10
+  . ${RADIOHDL}/tools/modelsim/modelsim_version.sh 10.2c
+else
+  echo "error: unknown target"
+  exit 1
+fi
+
+# Start the Modelsim GUI
+$MODEL_TECH_DIR/linux_x86_64/vsim -do ${RADIOHDL}/tools/modelsim/commands.do
diff --git a/tools/quartus/quartus_generic.sh b/tools/quartus/quartus_generic.sh
new file mode 100755
index 0000000000..aa236c6e06
--- /dev/null
+++ b/tools/quartus/quartus_generic.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+###############################################################################
+#
+# Copyright (C) 2014
+# 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/>.
+#
+###############################################################################
+
+# Only run this script once
+if [ -z "${QUARTUS_GENERIC_SH}" ]; then
+export QUARTUS_GENERIC_SH=true
+echo "Run quartus_generic.sh"
+
+# Derive generic Quartus tool version related paths from $QUARTUS_DIR
+# Quartus, SOPC, Nios
+export QUARTUS_ROOTDIR=${QUARTUS_DIR}/quartus
+export QUARTUS_ROOTDIR_OVERRIDE=${QUARTUS_DIR}/quartus
+export NIOSDIR=${QUARTUS_DIR}/nios2eds
+export SOPC_KIT_NIOS2=${NIOSDIR}
+
+# Add to the $PATH, therefor run this script only once to avoid double entries
+export PATH=${PATH}:\
+${QUARTUS_ROOTDIR}/bin:\
+${QUARTUS_ROOTDIR}/sopc_builder/bin:\
+${NIOSDIR}/bin:\
+${NIOSDIR}/bin/gnu/H-i686-pc-linux-gnu/bin:\
+${NIOSDIR}/sdk2/bin
+
+# User synthesis timestamp in FPGA image
+export UNB_COMPILE_STAMPS=1
+
+fi
\ No newline at end of file
diff --git a/tools/quartus/quartus_version.sh b/tools/quartus/quartus_version.sh
new file mode 100755
index 0000000000..29a994c8ef
--- /dev/null
+++ b/tools/quartus/quartus_version.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+###############################################################################
+#
+# Copyright (C) 2014
+# 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/>.
+#
+###############################################################################
+
+# Only run this script once
+if [ -z "${QUARTUS_VERSION_SH}" ]; then
+export QUARTUS_VERSION_SH=true
+
+QUARTUS_VERSION=${1}
+echo "Select Quartus version: ${QUARTUS_VERSION}"
+
+# Set path to Quartus version
+export QUARTUS_DIR=/home/software/Altera/${QUARTUS_VERSION}
+
+# Select the path to the technology libraries that is used in the [libraries] section of the modelsim.ini
+export MODEL_TECH_ALTERA_LIB=/home/software/modelsim_altera_libs/${QUARTUS_VERSION}
+
+fi
\ No newline at end of file
diff --git a/tools/quartus/run_quartus b/tools/quartus/run_quartus
new file mode 100755
index 0000000000..cee4ce65d9
--- /dev/null
+++ b/tools/quartus/run_quartus
@@ -0,0 +1,49 @@
+#!/bin/bash
+###############################################################################
+#
+# Copyright (C) 2014
+# 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
+
+# Select target
+TARGET=${1:-}
+if [ "${TARGET}" = "" ]; then
+  TARGET="default"
+fi
+echo "Start Quartus GUI for RadioHDL with target: ${TARGET}"
+
+# Select tool version
+if [ "${TARGET}" = "default" ]; then
+  . ${RADIOHDL}/tools/quartus/quartus_version.sh 11.1
+elif [ "${TARGET}" = "unb1" ]; then
+  . ${RADIOHDL}/tools/quartus/quartus_version.sh 11.1
+elif [ "${TARGET}" = "unb2" ]; then
+  . ${RADIOHDL}/tools/quartus/quartus_version.sh 13.1a10
+else
+  echo "error: unknown target"
+  exit 1
+fi
+
+# Tool settings
+. ${RADIOHDL}/tools/quartus/quartus_generic.sh
+
+# Start the Quartus GUI
+quartus --64bit
-- 
GitLab