From d928e1dc7c659b626328f92323a894f9ec346276 Mon Sep 17 00:00:00 2001
From: Dumez <dumez>
Date: Wed, 22 Apr 2015 13:27:00 +0000
Subject: [PATCH] Add the use of a SITE env variable to make
 laboratory-specific software-tool version configuration

---
 tools/hdltool_readme.txt    |  8 +++++--
 tools/modelsim/set_modelsim | 43 ++++++++++++++++++++++++++-----------
 tools/quartus/set_quartus   | 31 ++++++++++++++++++--------
 3 files changed, 58 insertions(+), 24 deletions(-)

diff --git a/tools/hdltool_readme.txt b/tools/hdltool_readme.txt
index a0d76b7ecb..8222e3ce18 100644
--- a/tools/hdltool_readme.txt
+++ b/tools/hdltool_readme.txt
@@ -76,11 +76,15 @@ To setup the RadioHDL environment add this to the .bashrc:
     # SVN checkout root directory
     export SVN=${HOME}/svnroot/UniBoard_FP7
 
+    # define SITE env variable for laboratory specific software tool versions (USN, )
+    # Used in ${RADIOHDL}/tools/quartus/set_quartus and ${RADIOHDL}/tools/modelsim/set_modelsim
+    export SITE=
+
     # If necessary create a symbolic link to the actual Altera root directory (used in quartus_version.sh for Quartus)
     ln -s <Altera root directory> /home/software/Altera 
   
     # If necessary create a symbolic link to the actual Mentor root directory (used in modelsim_version.sh for Modelsim)
-    ln -s <Altera root directory> /home/software/Mentor
+    ln -s <Mentor root directory> /home/software/Mentor
     
     # Altera + ModelSim licences
     export LM_LICENSE_FILE=1800@LICENSE2.astron.nl:1717@LICENSE1.astron.nl
@@ -132,7 +136,7 @@ d) Compiling the Altera libraries for simulation with Modelsim
 
 The Altera verilog and vhdl libraries for the required FPGA device families can be compile using:
 
- > tools/quartus/run_altera_simlib_comp <tool target> <compilation output directory> <FPGA device family>
+ > ${RADIOHDL}/tools/quartus/run_altera_simlib_comp <tool target> <compilation output directory> <FPGA device family>
  
 For Modelsim versions newer than about version 10 this run_altera_simlib_comp script must be used and not the tools/Launch simulation library compiler in the Quartus GUI, because
 the libraries have to be compiled with the 'vlib -type directory' option to be able to use 'mk all'. 
diff --git a/tools/modelsim/set_modelsim b/tools/modelsim/set_modelsim
index 7591bc573b..358a2634da 100755
--- a/tools/modelsim/set_modelsim
+++ b/tools/modelsim/set_modelsim
@@ -30,21 +30,38 @@
 
 # Select target
 export TOOLSET=${1:-}
-echo "Make Modelsim and Altera library simulation settings for RadioHDL with tool setting: ${TOOLSET}"
+echo "Make Modelsim and Altera library simulation settings for RadioHDL with :"
+echo "  - Tool setting: ${TOOLSET}"
+echo "  - Site setting: ${SITE}"
 
 # Select tool version
