diff options
-rw-r--r-- | libraries/vendors/README.md | 15 | ||||
-rwxr-xr-x | libraries/vendors/compile-altera.sh | 25 | ||||
-rwxr-xr-x | libraries/vendors/compile-lattice.sh | 28 | ||||
-rwxr-xr-x | libraries/vendors/compile-osvvm.sh | 8 | ||||
-rwxr-xr-x | libraries/vendors/compile-vunit.sh | 8 | ||||
-rwxr-xr-x | libraries/vendors/compile-xilinx-ise.sh | 32 | ||||
-rwxr-xr-x | libraries/vendors/compile-xilinx-vivado.sh | 32 | ||||
-rw-r--r-- | libraries/vendors/config.sh | 24 | ||||
-rw-r--r-- | libraries/vendors/shared.sh | 22 |
9 files changed, 138 insertions, 56 deletions
diff --git a/libraries/vendors/README.md b/libraries/vendors/README.md index 90360ebe7..31e455a4c 100644 --- a/libraries/vendors/README.md +++ b/libraries/vendors/README.md @@ -10,7 +10,7 @@ and [VUnit][vunit], which can be pre-compile. The compilation scripts are writen in shell languages: PowerShell for Windows and Bash for Linux. The compile scripts can colorize the GHDL warning and error -lines with the help of grc ([generic colourizer][grc]). +lines with the help of grc/grcat ([generic colourizer][grc]). [osvvm]: http://osvvm.org/ [vunit]: https://github.com/LarsAsplund/vunit @@ -18,7 +18,7 @@ lines with the help of grc ([generic colourizer][grc]). ##### Supported Vendors Libraries - - Altera Quartus (13.x): + - Altera Quartus (≥13.0): - lpm, sgate - altera, altera_mf, altera_lnsim - arriaii, arriaii_pcie_hip, arriaiigz @@ -29,11 +29,18 @@ lines with the help of grc ([generic colourizer][grc]). - stratixiv, stratixiv_pcie_hip - stratixv, stratixv_pcie_hip - fiftyfivenm, twentynm - - Xilinx ISE (14.7): + - Lattice (≥3.6): + - ec + - ecp, ecp2, ecp3, ecp5u + - lptm, lptm2 + - machxo, machxo2, machxo3l + - sc, scm + - xp, xp2 + - Xilinx ISE (≥14.0): - unisim (incl. secureip) - unimacro - simprim (incl. secureip) - - Xilinx Vivado (2015.x): + - Xilinx Vivado (≥2014.1): - unisim (incl. secureip) - unimacro diff --git a/libraries/vendors/compile-altera.sh b/libraries/vendors/compile-altera.sh index deef5bedd..afb2ffbae 100755 --- a/libraries/vendors/compile-altera.sh +++ b/libraries/vendors/compile-altera.sh @@ -47,6 +47,7 @@ source $ScriptDir/shared.sh # command line argument processing NO_COMMAND=1 SKIP_EXISTING_FILES=0 +SKIP_LARGE_FILES=0 SUPPRESS_WARNINGS=0 HALT_ON_ERROR=0 VHDLStandard=93 @@ -134,12 +135,12 @@ while [[ $# > 0 ]]; do shift # past argument or value done -if [ "$NO_COMMAND" == "TRUE" ]; then +if [ $NO_COMMAND -eq 1 ]; then HELP=TRUE fi if [ "$HELP" == "TRUE" ]; then - test "$NO_COMMAND" == "TRUE" && echo 1>&2 -e "${COLORED_ERROR} No command selected." + test $NO_COMMAND -eq 1 && echo 1>&2 -e "\n${COLORED_ERROR} No command selected." echo "" echo "Synopsis:" echo " A script to compile the Altera Quartus simulation libraries for GHDL on Linux." @@ -170,9 +171,9 @@ if [ "$HELP" == "TRUE" ]; then echo " -H --halt-on-error Halt on error(s)." echo "" echo "Advanced options:" - echo " --ghdl <GHDL BinDir> Path to GHDL binary directory e.g. /usr/bin." + echo " --ghdl <GHDL Binary> Path to GHDL's binary e.g. /usr/local/bin/ghdl." echo " --out <dir name> Name of the output directory." - echo " --src <Path to OSVVM> Name of the output directory." + echo " --src <Path to OSVVM> Path to the source directory." echo "" echo "Verbosity:" echo " -n --no-warnings Suppress all warnings. Show only error messages." @@ -189,6 +190,22 @@ if [ "$COMPILE_ALL" == "TRUE" ]; then COMPILE_NM=TRUE fi +DefaultDirectories=("/opt/Altera" "/opt/altera") +if [ ! -z $QUARTUS_ROOTDIR ]; then + EnvSourceDir=$QUARTUS_ROOTDIR/${SourceDirectories[AlteraQuartus]} +else + for DefaultDir in ${DefaultDirectories[@]}; do + for Major in 17 16 15 14 13; do + for Minor in 3 2 1 0; do + Dir=$DefaultDir/${Major}.${Minor}/quartus + if [ -d $Dir ]; then + EnvSourceDir=$Dir/${SourceDirectories[AlteraQuartus]} + break 3 + fi + done + done + done +fi # -> $SourceDirectories # -> $DestinationDirectories diff --git a/libraries/vendors/compile-lattice.sh b/libraries/vendors/compile-lattice.sh index 58a01c7d1..860024d6c 100755 --- a/libraries/vendors/compile-lattice.sh +++ b/libraries/vendors/compile-lattice.sh @@ -115,12 +115,12 @@ while [[ $# > 0 ]]; do shift # past argument or value done -if [ "$NO_COMMAND" == "TRUE" ]; then +if [ $NO_COMMAND -eq 1 ]; then HELP=TRUE fi if [ "$HELP" == "TRUE" ]; then - test "$NO_COMMAND" == "TRUE" && echo 1>&2 -e "${COLORED_ERROR} No command selected." + test $NO_COMMAND -eq 1 && echo 1>&2 -e "\n${COLORED_ERROR} No command selected." echo "" echo "Synopsis:" echo " A script to compile the Lattice Diamond simulation libraries for GHDL on Linux." @@ -146,9 +146,9 @@ if [ "$HELP" == "TRUE" ]; then echo " -H --halt-on-error Halt on error(s)." echo "" echo "Advanced options:" - echo " --ghdl <GHDL BinDir> Path to GHDL binary directory e.g. /usr/bin." + echo " --ghdl <GHDL Binary> Path to GHDL's binary e.g. /usr/local/bin/ghdl." echo " --out <dir name> Name of the output directory." - echo " --src <Path to OSVVM> Name of the output directory." + echo " --src <Path to OSVVM> Path to the source directory." echo "" echo "Verbosity:" echo " -n --no-warnings Suppress all warnings. Show only error messages." @@ -157,9 +157,27 @@ if [ "$HELP" == "TRUE" ]; then fi +DefaultDirectories=("/usr/local/diamond" "/opt/Diamond" "/opt/diamond") +if [ ! -z $LSC_DIAMOND ]; then + EnvSourceDir=$FOUNDRY/../cae_library/simulation/vhdl +else + for DefaultDir in ${DefaultDirectories[@]}; do + for Major in 3; do + for Minor in 8 7 6 5; do + Dir=$DefaultDir/${Major}.${Minor}_x64 + if [ -d $Dir ]; then + EnvSourceDir=$Dir/cae_library/simulation/vhdl + break 3 + fi + done + done + done +fi + # -> $SourceDirectories # -> $DestinationDirectories # -> $SrcDir +# -> $EnvSourceDir # -> $DestDir # -> $GHDLBinDir # <= $SourceDirectory @@ -241,7 +259,7 @@ for device in $DeviceList; do echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}" else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" - ghdl -a ${GHDL_PARAMS[@]} --work=$Library -o "${FileName%.*}.o" "$File" 2>&1 | $GRC_COMMAND + $GHDLBinary -a ${GHDL_PARAMS[@]} --work=$Library "$File" 2>&1 | $GRC_COMMAND if [ $? -ne 0 ]; then let ERRORCOUNT++ test $HALT_ON_ERROR -eq 1 && break 2 diff --git a/libraries/vendors/compile-osvvm.sh b/libraries/vendors/compile-osvvm.sh index 38aea81d6..f7bbdba5f 100755 --- a/libraries/vendors/compile-osvvm.sh +++ b/libraries/vendors/compile-osvvm.sh @@ -98,12 +98,12 @@ done # makes no sense to enable it for OSVVM SKIP_EXISTING_FILES=0 -if [ "$NO_COMMAND" == "TRUE" ]; then +if [ $NO_COMMAND -eq 1 ]; then HELP=TRUE fi if [ "$HELP" == "TRUE" ]; then - test "$NO_COMMAND" == "TRUE" && echo 1>&2 -e "${COLORED_ERROR} No command selected." + test $NO_COMMAND -eq 1 && echo 1>&2 -e "\n${COLORED_ERROR} No command selected." echo "" echo "Synopsis:" echo " A script to compile the simulation library 'OSVVM' for GHDL on Linux." @@ -127,9 +127,9 @@ if [ "$HELP" == "TRUE" ]; then echo " -H --halt-on-error Halt on error(s)." echo "" echo "Advanced options:" - echo " --ghdl <GHDL BinDir> Path to GHDL binary directory e.g. /usr/bin." + echo " --ghdl <GHDL Binary> Path to GHDL's binary e.g. /usr/local/bin/ghdl." echo " --out <dir name> Name of the output directory." - echo " --src <Path to OSVVM> Name of the output directory." + echo " --src <Path to OSVVM> Path to the source directory." echo "" echo "Verbosity:" echo " -n --no-warnings Suppress all warnings. Show only error messages." diff --git a/libraries/vendors/compile-vunit.sh b/libraries/vendors/compile-vunit.sh index 0d38a4acc..1bdace797 100755 --- a/libraries/vendors/compile-vunit.sh +++ b/libraries/vendors/compile-vunit.sh @@ -98,12 +98,12 @@ done # makes no sense to enable it for VUnit SKIP_EXISTING_FILES=0 -if [ "$NO_COMMAND" == "TRUE" ]; then +if [ $NO_COMMAND -eq 1 ]; then HELP=TRUE fi if [ "$HELP" == "TRUE" ]; then - test "$NO_COMMAND" == "TRUE" && echo 1>&2 -e "${COLORED_ERROR} No command selected." + test $NO_COMMAND -eq 1 && echo 1>&2 -e "\n${COLORED_ERROR} No command selected." echo "" echo "Synopsis:" echo " A script to compile the simulation library 'vunit_lib' for GHDL on Linux." @@ -125,9 +125,9 @@ if [ "$HELP" == "TRUE" ]; then echo " -H --halt-on-error Halt on error(s)." echo "" echo "Advanced options:" - echo " --ghdl <GHDL BinDir> Path to GHDL binary directory e.g. /usr/bin." + echo " --ghdl <GHDL Binary> Path to GHDL's binary e.g. /usr/local/bin/ghdl." echo " --out <dir name> Name of the output directory." - echo " --src <Path to OSVVM> Name of the output directory." + echo " --src <Path to OSVVM> Path to the source directory." echo "" echo "Verbosity:" echo " -n --no-warnings Suppress all warnings. Show only error messages." diff --git a/libraries/vendors/compile-xilinx-ise.sh b/libraries/vendors/compile-xilinx-ise.sh index a3aa3f3c7..443322c0e 100755 --- a/libraries/vendors/compile-xilinx-ise.sh +++ b/libraries/vendors/compile-xilinx-ise.sh @@ -122,12 +122,12 @@ while [[ $# > 0 ]]; do shift # past argument or value done -if [ "$NO_COMMAND" == "TRUE" ]; then +if [ $NO_COMMAND -eq 1 ]; then HELP=TRUE fi if [ "$HELP" == "TRUE" ]; then - test "$NO_COMMAND" == "TRUE" && echo 1>&2 -e "${COLORED_ERROR} No command selected." + test $NO_COMMAND -eq 1 && echo 1>&2 -e "\n${COLORED_ERROR} No command selected." echo "" echo "Synopsis:" echo " A script to compile the Xilinx ISE simulation libraries for GHDL on Linux." @@ -156,9 +156,9 @@ if [ "$HELP" == "TRUE" ]; then echo " -H --halt-on-error Halt on error(s)." echo "" echo "Advanced options:" - echo " --ghdl <GHDL BinDir> Path to GHDL binary directory e.g. /usr/bin." + echo " --ghdl <GHDL Binary> Path to GHDL's binary e.g. /usr/local/bin/ghdl." echo " --out <dir name> Name of the output directory." - echo " --src <Path to OSVVM> Name of the output directory." + echo " --src <Path to OSVVM> Path to the source directory." echo "" echo "Verbosity:" echo " -n --no-warnings Suppress all warnings. Show only error messages." @@ -175,13 +175,31 @@ fi if [ $VHDLStandard -eq 2008 ]; then echo -e "${ANSI_RED}Not all Xilinx primitives are VHDL-2008 compatible! Setting HALT_ON_ERROR to FALSE.${ANSI_RESET}" - HALT_ON_ERROR=FALSE + HALT_ON_ERROR=0 fi +DefaultDirectories=("/opt/Xilinx" "/opt/xilinx") +if [ ! -z $XILINX ]; then + EnvSourceDir=$XILINX/vhdl/src +else + for DefaultDir in ${DefaultDirectories[@]}; do + for Major in 14 13; do + for Minor in 7 6 5 4 3 2 1 0; do + Dir=$DefaultDir/${Major}.${Minor}/ISE_DS/ISE + if [ -d $Dir ]; then + EnvSourceDir=$Dir/vhdl/src + break 3 + fi + done + done + done +fi + # -> $SourceDirectories # -> $DestinationDirectories # -> $SrcDir +# -> $EnvSourceDir # -> $DestDir # -> $GHDLBinDir # <= $SourceDirectory @@ -195,7 +213,7 @@ CreateDestinationDirectory cd $DestinationDirectory -# => $SUPPRESS_WARNINGS +# -> $SUPPRESS_WARNINGS # <= $GRC_COMMAND SetupGRCat @@ -206,11 +224,9 @@ SetupGRCat # <= $VHDLFlavor GHDLSetup - # define global GHDL Options GHDL_OPTIONS=(-fexplicit -frelaxed-rules --no-vital-checks --warn-binding --mb-comments) - GHDL_PARAMS=(${GHDL_OPTIONS[@]}) GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard -P$DestinationDirectory) diff --git a/libraries/vendors/compile-xilinx-vivado.sh b/libraries/vendors/compile-xilinx-vivado.sh index f319b0e02..f825c3a1e 100755 --- a/libraries/vendors/compile-xilinx-vivado.sh +++ b/libraries/vendors/compile-xilinx-vivado.sh @@ -63,7 +63,7 @@ while [[ $# > 0 ]]; do ;; -a|--all) COMPILE_ALL=TRUE - NO_COMMAND=FALSE + NO_COMMAND=0 ;; --unisim) COMPILE_UNISIM=TRUE @@ -118,12 +118,12 @@ while [[ $# > 0 ]]; do shift # past argument or value done -if [ "$NO_COMMAND" == "TRUE" ]; then +if [ $NO_COMMAND -eq 1 ]; then HELP=TRUE fi if [ "$HELP" == "TRUE" ]; then - test "$NO_COMMAND" == "TRUE" && echo 1>&2 -e "${COLORED_ERROR} No command selected." + test $NO_COMMAND -eq 1 && echo 1>&2 -e "\n${COLORED_ERROR} No command selected." echo "" echo "Synopsis:" echo " A script to compile the Xilinx Vivado simulation libraries for GHDL on Linux." @@ -151,9 +151,9 @@ if [ "$HELP" == "TRUE" ]; then echo " -H --halt-on-error Halt on error(s)." echo "" echo "Advanced options:" - echo " --ghdl <GHDL BinDir> Path to GHDL binary directory e.g. /usr/bin." + echo " --ghdl <GHDL Binary> Path to GHDL's binary e.g. /usr/local/bin/ghdl." echo " --out <dir name> Name of the output directory." - echo " --src <Path to OSVVM> Name of the output directory." + echo " --src <Path to OSVVM> Path to the source directory." echo "" echo "Verbosity:" echo " -n --no-warnings Suppress all warnings. Show only error messages." @@ -169,13 +169,31 @@ fi if [ $VHDLStandard -eq 2008 ]; then echo -e "${ANSI_RED}Not all Xilinx primitives are VHDL-2008 compatible! Setting HALT_ON_ERROR to FALSE.${ANSI_RESET}" - HALT_ON_ERROR=FALSE + HALT_ON_ERROR=0 fi +DefaultDirectories=("/opt/Xilinx/Vivado" "/opt/xilinx/Vivado") +if [ ! -z $XILINX_VIVADO ]; then + EnvSourceDir=$XILINX_VIVADO/vhdl/src +else + for DefaultDir in ${DefaultDirectories[@]}; do + for Major in 2017 2016 2015 2014; do + for Minor in 4 3 2 1; do + Dir=$DefaultDir/${Major}.${Minor} + if [ -d $Dir ]; then + EnvSourceDir=$Dir/${SourceDirectories[XilinxVivado]} + break 3 + fi + done + done + done +fi + # -> $SourceDirectories # -> $DestinationDirectories # -> $SrcDir +# -> $EnvSourceDir # -> $DestDir # -> $GHDLBinDir # <= $SourceDirectory @@ -200,11 +218,9 @@ SetupGRCat # <= $VHDLFlavor GHDLSetup - # define global GHDL Options GHDL_OPTIONS=(-fexplicit -frelaxed-rules --no-vital-checks --warn-binding --mb-comments) - GHDL_PARAMS=(${GHDL_OPTIONS[@]}) GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard -P$DestinationDirectory) diff --git a/libraries/vendors/config.sh b/libraries/vendors/config.sh index 813c609ea..52cf6ec3d 100644 --- a/libraries/vendors/config.sh +++ b/libraries/vendors/config.sh @@ -40,12 +40,12 @@ # These values are used if no command line argument (--src) is passed to a # compile script. Empty strings means not configured. declare -A InstallationDirectories -InstallationDirectories[AlteraQuartus]="/opt/altera/16.0" -InstallationDirectories[XilinxISE]="/opt/Xilinx/14.7" -InstallationDirectories[XilinxVivado]="/opt/Xilinx/Vivado/2016.2" -InstallationDirectories[LatticeDiamond]="/usr/local/diamond/3.7_x64" -InstallationDirectories[OSVVM]="/home/paebbels/git/PoC/lib/osvvm" -InstallationDirectories[VUnit]="/home/paebbels/git/PoC/lib/vunit" +InstallationDirectories[AlteraQuartus]="" # "/opt/altera/16.0/quartus" +InstallationDirectories[XilinxISE]="" # "/opt/Xilinx/14.7/ISE_DS/ISE" +InstallationDirectories[XilinxVivado]="" # "/opt/Xilinx/Vivado/2016.2" +InstallationDirectories[LatticeDiamond]="" # "/usr/local/diamond/3.7_x64" +InstallationDirectories[OSVVM]="" # "~/git/github/osvvm" +InstallationDirectories[VUnit]="" # "~/git/github/vunit" # Configure preferred output directories for each library set: declare -A DestinationDirectories @@ -58,12 +58,12 @@ DestinationDirectories[VUnit]="." # "vunit_lib" # Declare source directories depending on the installation paths: declare -A SourceDirectories -SourceDirectories[AlteraQuartus]="${InstallationDirectories[AlteraQuartus]}/quartus/eda/sim_lib" -SourceDirectories[XilinxISE]="${InstallationDirectories[XilinxISE]}/ISE_DS/ISE/vhdl/src" -SourceDirectories[XilinxVivado]="${InstallationDirectories[XilinxVivado]}/data/vhdl/src" -SourceDirectories[LatticeDiamond]="${InstallationDirectories[LatticeDiamond]}/cae_library/simulation/vhdl" -SourceDirectories[OSVVM]="${InstallationDirectories[OSVVM]}" -SourceDirectories[VUnit]="${InstallationDirectories[VUnit]}/vunit/vhdl" +SourceDirectories[AlteraQuartus]="eda/sim_lib" +SourceDirectories[XilinxISE]="vhdl/src" +SourceDirectories[XilinxVivado]="data/vhdl/src" +SourceDirectories[LatticeDiamond]="cae_library/simulation/vhdl" +SourceDirectories[OSVVM]="." +SourceDirectories[VUnit]="vunit/vhdl" # input files greater than $LARGE_FILESIZE are skipped if '--skip-largefiles' is set LARGE_FILESIZE=125000 diff --git a/libraries/vendors/shared.sh b/libraries/vendors/shared.sh index 690e5008b..6becba2ef 100644 --- a/libraries/vendors/shared.sh +++ b/libraries/vendors/shared.sh @@ -1,4 +1,3 @@ -#! /bin/bash # EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*- # vim: tabstop=2:shiftwidth=2:noexpandtab # kate: tab-width 2; replace-tabs off; indent-width 2; @@ -54,22 +53,25 @@ SetupDirectories() { Index=$1 Name=$2 - SourceDirectory=${SourceDirectories[$Index]} - DestinationDirectory=${DestinationDirectories[$Index]} - # source directory # ---------------------- # If a command line argument ('--src') was passed in, use it, else use the default value # from config.sh if [ ! -z "$SrcDir" ]; then - SourceDirectory=$SrcDir + SourceDirectory=${SrcDir%/} # remove trailing slashes + elif [ ! -z "$EnvSourceDir" ]; then + SourceDirectory=$EnvSourceDir # fall back to environment variable + elif [ ! -z "${InstallationDirectories[$Index]}" ]; then + SourceDirectory=${InstallationDirectories[$Index]}/${SourceDirectories[$Index]} # fall back to value from config.sh fi # output directory # ---------------------- # If a command line argument ('--out') was passed in, use it, else use the default value # from config.sh if [ ! -z "$DestDir" ]; then - DestinationDirectory=$DestDir + DestinationDirectory=${DestDir%/} # remove trailing slashes + else + DestinationDirectory=${DestinationDirectories[$Index]} # fall back to value from config.sh fi if [ -z $SourceDirectory ] || [ -z $DestinationDirectory ]; then @@ -87,11 +89,17 @@ SetupDirectories() { # Use GHDL binary directory from command line argument, if set if [ ! -z "$GHDLBinDir" ]; then - GHDLBinary=$GHDLBinDir/ghdl + GHDLBinary=${GHDLBinDir%/}/ghdl # remove trailing slashes if [[ ! -x "$GHDLBinary" ]]; then echo 1>&2 -e "${COLORED_ERROR} GHDL not found or is not executable.${ANSI_RESET}" exit -1 fi + elif [ ! -z "$GHDL" ]; then + if [[ ! -x "$GHDL" ]]; then + echo 1>&2 -e "${COLORED_ERROR} Found GHDL1 environment variable, but GHDL is not executable.${ANSI_RESET}" + exit -1 + fi + GHDLBinary=$GHDL else # fall back to GHDL found via PATH GHDLBinary=$(which ghdl 2>/dev/null) if [ $? -ne 0 ]; then |