-if [ "${TOOLSET}" = "unb1" ]; then
-  . ${RADIOHDL}/tools/quartus/quartus_version.sh 11.1
-  . ${RADIOHDL}/tools/modelsim/modelsim_version.sh 6.6c
-elif [ "${TOOLSET}" = "unb2" ]; then
-  . ${RADIOHDL}/tools/quartus/quartus_version.sh 14.1
-  . ${RADIOHDL}/tools/modelsim/modelsim_version.sh 10.4
-  # Next line may be needed, but comment it if it yields ld.so errors
-  export LD_PRELOAD=/home/software/freetype2/usr/lib/libfreetype.so
-else
-  echo "error: unknown tool setting: ${TOOLSET} (choose 'unb1' or 'unb2')"
-  exit 1
-fi
+if [ "${SITE}" = "USN" ]; then
+  if [ "${TOOLSET}" = "unb1" ]; then
+    . ${RADIOHDL}/tools/quartus/quartus_version.sh 11.1sp2
+    . ${RADIOHDL}/tools/modelsim/modelsim_version.sh 6.6d
+  elif [ "${TOOLSET}" = "unb2" ]; then
+    . ${RADIOHDL}/tools/quartus/quartus_version.sh 14.1
+    . ${RADIOHDL}/tools/modelsim/modelsim_version.sh 10.4
+  else
+    echo "error: unknown tool setting: ${TOOLSET} (choose 'unb1' or 'unb2')"
+    exit 1
+  fi # "${TOOLSET}" 
+else  # default site
+  if [ "${TOOLSET}" = "unb1" ]; then
+    . ${RADIOHDL}/tools/quartus/quartus_version.sh 11.1
+    . ${RADIOHDL}/tools/modelsim/modelsim_version.sh 6.6c
+  elif [ "${TOOLSET}" = "unb2" ]; then
+    . ${RADIOHDL}/tools/quartus/quartus_version.sh 14.1
+    . ${RADIOHDL}/tools/modelsim/modelsim_version.sh 10.4
+    # Next line may be needed, but comment it if it yields ld.so errors
+    export LD_PRELOAD=/home/software/freetype2/usr/lib/libfreetype.so
+  else
+    echo "error: unknown tool setting: ${TOOLSET} (choose 'unb1' or 'unb2')"
+    exit 1
+  fi # "${TOOLSET}" 
+fi # "${SITE}"
+
+
 
 # Remarks:
 # - No need for MODELSIM_TCL environment variable and modelsim.tcl, because these are not preferred and instead call commands.do via -do argument.
diff --git a/tools/quartus/set_quartus b/tools/quartus/set_quartus
index 8dc1f4ed31..6248db37d4 100755
--- a/tools/quartus/set_quartus
+++ b/tools/quartus/set_quartus
@@ -30,17 +30,30 @@
 
 # Select target
 TOOLSET=${1:-}
-echo "Make Quartus settings for RadioHDL with tool setting: ${TOOLSET}"
+echo "Make Quartus settings for RadioHDL with :"
+echo "  - Tool setting: ${TOOLSET}"
+echo "  - Site setting: ${SITE}"
 
 # Select tool version
-if [ "${TOOLSET}" = "unb1" ]; then
-  . ${RADIOHDL}/tools/quartus/quartus_version.sh 11.1
-elif [ "${TOOLSET}" = "unb2" ]; then
-  . ${RADIOHDL}/tools/quartus/quartus_version.sh 14.1
-else
-  echo "error: unknown tool setting: ${TOOLSET} (choose 'unb1' or 'unb2')"
-  exit 1
-fi
+if [ "${SITE}" = "USN" ]; then
+  if [ "${TOOLSET}" = "unb1" ]; then
+    . ${RADIOHDL}/tools/quartus/quartus_version.sh 11.1sp2
+  elif [ "${TOOLSET}" = "unb2" ]; then
+    . ${RADIOHDL}/tools/quartus/quartus_version.sh 14.1
+  else
+    echo "error: unknown tool setting: ${TOOLSET} (choose 'unb1' or 'unb2')"
+    exit 1
+  fi
+else # default site
+  if [ "${TOOLSET}" = "unb1" ]; then
+    . ${RADIOHDL}/tools/quartus/quartus_version.sh 11.1
+  elif [ "${TOOLSET}" = "unb2" ]; then
+    . ${RADIOHDL}/tools/quartus/quartus_version.sh 14.1
+  else
+    echo "error: unknown tool setting: ${TOOLSET} (choose 'unb1' or 'unb2')"
+    exit 1
+  fi
+fi # "${SITE}"
 
 # Tool settings
 . ${RADIOHDL}/tools/quartus/quartus_generic.sh
-- 
GitLab