aboutsummaryrefslogtreecommitdiffstats
path: root/libraries
diff options
context:
space:
mode:
authorPatrick Lehmann <Patrick.Lehmann@tu-dresden.de>2016-06-17 07:39:31 +0200
committertgingold <tgingold@users.noreply.github.com>2016-06-17 07:39:31 +0200
commit1e75c3ba423254a85eb990f235d429b30978424a (patch)
treec5ff926357404b562c4f03c3fa714fc56e2d8e11 /libraries
parent2040f51363625a2d106fd65a769707aa9a1ef629 (diff)
downloadghdl-1e75c3ba423254a85eb990f235d429b30978424a.tar.gz
ghdl-1e75c3ba423254a85eb990f235d429b30978424a.tar.bz2
ghdl-1e75c3ba423254a85eb990f235d429b30978424a.zip
Reworked vendor library compile scripts for Altera, Lattice and Xilinx as well as OSVVM and VUnit. (#82)
- Partial VHDL2008 support. - Refectored reusable code into Bash functions. - Generate GHDL output into the new directory structure -> lib/v93 / lib/v08 - Added new CLI parameters: - src -> source folder - out -> output folder - ghdl -> ghdl binary directory
Diffstat (limited to 'libraries')
-rw-r--r--libraries/vendors/README.md20
-rwxr-xr-xlibraries/vendors/compile-altera.sh1031
-rwxr-xr-xlibraries/vendors/compile-lattice.sh247
-rwxr-xr-xlibraries/vendors/compile-osvvm.sh179
-rwxr-xr-xlibraries/vendors/compile-vunit.sh259
-rwxr-xr-xlibraries/vendors/compile-xilinx-ise.sh422
-rwxr-xr-xlibraries/vendors/compile-xilinx-vivado.sh361
-rw-r--r--libraries/vendors/config.sh42
-rw-r--r--libraries/vendors/shared.sh141
9 files changed, 1193 insertions, 1509 deletions
diff --git a/libraries/vendors/README.md b/libraries/vendors/README.md
index 3486a1556..90360ebe7 100644
--- a/libraries/vendors/README.md
+++ b/libraries/vendors/README.md
@@ -1,10 +1,16 @@
## Compile Scripts for Vendor VHDL Libraries
-Vendors like Altera and Xilinx have there own simulation libraries, especially for primitives, soft or hard macros. These libraries can not be shipped with GHDL, but we offer prepared compile scripts to pre-compile a vendor library, if the vendor tool is present on the computer.
+Vendors like Altera and Xilinx have there own simulation libraries, especially
+for primitives, soft or hard macros. These libraries can not be shipped with
+GHDL, but we offer prepared compile scripts to pre-compile a vendor library,
+if the vendor tool is present on the computer.
-There are also popular simulation and verification libraries like [OSVVM][osvvm] and [VUnit][vunit], which can be pre-compile.
+There are also popular simulation and verification libraries like [OSVVM][osvvm]
+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]).
+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]).
[osvvm]: http://osvvm.org/
[vunit]: https://github.com/LarsAsplund/vunit
@@ -12,7 +18,7 @@ The compilation scripts are writen in shell languages: PowerShell for Windows an
##### Supported Vendors Libraries
- - Altera Quartus-II (15.x):
+ - Altera Quartus (13.x):
- lpm, sgate
- altera, altera_mf, altera_lnsim
- arriaii, arriaii_pcie_hip, arriaiigz
@@ -126,9 +132,9 @@ The compilation scripts are writen in shell languages: PowerShell for Windows an
---- ------------- ------ ----
d---- 20.11.2015 19:33 <DIR> altera
d---- 20.11.2015 19:38 <DIR> osvvm
- d---- 20.11.2015 19:40 <DIR> vivado
- d---- 20.11.2015 19:45 <DIR> vunit
- d---- 20.11.2015 19:06 <DIR> xilinx
+ d---- 20.11.2015 19:45 <DIR> vunit_lib
+ d---- 20.11.2015 19:06 <DIR> xilinx-ise
+ d---- 20.11.2015 19:40 <DIR> xilinx-vivado
```
### Selectable Options for the Bash Scripts:
diff --git a/libraries/vendors/compile-altera.sh b/libraries/vendors/compile-altera.sh
index d73a5fabd..deef5bedd 100755
--- a/libraries/vendors/compile-altera.sh
+++ b/libraries/vendors/compile-altera.sh
@@ -4,11 +4,11 @@
# kate: tab-width 2; replace-tabs off; indent-width 2;
#
# ==============================================================================
+# Authors: Patrick Lehmann
+#
# Bash Script: Script to compile the simulation libraries from Altera
# Quartus-II for GHDL on Linux
#
-# Authors: Patrick Lehmann
-#
# Description:
# ------------------------------------
# This is a Bash script (executable) which:
@@ -16,7 +16,7 @@
# - compiles all Altera Quartus-II simulation libraries and packages
#
# ==============================================================================
-# Copyright (C) 2015 Patrick Lehmann
+# Copyright (C) 2015-2016 Patrick Lehmann
#
# GHDL 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
@@ -38,77 +38,97 @@
# save working directory
WorkingDir=$(pwd)
ScriptDir="$(dirname $0)"
-ScriptDir="$(realpath $ScriptDir)"
+ScriptDir="$(readlink -f $ScriptDir)"
# source configuration file from GHDL's 'vendors' library directory
source $ScriptDir/config.sh
source $ScriptDir/shared.sh
-NO_COMMAND=TRUE
-
# command line argument processing
+NO_COMMAND=1
+SKIP_EXISTING_FILES=0
+SUPPRESS_WARNINGS=0
+HALT_ON_ERROR=0
+VHDLStandard=93
+GHDLBinDir=""
+DestDir=""
+SrcDir=""
while [[ $# > 0 ]]; do
key="$1"
case $key in
-c|--clean)
CLEAN=TRUE
- NO_COMMAND=FALSE
+ NO_COMMAND=0
;;
-a|--all)
- ALL=TRUE
- NO_COMMAND=FALSE
- ;;
- -s|--skip-existing)
- SKIP_EXISTING_FILES=TRUE
- ;;
- -S|--skip-largefiles)
- SKIP_LARGE_FILES=TRUE
- ;;
- -n|--no-warnings)
- SUPPRESS_WARNINGS=TRUE
- ;;
- -H|--halt-on-error)
- HALT_ON_ERROR=TRUE
- ;;
-# -v|--verbose)
-# VERBOSE=TRUE
-# ;;
- -h|--help)
- HELP=TRUE
- NO_COMMAND=FALSE
+ COMPILE_ALL=TRUE
+ NO_COMMAND=0
;;
--altera)
- ALTERA=TRUE
- NO_COMMAND=FALSE
+ COMPILE_ALTERA=TRUE
+ NO_COMMAND=0
;;
--max)
- MAX=TRUE
- NO_COMMAND=FALSE
+ COMPILE_MAX=TRUE
+ NO_COMMAND=0
;;
--cyclone)
- CYCLONE=TRUE
- NO_COMMAND=FALSE
+ COMPILE_CYCLONE=TRUE
+ NO_COMMAND=0
;;
--arria)
- ARRIA=TRUE
- NO_COMMAND=FALSE
+ COMPILE_ARRIA=TRUE
+ NO_COMMAND=0
;;
--stratix)
- STRATIX=TRUE
- NO_COMMAND=FALSE
+ COMPILE_STRATIX=TRUE
+ NO_COMMAND=0
;;
--nanometer)
- NANOMETER=TRUE
- NO_COMMAND=FALSE
+ COMPILE_NM=TRUE
+ NO_COMMAND=0
+ ;;
+ -h|--help)
+ HELP=TRUE
+ NO_COMMAND=0
+ ;;
+ -s|--skip-existing)
+ SKIP_EXISTING_FILES=1
+ ;;
+ -S|--skip-largefiles)
+ SKIP_LARGE_FILES=1
+ ;;
+ -n|--no-warnings)
+ SUPPRESS_WARNINGS=1
+ ;;
+ -H|--halt-on-error)
+ HALT_ON_ERROR=1
;;
--vhdl93)
- VHDL93=TRUE
+ VHDLStandard=93
;;
--vhdl2008)
- VHDL2008=TRUE
+ VHDLStandard=2008
+ echo 1>&2 -e "${COLORED_ERROR} VHDL-2008 is not yet supported by Altera.${ANSI_RESET}"
+ echo 1>&2 -e "${ANSI_YELLOW}Possible workaround: ${ANSI_RESET}"
+ echo 1>&2 -e "${ANSI_YELLOW} Compile 'std_logic_arith' and 'std_logic_unsigned' into library IEEE.${ANSI_RESET}"
+ exit -1
+ ;;
+ --ghdl)
+ GHDLBinDir="$2"
+ shift # skip argument
+ ;;
+ --src)
+ SrcDir="$2"
+ shift # skip argument
+ ;;
+ --out)
+ DestDir="$2"
+ shift # skip argument
;;
*) # unknown option
- UNKNOWN_OPTION=TRUE
+ echo 1>&2 -e "${COLORED_ERROR} Unknown command line option.${ANSI_RESET}"
+ exit -1
;;
esac
shift # past argument or value
@@ -118,798 +138,551 @@ if [ "$NO_COMMAND" == "TRUE" ]; then
HELP=TRUE
fi
-if [ "$UNKNOWN_OPTION" == "TRUE" ]; then
- echo -e $COLORED_ERROR "Unknown command line option.${ANSI_RESET}"
- exit -1
-elif [ "$HELP" == "TRUE" ]; then
- if [ "$NO_COMMAND" == "TRUE" ]; then
- echo -e $COLORED_ERROR " No command selected."
- fi
+if [ "$HELP" == "TRUE" ]; then
+ test "$NO_COMMAND" == "TRUE" && echo 1>&2 -e "${COLORED_ERROR} No command selected."
echo ""
echo "Synopsis:"
- echo " Script to compile the simulation libraries from Altera Quartus-II for GHDL on Linux"
+ echo " A script to compile the Altera Quartus simulation libraries for GHDL on Linux."
+ echo " One library folder 'lib/v??' per VHDL library will be created relative to the current"
+ echo " working directory."
echo ""
echo "Usage:"
- echo " compile-altera.sh <common command>|<library> [<options>]"
-# [-v] [-c] [--unisim] [--unimacro] [--simprim] [--secureip] [-s|--skip-existing] [-S|--skip-largefiles] [-n|--no-warnings]
+ echo " compile-altera.sh <common command>|<library> [<options>] [<adv. options>]"
echo ""
echo "Common commands:"
- echo " -h --help Print this help page"
- echo " -c --clean Remove all generated files"
+ echo " -h --help Print this help page"
+ echo " -c --clean Remove all generated files"
echo ""
echo "Libraries:"
- echo " -a --all Compile all Altera simulation libraries."
- echo " --altera Compile the Altera standard libraries: lpm, sgate, altera, altera_mf, altera_lnsim."
- echo " --max Compile the Altera Max device libraries."
- echo " --cyclone Compile the Altera Cyclone device libraries."
- echo " --arria Compile the Altera Arria device libraries."
- echo " --stratix Compile the Altera Stratix device libraries."
- echo " --nanometer Unknown device library."
+ echo " -a --all Compile all Altera simulation libraries."
+ echo " --altera Compile the Altera standard libraries: lpm, sgate, altera, altera_mf, altera_lnsim."
+ echo " --max Compile the Altera Max device libraries."
+ echo " --cyclone Compile the Altera Cyclone device libraries."
+ echo " --arria Compile the Altera Arria device libraries."
+ echo " --stratix Compile the Altera Stratix device libraries."
+ echo " --nanometer Unknown device library."
echo ""
echo "Library compile options:"
- echo " --vhdl93 Compile the libraries with VHDL-93."
- echo " --vhdl2008 Compile the libraries with VHDL-2008."
- echo " -s --skip-existing Skip already compiled files (an *.o file exists)."
- echo " -S --skip-largefiles Don't compile large entities like DSP and PCIe primitives."
- echo " -H --halt-on-error Halt on error(s)."
+ echo " --vhdl93 Compile the libraries with VHDL-93."
+ echo " --vhdl2008 Compile the libraries with VHDL-2008."
+ echo " -s --skip-existing Skip already compiled files (an *.o file exists)."
+ echo " -S --skip-largefiles Don't compile large files. Exclude *HSSI* and *HIP* files."
+ 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 " --out <dir name> Name of the output directory."
+ echo " --src <Path to OSVVM> Name of the output directory."
echo ""
echo "Verbosity:"
-# echo " -v --verbose Print more messages"
- echo " -n --no-warnings Suppress all warnings. Show only error messages."
+ echo " -n --no-warnings Suppress all warnings. Show only error messages."
echo ""
exit 0
fi
-if [ "$ALL" == "TRUE" ]; then
- ALTERA=TRUE
- MAX=TRUE
- CYCLONE=TRUE
- ARRIA=TRUE
- STRATIX=TRUE
- NANOMETER=TRUE
+if [ "$COMPILE_ALL" == "TRUE" ]; then
+ COMPILE_ALTERA=TRUE
+ COMPILE_MAX=TRUE
+ COMPILE_CYCLONE=TRUE
+ COMPILE_ARRIA=TRUE
+ COMPILE_STRATIX=TRUE
+ COMPILE_NM=TRUE
fi
-if [ "$VHDL93" == "TRUE" ]; then
- VHDLStandard="93c"
- VHDLFlavor="synopsys"
-elif [ "$VHDL2008" == "TRUE" ]; then
- VHDLStandard="08"
- VHDLFlavor="standard"
-else
- VHDLStandard="93c"
- VHDLFlavor="synopsys"
-fi
-# extract data from configuration
-SourceDir=${SourceDirectory[AlteraQuartus]}
-DestinationDir=${DestinationDirectory[AlteraQuartus]}
+# -> $SourceDirectories
+# -> $DestinationDirectories
+# -> $SrcDir
+# -> $DestDir
+# -> $GHDLBinDir
+# <= $SourceDirectory
+# <= $DestinationDirectory
+# <= $GHDLBinary
+SetupDirectories AlteraQuartus "Altera Quartus"
+
+# create "osvvm" directory and change to it
+# => $DestinationDirectory
+CreateDestinationDirectory
+cd $DestinationDirectory
+
+
+# => $SUPPRESS_WARNINGS
+# <= $GRC_COMMAND
+SetupGRCat
-if [ -z $DestinationDir ]; then
- echo -e "${COLORED_ERROR} Altera Quartus is not configured in '$ScriptDir/config.sh'${ANSI_RESET}"
- exit -1
-elif [ ! -d $SourceDir ]; then
- echo -e "${COLORED_ERROR} Path '$SourceDir' does not exist.${ANSI_RESET}"
- exit -1
-fi
-# set bash options
-set -o pipefail
+# -> $VHDLStandard
+# <= $VHDLVersion
+# <= $VHDLStandard
+# <= $VHDLFlavor
+GHDLSetup
# define global GHDL Options
GHDL_OPTIONS=(-fexplicit -frelaxed-rules --no-vital-checks --warn-binding --mb-comments)
-# create "altera" directory and change to it
-if [[ -d "$DestinationDir" ]]; then
- echo -e "${ANSI_YELLOW}Vendor directory '$DestinationDir' already exists.${ANSI_RESET}"
-else
- echo -e "${ANSI_YELLOW}Creating vendor directory: '$DestinationDir'${ANSI_RESET}"
- mkdir "$DestinationDir"
-fi
-cd $DestinationDir
-if [ -z "$(which grcat)" ]; then
- # if grcat (generic colourizer) is not installed, use a dummy pipe command like 'cat'
- GRC_COMMAND="cat"
-else
- if [ "$SUPPRESS_WARNINGS" == "TRUE" ]; then
- GRC_COMMAND="grcat $ScriptDir/ghdl.skipwarning.grcrules"
- else
- GRC_COMMAND="grcat $ScriptDir/ghdl.grcrules"
- fi
-fi
+GHDL_PARAMS=(${GHDL_OPTIONS[@]})
+GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard -P$DestinationDirectory)
-STOPCOMPILING=FALSE
+STOPCOMPILING=0
ERRORCOUNT=0
# Cleanup directory
# ==============================================================================
if [ "$CLEAN" == "TRUE" ]; then
+ echo 1>&2 -e "${COLORED_ERROR} '--clean' is not implemented!"
+ exit -1
echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_RESET}"
rm *.o 2> /dev/null
+ rm *.cf 2> /dev/null
fi
+
# Altera standard libraries
# ==============================================================================
# compile lpm library
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ALTERA" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'lpm' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ALTERA" == "TRUE" ]; then
+ Library="lpm"
Files=(
- $SourceDir/220pack.vhd
- $SourceDir/220model.vhd
+ 220pack.vhd
+ 220model.vhd
)
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=lpm "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile sgate library
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ALTERA" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'sgate' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ALTERA" == "TRUE" ]; then
+ Library="sgate"
Files=(
- $SourceDir/sgate_pack.vhd
- $SourceDir/sgate.vhd
+ sgate_pack.vhd
+ sgate.vhd
)
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=sgate "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile altera library
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ALTERA" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'altera' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ALTERA" == "TRUE" ]; then
+ Library="altera"
Files=(
- $SourceDir/altera_europa_support_lib.vhd
- $SourceDir/altera_primitives_components.vhd
- $SourceDir/altera_primitives.vhd
- $SourceDir/altera_standard_functions.vhd
- $SourceDir/altera_syn_attributes.vhd
- $SourceDir/alt_dspbuilder_package.vhd
+ altera_europa_support_lib.vhd
+ altera_primitives_components.vhd
+ altera_primitives.vhd
+ altera_standard_functions.vhd
+ altera_syn_attributes.vhd
+ alt_dspbuilder_package.vhd
)
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=altera "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile altera_mf library
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ALTERA" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'altera_mf' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ALTERA" == "TRUE" ]; then
+ Library="altera_mf"
Files=(
- $SourceDir/altera_mf_components.vhd
- $SourceDir/altera_mf.vhd
+ altera_mf_components.vhd
+ altera_mf.vhd
)
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=altera_mf "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile altera_lnsim library
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ALTERA" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'altera_lnsim' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ALTERA" == "TRUE" ]; then
+ Library="altera_lnsim"
Files=(
- $SourceDir/altera_lnsim_components.vhd
+ altera_lnsim_components.vhd
)
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=altera_lnsim "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# Altera device libraries
# ==============================================================================
# compile Max library
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$MAX" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'max' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_MAX" == "TRUE" ]; then
+ Library="max"
Files=(
- $SourceDir/max_atoms.vhd
- $SourceDir/max_components.vhd
+ max_atoms.vhd
+ max_components.vhd
)
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=max "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile MaxII library
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$MAX" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'maxii' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_MAX" == "TRUE" ]; then
+ Library="maxii"
Files=(
- $SourceDir/maxii_atoms.vhd
- $SourceDir/maxii_components.vhd
+ maxii_atoms.vhd
+ maxii_components.vhd
)
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=maxii "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile MaxV library
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$MAX" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'maxv' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_MAX" == "TRUE" ]; then
+ Library="maxv"
Files=(
- $SourceDir/maxv_atoms.vhd
- $SourceDir/maxv_components.vhd
+ maxv_atoms.vhd
+ maxv_components.vhd
)
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=maxv "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile ArriaII library
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ARRIA" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'arriaii' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ARRIA" == "TRUE" ]; then
+ Library="arriaii"
Files=(
- $SourceDir/arriaii_atoms.vhd
- $SourceDir/arriaii_components.vhd
- $SourceDir/arriaii_hssi_components.vhd
- $SourceDir/arriaii_hssi_atoms.vhd
+ arriaii_atoms.vhd
+ arriaii_components.vhd
)
+ if [ $SKIP_LARGE_FILES -eq 0 ]; then
+ Files+=(
+ arriaii_hssi_components.vhd
+ arriaii_hssi_atoms.vhd
+ )
+ fi
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=arriaii "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ARRIA" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'arriaii_pcie_hip' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ARRIA" == "TRUE" ] && [ $SKIP_LARGE_FILES -eq 0 ]; then
+ Library="arriaii_pcie_hip"
Files=(
- $SourceDir/arriaii_pcie_hip_components.vhd
- $SourceDir/arriaii_pcie_hip_atoms.vhd
+ arriaii_pcie_hip_components.vhd
+ arriaii_pcie_hip_atoms.vhd
)
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_LARGE_FILES" == "TRUE" ]; then
- echo -e "${ANSI_CYAN}Skipping large file '$File'${ANSI_RESET}"
- elif [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=arriaii_pcie_hip "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile ArriaIIGZ library
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ARRIA" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'arriaiigz' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ARRIA" == "TRUE" ]; then
+ Library="arriaiigz"
Files=(
- $SourceDir/arriaiigz_atoms.vhd
- $SourceDir/arriaiigz_components.vhd
- $SourceDir/arriaiigz_hssi_components.vhd
+ arriaiigz_atoms.vhd
+ arriaiigz_components.vhd
)
+ if [ $SKIP_LARGE_FILES -eq 0 ]; then
+ Files+=(
+ arriaiigz_hssi_components.vhd
+ )
+ fi
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=arriaiigz "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile ArriaV library
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ARRIA" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'arriav' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ARRIA" == "TRUE" ]; then
+ Library="arriav"
Files=(
- $SourceDir/arriav_atoms.vhd
- $SourceDir/arriav_components.vhd
- $SourceDir/arriav_hssi_components.vhd
- $SourceDir/arriav_hssi_atoms.vhd
+ arriav_atoms.vhd
+ arriav_components.vhd
)
+ if [ $SKIP_LARGE_FILES -eq 0 ]; then
+ Files+=(
+ arriav_hssi_components.vhd
+ arriav_hssi_atoms.vhd
+ )
+ fi
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=arriav "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile ArriaVGZ library
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ARRIA" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'arriavgz' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ARRIA" == "TRUE" ]; then
+ Library="arriavgz"
Files=(
- $SourceDir/arriavgz_atoms.vhd
- $SourceDir/arriavgz_components.vhd
- $SourceDir/arriavgz_hssi_components.vhd
- $SourceDir/arriavgz_hssi_atoms.vhd
+ arriavgz_atoms.vhd
+ arriavgz_components.vhd
)
+ if [ $SKIP_LARGE_FILES -eq 0 ]; then
+ Files+=(
+ arriavgz_hssi_components.vhd
+ arriavgz_hssi_atoms.vhd
+ )
+ fi
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=arriavgz "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ARRIA" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'arriavgz_pcie_hip' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ARRIA" == "TRUE" ] && [ $SKIP_LARGE_FILES -eq 0 ]; then
+ Library="arriavgz_pcie_hip"
Files=(
- $SourceDir/arriavgz_pcie_hip_components.vhd
- $SourceDir/arriavgz_pcie_hip_atoms.vhd
+ arriavgz_pcie_hip_components.vhd
+ arriavgz_pcie_hip_atoms.vhd
)
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_LARGE_FILES" == "TRUE" ]; then
- echo -e "${ANSI_CYAN}Skipping large file '$File'${ANSI_RESET}"
- elif [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=arriavgz_pcie_hip "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile CycloneIV library
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$CYCLONE" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'cycloneiv' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_CYCLONE" == "TRUE" ]; then
+ Library="cycloneiv"
Files=(
- $SourceDir/cycloneiv_atoms.vhd
- $SourceDir/cycloneiv_components.vhd
- $SourceDir/cycloneiv_hssi_components.vhd
- $SourceDir/cycloneiv_hssi_atoms.vhd
+ cycloneiv_atoms.vhd
+ cycloneiv_components.vhd
)
+ if [ $SKIP_LARGE_FILES -eq 0 ]; then
+ Files+=(
+ cycloneiv_hssi_components.vhd
+ cycloneiv_hssi_atoms.vhd
+ )
+ fi
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=cycloneiv "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$CYCLONE" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'cycloneiv_pcie_hip' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_CYCLONE" == "TRUE" ] && [ $SKIP_LARGE_FILES -eq 0 ]; then
+ Library="cycloneiv_pcie_hip"
Files=(
- $SourceDir/cycloneiv_pcie_hip_components.vhd
- $SourceDir/cycloneiv_pcie_hip_atoms.vhd
+ cycloneiv_pcie_hip_components.vhd
+ cycloneiv_pcie_hip_atoms.vhd
)
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_LARGE_FILES" == "TRUE" ]; then
- echo -e "${ANSI_CYAN}Skipping large file '$File'${ANSI_RESET}"
- elif [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=cycloneiv_pcie_hip "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile CycloneIVE library
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$CYCLONE" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'cycloneive' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_CYCLONE" == "TRUE" ]; then
+ Library="cycloneive"
Files=(
- $SourceDir/cycloneive_atoms.vhd
- $SourceDir/cycloneive_components.vhd
+ cycloneive_atoms.vhd
+ cycloneive_components.vhd
)
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=cycloneive "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile CycloneV library
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$CYCLONE" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'cyclonev' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_CYCLONE" == "TRUE" ]; then
+ Library="cyclonev"
Files=(
- $SourceDir/cyclonev_atoms.vhd
- $SourceDir/cyclonev_components.vhd
- $SourceDir/cyclonev_hssi_components.vhd
- $SourceDir/cyclonev_hssi_atoms.vhd
+ cyclonev_atoms.vhd
+ cyclonev_components.vhd
)
+ if [ $SKIP_LARGE_FILES -eq 0 ]; then
+ Files+=(
+ cyclonev_hssi_components.vhd
+ cyclonev_hssi_atoms.vhd
+ )
+ fi
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=cyclonev "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile StratixIV library
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$STRATIX" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'stratixiv' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_STRATIX" == "TRUE" ]; then
+ Library="stratixiv"
Files=(
- $SourceDir/stratixiv_atoms.vhd
- $SourceDir/stratixiv_components.vhd
- $SourceDir/stratixiv_hssi_components.vhd
- $SourceDir/stratixiv_hssi_atoms.vhd
+ stratixiv_atoms.vhd
+ stratixiv_components.vhd
)
+ if [ $SKIP_LARGE_FILES -eq 0 ]; then
+ Files+=(
+ stratixiv_hssi_components.vhd
+ stratixiv_hssi_atoms.vhd
+ )
+ fi
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=stratixiv "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$STRATIX" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'stratixiv_pcie_hip' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_STRATIX" == "TRUE" ] && [ $SKIP_LARGE_FILES -eq 0 ]; then
+ Library="stratixiv_pcie_hip"
Files=(
- $SourceDir/stratixiv_pcie_hip_components.vhd
- $SourceDir/stratixiv_pcie_hip_atoms.vhd
+ stratixiv_pcie_hip_components.vhd
+ stratixiv_pcie_hip_atoms.vhd
)
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_LARGE_FILES" == "TRUE" ]; then
- echo -e "${ANSI_CYAN}Skipping large file '$File'${ANSI_RESET}"
- elif [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=stratixiv_pcie_hip "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile StratixV library
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$STRATIX" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'stratixv' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_STRATIX" == "TRUE" ]; then
+ Library="stratixv"
Files=(
- $SourceDir/stratixv_atoms.vhd
- $SourceDir/stratixv_components.vhd
- $SourceDir/stratixv_hssi_components.vhd
- $SourceDir/stratixv_hssi_atoms.vhd
+ stratixv_atoms.vhd
+ stratixv_components.vhd
)
+ if [ $SKIP_LARGE_FILES -eq 0 ]; then
+ Files+=(
+ stratixv_hssi_components.vhd
+ stratixv_hssi_atoms.vhd
+ )
+ fi
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=stratixv "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$STRATIX" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'stratixv_pcie_hip' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_STRATIX" == "TRUE" ] && [ $SKIP_LARGE_FILES -eq 0 ]; then
+ Library="stratixv_pcie_hip"
Files=(
- $SourceDir/stratixv_pcie_hip_components.vhd
- $SourceDir/stratixv_pcie_hip_atoms.vhd
+ stratixv_pcie_hip_components.vhd
+ stratixv_pcie_hip_atoms.vhd
)
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_LARGE_FILES" == "TRUE" ]; then
- echo -e "${ANSI_CYAN}Skipping large file '$File'${ANSI_RESET}"
- elif [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=stratixv_pcie_hip "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile fiftyfivenm library
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$NANOMETER" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'fiftyfivenm' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_NANOMETER" == "TRUE" ]; then
+ Library="fiftyfivenm"
Files=(
- $SourceDir/fiftyfivenm_atoms.vhd
- $SourceDir/fiftyfivenm_components.vhd
+ fiftyfivenm_atoms.vhd
+ fiftyfivenm_components.vhd
)
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=fiftyfivenm "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile twentynm library
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$NANOMETER" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'twentynm' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_NANOMETER" == "TRUE" ]; then
+ Library="twentynm"
Files=(
- $SourceDir/twentynm_atoms.vhd
- $SourceDir/twentynm_components.vhd
- $SourceDir/twentynm_hip_components.vhd
- $SourceDir/twentynm_hip_atoms.vhd
- $SourceDir/twentynm_hssi_components.vhd
- $SourceDir/twentynm_hssi_atoms.vhd
+ twentynm_atoms.vhd
+ twentynm_components.vhd
)
+ if [ $SKIP_LARGE_FILES -eq 0 ]; then
+ Files+=(
+ twentynm_hip_components.vhd
+ twentynm_hip_atoms.vhd
+ twentynm_hssi_components.vhd
+ twentynm_hssi_atoms.vhd
+ )
+ fi
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=twentynm "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
echo "--------------------------------------------------------------------------------"
-echo -n "Compiling Altera Quartus-II libraries "
+echo -n "Compiling Altera Quartus libraries "
if [ $ERRORCOUNT -gt 0 ]; then
echo -e $COLORED_FAILED
else
echo -e $COLORED_SUCCESSFUL
fi
-
-cd $WorkingDir
diff --git a/libraries/vendors/compile-lattice.sh b/libraries/vendors/compile-lattice.sh
index 8155aaf68..58a01c7d1 100755
--- a/libraries/vendors/compile-lattice.sh
+++ b/libraries/vendors/compile-lattice.sh
@@ -4,11 +4,12 @@
# kate: tab-width 2; replace-tabs off; indent-width 2;
#
# ==============================================================================
+# Authors: Markus Koch
+# Patrick Lehmann
+#
# Bash Script: Script to compile the simulation libraries from Lattice
# Diamond for GHDL on Linux
#
-# Authors: Patrick Lehmann and Markus Koch
-#
# Description:
# ------------------------------------
# This is a Bash script (executable) which:
@@ -16,7 +17,7 @@
# - compiles all Lattice Diamond simulation libraries and packages
#
# ==============================================================================
-# Copyright (C) 2015 Patrick Lehmann and Markus Koch
+# Copyright (C) 2015-2016 Patrick Lehmann and Markus Koch
#
# GHDL 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
@@ -38,54 +39,77 @@
# save working directory
WorkingDir=$(pwd)
ScriptDir="$(dirname $0)"
-ScriptDir="$(realpath $ScriptDir)"
+ScriptDir="$(readlink -f $ScriptDir)"
-deviceList="ec ecp ecp2 ecp3 ecp5u lptm lptm2 machxo machxo2 machxo3l sc scm xp xp2"
+DeviceList="ec ecp ecp2 ecp3 ecp5u lptm lptm2 machxo machxo2 machxo3l sc scm xp xp2"
# source configuration file from GHDL's 'vendors' library directory
source $ScriptDir/config.sh
source $ScriptDir/shared.sh
-NO_COMMAND=TRUE
-
# command line argument processing
+NO_COMMAND=1
+SKIP_EXISTING_FILES=0
+SUPPRESS_WARNINGS=0
+HALT_ON_ERROR=0
+VHDLStandard=93
+GHDLBinDir=""
+DestDir=""
+SrcDir=""
while [[ $# > 0 ]]; do
key="$1"
case $key in
-c|--clean)
CLEAN=TRUE
- NO_COMMAND=FALSE
+ NO_COMMAND=0
;;
-a|--all)
# All does not change the deviceList -> all selected
- NO_COMMAND=FALSE
+ NO_COMMAND=0
;;
- -s|--skip-existing)
- SKIP_EXISTING_FILES=TRUE
+ -d|--device)
+ DeviceList="$2"
+ shift
+ NO_COMMAND=0
;;
- -S|--skip-largefiles)
- SKIP_LARGE_FILES=TRUE
+ -h|--help)
+ HELP=TRUE
+ NO_COMMAND=0
+ ;;
+ -s|--skip-existing)
+ SKIP_EXISTING_FILES=1
;;
-n|--no-warnings)
- SUPPRESS_WARNINGS=TRUE
+ SUPPRESS_WARNINGS=1
;;
-H|--halt-on-error)
- HALT_ON_ERROR=TRUE
+ HALT_ON_ERROR=1
;;
-# -v|--verbose)
-# VERBOSE=TRUE
-# ;;
- -h|--help)
- HELP=TRUE
- NO_COMMAND=FALSE
+ --vhdl93)
+ VHDLStandard=93
;;
- -d|--device)
- shift
- deviceList="$1"
- NO_COMMAND=FALSE
+ --vhdl2008)
+ VHDLStandard=2008
+ echo 1>&2 -e "${COLORED_ERROR} VHDL-2008 is not yet supported by Lattice.${ANSI_RESET}"
+ # echo 1>&2 -e "${ANSI_YELLOW}Possible workaround: ${ANSI_RESET}"
+ # echo 1>&2 -e "${ANSI_YELLOW} Compile 'std_logic_arith' and 'std_logic_unsigned' into library IEEE.${ANSI_RESET}"
+ exit -1
+ ;;
+ --ghdl)
+ GHDLBinDir="$2"
+ shift # skip argument
+ ;;
+ --src)
+ SrcDir="$2"
+ shift # skip argument
+ ;;
+ --out)
+ DestDir="$2"
+ shift # skip argument
;;
*) # unknown option
- UNKNOWN_OPTION=TRUE
+ echo 1>&2 -e "${COLORED_ERROR} Unknown command line option.${ANSI_RESET}"
+ exit -1
;;
esac
shift # past argument or value
@@ -95,20 +119,16 @@ if [ "$NO_COMMAND" == "TRUE" ]; then
HELP=TRUE
fi
-if [ "$UNKNOWN_OPTION" == "TRUE" ]; then
- echo -e $COLORED_ERROR "Unknown command line option.${ANSI_RESET}"
- exit -1
-elif [ "$HELP" == "TRUE" ]; then
- if [ "$NO_COMMAND" == "TRUE" ]; then
- echo -e $COLORED_ERROR " No command selected."
- fi
+if [ "$HELP" == "TRUE" ]; then
+ test "$NO_COMMAND" == "TRUE" && echo 1>&2 -e "${COLORED_ERROR} No command selected."
echo ""
echo "Synopsis:"
- echo " Script to compile the simulation libraries from Lattice Diamond 3.6 for GHDL on Linux"
+ echo " A script to compile the Lattice Diamond simulation libraries for GHDL on Linux."
+ echo " One library folder 'lib/v??' per VHDL library will be created relative to the current"
+ echo " working directory."
echo ""
echo "Usage:"
- echo " $0 <common command>|<library> [<options>]"
-# [-v] [-c] [--unisim] [--unimacro] [--simprim] [--secureip] [-s|--skip-existing] [-S|--skip-largefiles] [-n|--no-warnings]
+ echo " compile-lattice.sh <common command>|<library> [<options>] [<adv. options>]"
echo ""
echo "Common commands:"
echo " -h --help Print this help page"
@@ -120,115 +140,120 @@ elif [ "$HELP" == "TRUE" ]; then
echo " \"$deviceList\""
echo ""
echo "Library compile options:"
+ echo " --vhdl93 Compile the libraries with VHDL-93."
+ echo " --vhdl2008 Compile the libraries with VHDL-2008."
echo " -s --skip-existing Skip already compiled files (an *.o file exists)."
- echo " -S --skip-largefiles Don't compile large entities like DSP and PCIe primitives."
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 " --out <dir name> Name of the output directory."
+ echo " --src <Path to OSVVM> Name of the output directory."
+ echo ""
echo "Verbosity:"
-# echo " -v --verbose Print more messages"
echo " -n --no-warnings Suppress all warnings. Show only error messages."
echo ""
exit 0
fi
-# extract data from configuration
-SourceDir=${SourceDirectory[LatticeDiamond]}
-DestinationDir=${DestinationDirectory[LatticeDiamond]}
-if [ -z $DestinationDir ]; then
- echo -e "${COLORED_ERROR} Lattice Diamond is not configured in '$ScriptDir/config.sh'${ANSI_RESET}"
- exit -1
-elif [ ! -d $SourceDir ]; then
- echo -e "${COLORED_ERROR} Path '$SourceDir' does not exist.${ANSI_RESET}"
- exit -1
-fi
+# -> $SourceDirectories
+# -> $DestinationDirectories
+# -> $SrcDir
+# -> $DestDir
+# -> $GHDLBinDir
+# <= $SourceDirectory
+# <= $DestinationDirectory
+# <= $GHDLBinary
+SetupDirectories LatticeDiamond "Lattice Diamond"
+
+# create "lattice" directory and change to it
+# => $DestinationDirectory
+CreateDestinationDirectory
+cd $DestinationDirectory
+
+
+# => $SUPPRESS_WARNINGS
+# <= $GRC_COMMAND
+SetupGRCat
+
+
+# -> $VHDLStandard
+# <= $VHDLVersion
+# <= $VHDLStandard
+# <= $VHDLFlavor
+GHDLSetup
-# set bash options
-set -o pipefail
# define global GHDL Options
GHDL_OPTIONS=(-fexplicit -frelaxed-rules --no-vital-checks --warn-binding --mb-comments)
-# create "lattice" directory and change to it
-if [[ -d "$DestinationDir" ]]; then
- echo -e "${ANSI_YELLOW}Vendor directory '$DestinationDir' already exists.${ANSI_RESET}"
-else
- echo -e "${ANSI_YELLOW}Creating vendor directory: '$DestinationDir'${ANSI_RESET}"
- mkdir "$DestinationDir"
-fi
-cd $DestinationDir
-if [ -z "$(which grcat)" ]; then
- # if grcat (generic colourizer) is not installed, use a dummy pipe command like 'cat'
- GRC_COMMAND="cat"
-else
- if [ "$SUPPRESS_WARNINGS" == "TRUE" ]; then
- GRC_COMMAND="grcat $ScriptDir/ghdl.skipwarning.grcrules"
- else
- GRC_COMMAND="grcat $ScriptDir/ghdl.grcrules"
- fi
-fi
+GHDL_PARAMS=(${GHDL_OPTIONS[@]})
+GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard -P$DestinationDirectory)
+
-STOPCOMPILING=FALSE
+STOPCOMPILING=0
+ERRORCOUNT=0
# Cleanup directory
# ==============================================================================
if [ "$CLEAN" == "TRUE" ]; then
+ echo 1>&2 -e "${COLORED_ERROR} '--clean' is not implemented!"
+ exit -1
echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_RESET}"
rm *.o 2> /dev/null
+ rm *.cf 2> /dev/null
fi
# Lattice device libraries
# ==============================================================================
# Excluded: pmi
-declare -A FileList
-FileList[ec]="ORCA_CMB.vhd ORCA_SEQ.vhd ORCACOMP.vhd ORCA_LUT.vhd ORCA_MISC.vhd ORCA_CNT.vhd ORCA_IO.vhd ORCA_MEM.vhd"
-FileList[ecp]="ORCA_CMB.vhd ORCA_SEQ.vhd ORCACOMP.vhd ORCA_LUT.vhd ORCA_MISC.vhd ORCA_CNT.vhd ORCA_IO.vhd ORCA_MEM.vhd"
-FileList[ecp2]="ECP2_CMB.vhd ECP2_SEQ.vhd ECP2COMP.vhd ECP2_CNT.vhd ECP2_IO.vhd ECP2_LUT.vhd ECP2_MEM.vhd ECP2_MISC.vhd ECP2_MULT.vhd ECP2_SL.vhd"
-FileList[ecp3]="ECP3_CMB.vhd ECP3_SEQ.vhd ECP3COMP.vhd ECP3_CNT.vhd ECP3_IO.vhd ECP3_LUT.vhd ECP3_MEM.vhd ECP3_MISC.vhd ECP3_MULT.vhd ECP3_SL.vhd"
-FileList[ecp5u]="ECP5U_CMB.vhd ECP5U_SEQ.vhd ECP5UCOMP.vhd ECP5U_IO.vhd ECP5U_LUT.vhd ECP5U_MEM.vhd ECP5U_MISC.vhd ECP5U_SL.vhd gsr_pur_assign.vhd"
-FileList[lptm]="MACHXO_CMB.vhd MACHXO_SEQ.vhd MACHXOCOMP.vhd MACHXO_CNT.vhd MACHXO_IO.vhd MACHXO_LUT.vhd MACHXO_MEM.vhd MACHXO_MISC.vhd"
-FileList[lptm2]="MACHXO2_CMB.vhd MACHXO2_SEQ.vhd MACHXO2COMP.vhd gsr_pur_assign.vhd MACHXO2_CNT.vhd MACHXO2_IO.vhd MACHXO2_LUT.vhd MACHXO2_MEM.vhd MACHXO2_MISC.vhd"
-FileList[machxo]="MACHXO_CMB.vhd MACHXO_SEQ.vhd MACHXOCOMP.vhd MACHXO_CNT.vhd MACHXO_IO.vhd MACHXO_LUT.vhd MACHXO_MEM.vhd MACHXO_MISC.vhd"
-FileList[machxo2]="MACHXO2_CMB.vhd MACHXO2_SEQ.vhd MACHXO2COMP.vhd MACHXO2_CNT.vhd gsr_pur_assign.vhd MACHXO2_IO.vhd MACHXO2_LUT.vhd MACHXO2_MEM.vhd MACHXO2_MISC.vhd"
-FileList[machxo3l]="MACHXO3L_CMB.vhd MACHXO3L_SEQ.vhd MACHXO3LCOMP.vhd gsr_pur_assign.vhd MACHXO3L_CNT.vhd MACHXO3L_IO.vhd MACHXO3L_LUT.vhd MACHXO3L_MEM.vhd MACHXO3L_MISC.vhd"
-FileList[sc]="ORCA_CMB.vhd ORCA_SEQ.vhd ORCACOMP.vhd ORCA_CNT.vhd ORCA_IO.vhd ORCA_MEM.vhd ORCA_MIS.vhd ORCA_SL.vhd"
-FileList[scm]="ORCA_CMB.vhd ORCA_SEQ.vhd ORCACOMP.vhd ORCA_CNT.vhd ORCA_IO.vhd ORCA_MEM.vhd ORCA_MIS.vhd ORCA_SL.vhd"
-FileList[xp]="ORCA_CMB.vhd ORCA_SEQ.vhd ORCACOMP.vhd ORCA_LUT.vhd ORCA_MISC.vhd ORCA_CNT.vhd ORCA_IO.vhd ORCA_MEM.vhd"
-FileList[xp2]="XP2_CMB.vhd XP2_SEQ.vhd XP2COMP.vhd XP2_CNT.vhd XP2_IO.vhd XP2_LUT.vhd XP2_MEM.vhd XP2_MISC.vhd XP2_MULT.vhd XP2_SL.vhd"
-
-for device in $deviceList; do
- if [ "$STOPCOMPILING" == "FALSE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library '$device' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=synopsys --std=93c)
- currentPath="$SourceDir/$device/src"
- Files=(${FileList[$device]})
- #Files+=`find $currentPath/*.vhd`
- for File_a in ${Files[@]}; do
- File="$currentPath/$File_a"
- FileName=$(basename "$File")
- FileName="${device}_$FileName"
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=$device -o "${FileName%.*}.o" "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
+declare -A FileLists
+FileLists[ec]="ORCA_CMB.vhd ORCA_SEQ.vhd ORCACOMP.vhd ORCA_LUT.vhd ORCA_MISC.vhd ORCA_CNT.vhd ORCA_IO.vhd ORCA_MEM.vhd"
+FileLists[ecp]="ORCA_CMB.vhd ORCA_SEQ.vhd ORCACOMP.vhd ORCA_LUT.vhd ORCA_MISC.vhd ORCA_CNT.vhd ORCA_IO.vhd ORCA_MEM.vhd"
+FileLists[ecp2]="ECP2_CMB.vhd ECP2_SEQ.vhd ECP2COMP.vhd ECP2_CNT.vhd ECP2_IO.vhd ECP2_LUT.vhd ECP2_MEM.vhd ECP2_MISC.vhd ECP2_MULT.vhd ECP2_SL.vhd"
+FileLists[ecp3]="ECP3_CMB.vhd ECP3_SEQ.vhd ECP3COMP.vhd ECP3_CNT.vhd ECP3_IO.vhd ECP3_LUT.vhd ECP3_MEM.vhd ECP3_MISC.vhd ECP3_MULT.vhd ECP3_SL.vhd"
+FileLists[ecp5u]="ECP5U_CMB.vhd ECP5U_SEQ.vhd ECP5UCOMP.vhd ECP5U_IO.vhd ECP5U_LUT.vhd ECP5U_MEM.vhd ECP5U_MISC.vhd ECP5U_SL.vhd gsr_pur_assign.vhd"
+FileLists[lptm]="MACHXO_CMB.vhd MACHXO_SEQ.vhd MACHXOCOMP.vhd MACHXO_CNT.vhd MACHXO_IO.vhd MACHXO_LUT.vhd MACHXO_MEM.vhd MACHXO_MISC.vhd"
+FileLists[lptm2]="MACHXO2_CMB.vhd MACHXO2_SEQ.vhd MACHXO2COMP.vhd gsr_pur_assign.vhd MACHXO2_CNT.vhd MACHXO2_IO.vhd MACHXO2_LUT.vhd MACHXO2_MEM.vhd MACHXO2_MISC.vhd"
+FileLists[machxo]="MACHXO_CMB.vhd MACHXO_SEQ.vhd MACHXOCOMP.vhd MACHXO_CNT.vhd MACHXO_IO.vhd MACHXO_LUT.vhd MACHXO_MEM.vhd MACHXO_MISC.vhd"
+FileLists[machxo2]="MACHXO2_CMB.vhd MACHXO2_SEQ.vhd MACHXO2COMP.vhd MACHXO2_CNT.vhd gsr_pur_assign.vhd MACHXO2_IO.vhd MACHXO2_LUT.vhd MACHXO2_MEM.vhd MACHXO2_MISC.vhd"
+FileLists[machxo3l]="MACHXO3L_CMB.vhd MACHXO3L_SEQ.vhd MACHXO3LCOMP.vhd gsr_pur_assign.vhd MACHXO3L_CNT.vhd MACHXO3L_IO.vhd MACHXO3L_LUT.vhd MACHXO3L_MEM.vhd MACHXO3L_MISC.vhd"
+FileLists[sc]="ORCA_CMB.vhd ORCA_SEQ.vhd ORCACOMP.vhd ORCA_CNT.vhd ORCA_IO.vhd ORCA_MEM.vhd ORCA_MIS.vhd ORCA_SL.vhd"
+FileLists[scm]="ORCA_CMB.vhd ORCA_SEQ.vhd ORCACOMP.vhd ORCA_CNT.vhd ORCA_IO.vhd ORCA_MEM.vhd ORCA_MIS.vhd ORCA_SL.vhd"
+FileLists[xp]="ORCA_CMB.vhd ORCA_SEQ.vhd ORCACOMP.vhd ORCA_LUT.vhd ORCA_MISC.vhd ORCA_CNT.vhd ORCA_IO.vhd ORCA_MEM.vhd"
+FileLists[xp2]="XP2_CMB.vhd XP2_SEQ.vhd XP2COMP.vhd XP2_CNT.vhd XP2_IO.vhd XP2_LUT.vhd XP2_MEM.vhd XP2_MISC.vhd XP2_MULT.vhd XP2_SL.vhd"
+
+for device in $DeviceList; do
+ Library=$device
+ LibraryDirectory=$DestinationDirectory/$Library/$VHDLVersion
+ mkdir -p $LibraryDirectory
+ cd $LibraryDirectory
+ echo -e "${ANSI_YELLOW}Compiling library '$Library'...${ANSI_RESET}"
+
+ DeviceSourceDirectory="$SourceDirectory/$device/src"
+ for File in ${FileLists[$device]}; do
+ File="$DeviceSourceDirectory/$File"
+ FileName=$(basename "$File")
+ FileName="${device}_$FileName"
+ if [ $SKIP_EXISTING_FILES -eq 1 ] && [ -e "${FileName%.*}.o" ]; then
+ 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
+ if [ $? -ne 0 ]; then
+ let ERRORCOUNT++
+ test $HALT_ON_ERROR -eq 1 && break 2
fi
- done
- fi
+ fi
+ done
done
echo "--------------------------------------------------------------------------------"
echo -n "Compiling Lattice Diamond libraries "
-if [ "$STOPCOMPILING" == "TRUE" ]; then
+if [ $ERRORCOUNT -gt 0 ]; then
echo -e $COLORED_FAILED
else
echo -e $COLORED_SUCCESSFUL
fi
-
-cd $WorkingDir
diff --git a/libraries/vendors/compile-osvvm.sh b/libraries/vendors/compile-osvvm.sh
index d7430434f..38aea81d6 100755
--- a/libraries/vendors/compile-osvvm.sh
+++ b/libraries/vendors/compile-osvvm.sh
@@ -44,7 +44,9 @@ source $ScriptDir/config.sh
source $ScriptDir/shared.sh
# command line argument processing
-NO_COMMAND=TRUE
+NO_COMMAND=1
+SUPPRESS_WARNINGS=0
+HALT_ON_ERROR=0
GHDLBinDir=""
DestDir=""
SrcDir=""
@@ -53,59 +55,55 @@ while [[ $# > 0 ]]; do
case $key in
-c|--clean)
CLEAN=TRUE
- NO_COMMAND=FALSE
+ NO_COMMAND=0
;;
-a|--all)
COMPILE_ALL=TRUE
- NO_COMMAND=FALSE
+ NO_COMMAND=0
;;
- -o|--osvvm)
+ --osvvm)
COMPILE_OSVVM=TRUE
- NO_COMMAND=FALSE
+ NO_COMMAND=0
;;
- -s|--skip-existing)
- SKIP_EXISTING_FILES=TRUE
+ -h|--help)
+ HELP=TRUE
+ NO_COMMAND=0
;;
-n|--no-warnings)
- SUPPRESS_WARNINGS=TRUE
+ SUPPRESS_WARNINGS=1
;;
-H|--halt-on-error)
- HALT_ON_ERROR=TRUE
- ;;
- -h|--help)
- HELP=TRUE
- NO_COMMAND=FALSE
+ HALT_ON_ERROR=1
;;
--ghdl)
GHDLBinDir="$2"
- shift # past argument
+ shift # skip argument
;;
--src)
SrcDir="$2"
- shift # past argument
+ shift # skip argument
;;
--out)
DestDir="$2"
- shift # past argument
+ shift # skip argument
;;
*) # unknown option
- UNKNOWN_OPTION=TRUE
+ echo 1>&2 -e "${COLORED_ERROR} Unknown command line option.${ANSI_RESET}"
+ exit -1
;;
esac
- shift # past argument or value
+ shift # skip argument or value
done
+# makes no sense to enable it for OSVVM
+SKIP_EXISTING_FILES=0
+
if [ "$NO_COMMAND" == "TRUE" ]; then
HELP=TRUE
fi
-if [ "$UNKNOWN_OPTION" == "TRUE" ]; then
- echo -e $COLORED_ERROR "Unknown command line option.${ANSI_RESET}"
- exit -1
-elif [ "$HELP" == "TRUE" ]; then
- if [ "$NO_COMMAND" == "TRUE" ]; then
- echo -e $COLORED_ERROR " No command selected."
- fi
+if [ "$HELP" == "TRUE" ]; then
+ test "$NO_COMMAND" == "TRUE" && echo 1>&2 -e "${COLORED_ERROR} No command selected."
echo ""
echo "Synopsis:"
echo " A script to compile the simulation library 'OSVVM' for GHDL on Linux."
@@ -122,11 +120,10 @@ elif [ "$HELP" == "TRUE" ]; then
echo " -c --clean Remove all generated files"
echo ""
echo "Libraries:"
- echo " -a --all Compile all packages (default)."
- echo " -o --osvvm Compile package osvvm."
+ echo " -a --all Compile all libraries."
+ echo " --osvvm Compile library osvvm."
echo ""
echo "Library compile options:"
- echo " -s --skip-existing Skip already compiled files (an *.o file exists)."
echo " -H --halt-on-error Halt on error(s)."
echo ""
echo "Advanced options:"
@@ -144,77 +141,31 @@ if [ "$COMPILE_ALL" == "TRUE" ]; then
COMPILE_OSVVM=TRUE
fi
-SourceDirectory=${SourceDirectory[OSVVM]}
-DestinationDir=${DestinationDirectory[OSVVM]}
-# OSVVM 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
-fi
-# OSVVM 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
- DestinationDir=$DestDir
-fi
+# -> $SourceDirectories
+# -> $DestinationDirectories
+# -> $SrcDir
+# -> $DestDir
+# -> $GHDLBinDir
+# <= $SourceDirectory
+# <= $DestinationDirectory
+# <= $GHDLBinary
+SetupDirectories OSVVM "OSVVM"
-# Use GHDL binary directory from command line argument, if set
-if [ ! -z "$GHDLBinDir" ]; then
- GHDLBinary=$GHDLBinDir/ghdl
- if [[ ! -x "$GHDLBinary" ]]; then
- echo -e "${COLORED_ERROR} GHDL not found or is not executable.${ANSI_RESET}"
- exit -1
- fi
-else # fall back to GHDL found via PATH
- GHDLBinary=$(which ghdl)
- if [ $? -ne 0 ]; then
- echo -e "${COLORED_ERROR} GHDL not found in PATH.${ANSI_RESET}"
- echo -e " Use adv. options '--ghdl' to set the GHDL binary directory."
- exit -1
- fi
-fi
+# create "osvvm" directory and change to it
+# => $DestinationDirectory
+CreateDestinationDirectory
+cd $DestinationDirectory
-if [ -z $SourceDirectory ] || [ -z $DestinationDir ]; then
- echo -e "${COLORED_ERROR} OSVVM is not configured in '$ScriptDir/config.sh'${ANSI_RESET}"
- echo -e " Use adv. options '--src' and '--out' or configure 'config.sh'."
- exit -1
-elif [ ! -d $SourceDirectory ]; then
- echo -e "${COLORED_ERROR} Path '$SourceDir' does not exist.${ANSI_RESET}"
- exit -1
-fi
-# append VHDL version folder
-DestinationDir=$DestinationDir/v08
+# => $SUPPRESS_WARNINGS
+# <= $GRC_COMMAND
+SetupGRCat
-# set bash options
-set -o pipefail
# define global GHDL Options
GHDL_OPTIONS=(-fexplicit -frelaxed-rules --no-vital-checks --warn-binding --mb-comments)
-# create "osvvm" directory and change to it
-if [[ -d "$DestinationDir" ]]; then
- echo -e "${ANSI_YELLOW}Vendor directory '$DestinationDir' already exists.${ANSI_RESET}"
-else
- echo -e "${ANSI_YELLOW}Creating vendor directory: '$DestinationDir'${ANSI_RESET}"
- mkdir -p "$DestinationDir"
-fi
-cd $DestinationDir
-
-if [ -z "$(which grcat)" ]; then
- # if grcat (generic colourizer) is not installed, use a dummy pipe command like 'cat'
- GRC_COMMAND="cat"
-else
- if [ "$SUPPRESS_WARNINGS" == "TRUE" ]; then
- GRC_COMMAND="grcat $ScriptDir/ghdl.skipwarning.grcrules"
- else
- GRC_COMMAND="grcat $ScriptDir/ghdl.grcrules"
- fi
-fi
# Cleanup directory
# ==============================================================================
@@ -224,13 +175,18 @@ if [ "$CLEAN" == "TRUE" ]; then
rm *.cf 2> /dev/null
fi
+
+# create local set of GHDL parameters
+GHDL_PARAMS=(${GHDL_OPTIONS[@]})
+GHDL_PARAMS+=(--std=08)
+VHDLVersion="v08"
+
# Library osvvm
# ==============================================================================
# compile osvvm packages
+ERRORCOUNT=0
if [ "$COMPILE_OSVVM" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'osvvm' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--std=08)
+ Library="osvvm"
Files=(
NamePkg.vhd
OsvvmGlobalPkg.vhd
@@ -246,30 +202,19 @@ if [ "$COMPILE_OSVVM" == "TRUE" ]; then
OsvvmContext.vhd
)
- echo $GHDLBinary
-
- ERRORCOUNT=0
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping package '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing package '$File'${ANSI_RESET}"
- $GHDLBinary -a ${GHDL_PARAMS[@]} --work=osvvm "$SourceDirectory/$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
-
- echo "--------------------------------------------------------------------------------"
- echo -n "Compiling OSVVM library "
- if [ $ERRORCOUNT -gt 0 ]; then
- echo -e $COLORED_FAILED
- else
- echo -e $COLORED_SUCCESSFUL
- fi
+
+ GHDLCompilePackages
+fi
+
+echo "--------------------------------------------------------------------------------"
+echo -n "Compiling OSVVM packages "
+if [ $ERRORCOUNT -gt 0 ]; then
+ echo -e $COLORED_FAILED
+else
+ echo -e $COLORED_SUCCESSFUL
fi
diff --git a/libraries/vendors/compile-vunit.sh b/libraries/vendors/compile-vunit.sh
index 0cecf3685..0d38a4acc 100755
--- a/libraries/vendors/compile-vunit.sh
+++ b/libraries/vendors/compile-vunit.sh
@@ -4,10 +4,10 @@
# kate: tab-width 2; replace-tabs off; indent-width 2;
#
# ==============================================================================
-# Bash Script: Script to compile the VUnit library for GHDL on Linux
-#
# Authors: Patrick Lehmann
#
+# Bash Script: Script to compile the VUnit library for GHDL on Linux
+#
# Description:
# ------------------------------------
# This is a Bash script (executable) which:
@@ -15,7 +15,7 @@
# - compiles all VUnit packages
#
# ==============================================================================
-# Copyright (C) 2015 Patrick Lehmann
+# Copyright (C) 2015-2016 Patrick Lehmann
#
# GHDL 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
@@ -37,205 +37,206 @@
# save working directory
WorkingDir=$(pwd)
ScriptDir="$(dirname $0)"
-ScriptDir="$(realpath $ScriptDir)"
+ScriptDir="$(readlink -f $ScriptDir)"
# source configuration file from GHDL's 'vendors' library directory
source $ScriptDir/config.sh
source $ScriptDir/shared.sh
-NO_COMMAND=TRUE
-
# command line argument processing
+NO_COMMAND=1
+SUPPRESS_WARNINGS=0
+HALT_ON_ERROR=0
+GHDLBinDir=""
+DestDir=""
+SrcDir=""
while [[ $# > 0 ]]; do
key="$1"
case $key in
-c|--clean)
CLEAN=TRUE
- NO_COMMAND=FALSE
+ NO_COMMAND=0
;;
-a|--all)
- ALL=TRUE
- NO_COMMAND=FALSE
+ COMPILE_ALL=TRUE
+ NO_COMMAND=0
+ ;;
+ --vunit)
+ COMPILE_VUNIT=TRUE
+ NO_COMMAND=0
;;
- -s|--skip-existing)
- SKIP_EXISTING_FILES=TRUE
+ -h|--help)
+ HELP=TRUE
+ NO_COMMAND=0
;;
-n|--no-warnings)
- SUPPRESS_WARNINGS=TRUE
+ SUPPRESS_WARNINGS=1
;;
-H|--halt-on-error)
- HALT_ON_ERROR=TRUE
+ HALT_ON_ERROR=1
;;
-# -v|--verbose)
-# VERBOSE=TRUE
-# ;;
- -h|--help)
- HELP=TRUE
- NO_COMMAND=FALSE
+ --ghdl)
+ GHDLBinDir="$2"
+ shift # skip argument
+ ;;
+ --src)
+ SrcDir="$2"
+ shift # skip argument
+ ;;
+ --out)
+ DestDir="$2"
+ shift # skip argument
;;
*) # unknown option
- UNKNOWN_OPTION=TRUE
+ echo 1>&2 -e "${COLORED_ERROR} Unknown command line option.${ANSI_RESET}"
+ exit -1
;;
esac
shift # past argument or value
done
+# makes no sense to enable it for VUnit
+SKIP_EXISTING_FILES=0
+
if [ "$NO_COMMAND" == "TRUE" ]; then
HELP=TRUE
fi
-if [ "$UNKNOWN_OPTION" == "TRUE" ]; then
- echo -e $COLORED_ERROR "Unknown command line option.${ANSI_RESET}"
- exit -1
-elif [ "$HELP" == "TRUE" ]; then
- if [ "$NO_COMMAND" == "TRUE" ]; then
- echo -e $COLORED_ERROR " No command selected."
- fi
+if [ "$HELP" == "TRUE" ]; then
+ test "$NO_COMMAND" == "TRUE" && echo 1>&2 -e "${COLORED_ERROR} No command selected."
echo ""
echo "Synopsis:"
- echo " Script to compile the simulation library VUnit for GHDL on Linux"
+ echo " A script to compile the simulation library 'vunit_lib' for GHDL on Linux."
+ echo " A library folder 'vunit/v08' will be created relative to the current"
+ echo " working directory."
echo ""
echo "Usage:"
- echo " compile-vunit.sh <common command>|<library> [<options>]"
-# [-v] [-c] [--all] [-s|--skip-existing] [-n|--no-warnings]
+ echo " compile-vunit.sh <common command>|<library> [<options>] [<adv. options>]"
echo ""
echo "Common commands:"
echo " -h --help Print this help page"
echo " -c --clean Remove all generated files"
echo ""
echo "Libraries:"
- echo " -a --all Compile all packages."
+ echo " -a --all Compile all libraries."
+ echo " --vunit Compile library vunit_lib."
echo ""
echo "Library compile options:"
- echo " -s --skip-existing Skip already compiled files (an *.o file exists)."
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 " --out <dir name> Name of the output directory."
+ echo " --src <Path to OSVVM> Name of the output directory."
+ echo ""
echo "Verbosity:"
-# echo " -v --verbose Print more messages"
echo " -n --no-warnings Suppress all warnings. Show only error messages."
echo ""
exit 0
fi
-if [ "$ALL" == "TRUE" ]; then
+if [ "$COMPILE_ALL" == "TRUE" ]; then
COMPILE_VUNIT=TRUE
fi
-# extract data from configuration
-SourceDir=${SourceDirectory[VUnit]}
-DestinationDir=${DestinationDirectory[VUnit]}
+# -> $SourceDirectories
+# -> $DestinationDirectories
+# -> $SrcDir
+# -> $DestDir
+# -> $GHDLBinDir
+# <= $SourceDirectory
+# <= $DestinationDirectory
+# <= $GHDLBinary
+SetupDirectories VUnit "VUnit"
-if [ -z $DestinationDir ]; then
- echo -e "${COLORED_ERROR} VUnit is not configured in '$ScriptDir/config.sh'${ANSI_RESET}"
- exit -1
-elif [ ! -d $SourceDir ]; then
- echo -e "${COLORED_ERROR} Path '$SourceDir' does not exist.${ANSI_RESET}"
- exit -1
-fi
+# create "vunit_lib" directory and change to it
+# => $DestinationDirectory
+CreateDestinationDirectory
+cd $DestinationDirectory
-# set bash options
-set -o pipefail
-# define global GHDL Options
-GHDL_OPTIONS=(-fexplicit -frelaxed-rules --no-vital-checks --warn-binding --mb-comments)
+# => $SUPPRESS_WARNINGS
+# <= $GRC_COMMAND
+SetupGRCat
-# create "vunit" directory and change to it
-if [[ -d "$DestinationDir" ]]; then
- echo -e "${ANSI_YELLOW}Vendor directory '$DestinationDir' already exists.${ANSI_RESET}"
-else
- echo -e "${ANSI_YELLOW}Creating vendor directory: '$DestinationDir'${ANSI_RESET}"
- mkdir "$DestinationDir"
-fi
-cd $DestinationDir
-if [ -z "$(which grcat)" ]; then
- # if grcat (generic colourizer) is not installed, use a dummy pipe command like 'cat'
- GRC_COMMAND="cat"
-else
- if [ "$SUPPRESS_WARNINGS" == "TRUE" ]; then
- GRC_COMMAND="grcat $ScriptDir/ghdl.skipwarning.grcrules"
- else
- GRC_COMMAND="grcat $ScriptDir/ghdl.grcrules"
- fi
-fi
+# define global GHDL Options
+GHDL_OPTIONS=(-fexplicit -frelaxed-rules --no-vital-checks --warn-binding --mb-comments)
-ERRORCOUNT=0
# Cleanup directory
# ==============================================================================
if [ "$CLEAN" == "TRUE" ]; then
echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_RESET}"
rm *.o 2> /dev/null
+ rm *.cf 2> /dev/null
fi
# Library vunit_lib
# ==============================================================================
-# compile vunit packages
-echo -e "${ANSI_YELLOW}Compiling library 'vunit_lib' ...${ANSI_RESET}"
-GHDL_PARAMS=(${GHDL_OPTIONS[@]})
-GHDL_PARAMS+=(--std=08)
-Files=(
- $SourceDir/run/src/stop_api.vhd
- $SourceDir/vhdl/src/lib/std/textio.vhd
- $SourceDir/vhdl/src/lang/lang.vhd
- $SourceDir/com/src/com_types.vhd
- $SourceDir/run/src/stop_body_2008.vhd
- $SourceDir/com/src/com_api.vhd
- $SourceDir/string_ops/src/string_ops.vhd
- $SourceDir/path/src/path.vhd
- $SourceDir/logging/src/log_types.vhd
- $SourceDir/logging/src/log_formatting.vhd
- $SourceDir/logging/src/log_special_types200x.vhd
- $SourceDir/array/src/array_pkg.vhd
- $SourceDir/logging/src/log_base_api.vhd
- $SourceDir/logging/src/log_base.vhd
- $SourceDir/logging/src/log_api.vhd
- $SourceDir/logging/src/log.vhd
- $SourceDir/check/src/check_types.vhd
- $SourceDir/check/src/check_special_types200x.vhd
- $SourceDir/check/src/check_base_api.vhd
- $SourceDir/check/src/check_base.vhd
- $SourceDir/check/src/check_api.vhd
- $SourceDir/check/src/check.vhd
- $SourceDir/dictionary/src/dictionary.vhd
- $SourceDir/run/src/run_types.vhd
- $SourceDir/run/src/run_special_types200x.vhd
- $SourceDir/run/src/run_base_api.vhd
- $SourceDir/run/src/run_base.vhd
- $SourceDir/run/src/run_api.vhd
- $SourceDir/run/src/run.vhd
- $SourceDir/vunit_run_context.vhd
- $SourceDir/vunit_context.vhd
- $SourceDir/com/src/com_std_codec_builder.vhd
- $SourceDir/com/src/com_debug_codec_builder.vhd
- $SourceDir/com/src/com_string.vhd
- $SourceDir/com/src/com_codec_api.vhd
- $SourceDir/com/src/com_codec.vhd
- $SourceDir/com/src/com.vhd
- $SourceDir/com/src/com_context.vhd
-)
-for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping package '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing package '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=vunit_lib "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- break
- fi
- fi
- fi
-done
+# compile vunit packages
+ERRORCOUNT=0
+if [ "$COMPILE_VUNIT" == "TRUE" ]; then
+ Library="vunit_lib"
+ VHDLVersion="v08"
+ Files=(
+ run/src/stop_api.vhd
+ vhdl/src/lib/std/textio.vhd
+ vhdl/src/lang/lang.vhd
+ com/src/com_types.vhd
+ run/src/stop_body_2008.vhd
+ com/src/com_api.vhd
+ string_ops/src/string_ops.vhd
+ path/src/path.vhd
+ logging/src/log_types.vhd
+ logging/src/log_formatting.vhd
+ logging/src/log_special_types200x.vhd
+ array/src/array_pkg.vhd
+ logging/src/log_base_api.vhd
+ logging/src/log_base.vhd
+ logging/src/log_api.vhd
+ logging/src/log.vhd
+ check/src/check_types.vhd
+ check/src/check_special_types200x.vhd
+ check/src/check_base_api.vhd
+ check/src/check_base.vhd
+ check/src/check_api.vhd
+ check/src/check.vhd
+ dictionary/src/dictionary.vhd
+ run/src/run_types.vhd
+ run/src/run_special_types200x.vhd
+ run/src/run_base_api.vhd
+ run/src/run_base.vhd
+ run/src/run_api.vhd
+ run/src/run.vhd
+ vunit_run_context.vhd
+ vunit_context.vhd
+ com/src/com_std_codec_builder.vhd
+ com/src/com_debug_codec_builder.vhd
+ com/src/com_string.vhd
+ com/src/com_codec_api.vhd
+ com/src/com_codec.vhd
+ com/src/com.vhd
+ com/src/com_context.vhd
+ )
+
+ # append absolute source path
+ SourceFiles=()
+ for File in ${Files[@]}; do
+ SourceFiles+=("$SourceDirectory/$File")
+ done
+
+ # create local set of GHDL parameters
+ GHDL_PARAMS=(${GHDL_OPTIONS[@]})
+ GHDL_PARAMS+=(--std=08)
+
+ GHDLCompilePackages
+fi
echo "--------------------------------------------------------------------------------"
-echo -n "Compiling VUnit library "
+echo -n "Compiling VUnit packages "
if [ $ERRORCOUNT -gt 0 ]; then
echo -e $COLORED_FAILED
else
echo -e $COLORED_SUCCESSFUL
fi
-
-cd $WorkingDir
diff --git a/libraries/vendors/compile-xilinx-ise.sh b/libraries/vendors/compile-xilinx-ise.sh
index ffbfd96d2..a3aa3f3c7 100755
--- a/libraries/vendors/compile-xilinx-ise.sh
+++ b/libraries/vendors/compile-xilinx-ise.sh
@@ -4,11 +4,11 @@
# kate: tab-width 2; replace-tabs off; indent-width 2;
#
# ==============================================================================
+# Authors: Patrick Lehmann
+#
# Bash Script: Script to compile the simulation libraries from Xilinx ISE
# for GHDL on Linux
#
-# Authors: Patrick Lehmann
-#
# Description:
# ------------------------------------
# This is a Bash script (executable) which:
@@ -16,7 +16,7 @@
# - compiles all Xilinx ISE simulation libraries and packages
#
# ==============================================================================
-# Copyright (C) 2015 Patrick Lehmann
+# Copyright (C) 2015-2016 Patrick Lehmann
#
# GHDL 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
@@ -38,68 +38,85 @@
# save working directory
WorkingDir=$(pwd)
ScriptDir="$(dirname $0)"
-ScriptDir="$(realpath $ScriptDir)"
+ScriptDir="$(readlink -f $ScriptDir)"
# source configuration file from GHDL's 'vendors' library directory
source $ScriptDir/config.sh
source $ScriptDir/shared.sh
-NO_COMMAND=TRUE
-
# command line argument processing
+NO_COMMAND=1
+SKIP_EXISTING_FILES=0
+SKIP_LARGE_FILES=0
+SUPPRESS_WARNINGS=0
+HALT_ON_ERROR=0
+VHDLStandard=93
+GHDLBinDir=""
+DestDir=""
+SrcDir=""
while [[ $# > 0 ]]; do
key="$1"
case $key in
-c|--clean)
CLEAN=TRUE
- NO_COMMAND=FALSE
+ NO_COMMAND=0
;;
-a|--all)
- ALL=TRUE
- NO_COMMAND=FALSE
+ COMPILE_ALL=TRUE
+ NO_COMMAND=0
;;
- -s|--skip-existing)
- SKIP_EXISTING_FILES=TRUE
+ --unisim)
+ COMPILE_UNISIM=TRUE
+ NO_COMMAND=0
;;
- -S|--skip-largefiles)
- SKIP_LARGE_FILES=TRUE
+ --unimacro)
+ COMPILE_UNIMACRO=TRUE
+ NO_COMMAND=0
;;
- -n|--no-warnings)
- SUPPRESS_WARNINGS=TRUE
+ --simprim)
+ COMPILE_SIMPRIM=TRUE
+ NO_COMMAND=0
;;
- -H|--halt-on-error)
- HALT_ON_ERROR=TRUE
+ --secureip)
+ COMPILE_SECUREIP=TRUE
;;
-# -v|--verbose)
-# VERBOSE=TRUE
-# ;;
-h|--help)
HELP=TRUE
- NO_COMMAND=FALSE
+ NO_COMMAND=0
;;
- --unisim)
- UNISIM=TRUE
- NO_COMMAND=FALSE
+ -s|--skip-existing)
+ SKIP_EXISTING_FILES=1
;;
- --unimacro)
- UNIMACRO=TRUE
- NO_COMMAND=FALSE
+ -S|--skip-largefiles)
+ SKIP_LARGE_FILES=1
;;
- --simprim)
- SIMPRIM=TRUE
- NO_COMMAND=FALSE
+ -n|--no-warnings)
+ SUPPRESS_WARNINGS=1
;;
- --secureip)
- SECUREIP=TRUE
+ -H|--halt-on-error)
+ HALT_ON_ERROR=1
;;
--vhdl93)
- VHDL93=TRUE
+ VHDLStandard=93
;;
--vhdl2008)
- VHDL2008=TRUE
+ VHDLStandard=2008
+ ;;
+ --ghdl)
+ GHDLBinDir="$2"
+ shift # skip argument
+ ;;
+ --src)
+ SrcDir="$2"
+ shift # skip argument
+ ;;
+ --out)
+ DestDir="$2"
+ shift # skip argument
;;
*) # unknown option
- UNKNOWN_OPTION=TRUE
+ echo 1>&2 -e "${COLORED_ERROR} Unknown command line option.${ANSI_RESET}"
+ exit -1
;;
esac
shift # past argument or value
@@ -109,20 +126,16 @@ if [ "$NO_COMMAND" == "TRUE" ]; then
HELP=TRUE
fi
-if [ "$UNKNOWN_OPTION" == "TRUE" ]; then
- echo -e $COLORED_ERROR "Unknown command line option.${ANSI_RESET}"
- exit -1
-elif [ "$HELP" == "TRUE" ]; then
- if [ "$NO_COMMAND" == "TRUE" ]; then
- echo -e $COLORED_ERROR " No command selected."
- fi
+if [ "$HELP" == "TRUE" ]; then
+ test "$NO_COMMAND" == "TRUE" && echo 1>&2 -e "${COLORED_ERROR} No command selected."
echo ""
echo "Synopsis:"
- echo " Script to compile the simulation libraries from Xilinx ISE for GHDL on Linux"
+ echo " A script to compile the Xilinx ISE simulation libraries for GHDL on Linux."
+ echo " One library folder 'lib/v??' per VHDL library will be created relative to the current"
+ echo " working directory."
echo ""
echo "Usage:"
- echo " compile-xilinx-ise.sh <common command>|<library> [<options>]"
-# [-v] [-c] [--unisim] [--unimacro] [--simprim] [--secureip] [-s|--skip-existing] [-S|--skip-largefiles] [-n|--no-warnings]
+ echo " compile-xilinx-ise.sh <common command>|<library> [<options>] [<adv. options>]"
echo ""
echo "Common commands:"
echo " -h --help Print this help page"
@@ -142,297 +155,170 @@ elif [ "$HELP" == "TRUE" ]; then
echo " -S --skip-largefiles Don't compile large entities like DSP and PCIe primitives."
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 " --out <dir name> Name of the output directory."
+ echo " --src <Path to OSVVM> Name of the output directory."
+ echo ""
echo "Verbosity:"
-# echo " -v --verbose Print more messages"
echo " -n --no-warnings Suppress all warnings. Show only error messages."
echo ""
exit 0
fi
-if [ "$ALL" == "TRUE" ]; then
- UNISIM=TRUE
- UNIMACRO=TRUE
- SIMPRIM=TRUE
- SECUREIP=TRUE
+if [ "$COMPILE_ALL" == "TRUE" ]; then
+ COMPILE_UNISIM=TRUE
+ COMPILE_UNIMACRO=TRUE
+ COMPILE_SIMPRIM=TRUE
+ COMPILE_SECUREIP=TRUE
fi
-if [ "$VHDL93" == "TRUE" ]; then
- VHDLStandard="93c"
- VHDLFlavor="synopsys"
-elif [ "$VHDL2008" == "TRUE" ]; then
- VHDLStandard="08"
- VHDLFlavor="standard"
+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
-else
- VHDLStandard="93c"
- VHDLFlavor="synopsys"
fi
-# extract data from configuration
-SourceDir=${SourceDirectory[XilinxISE]}
-DestinationDir=${DestinationDirectory[XilinxISE]}
-if [ -z $DestinationDir ]; then
- echo -e "${COLORED_ERROR} Xilinx ISE is not configured in '$ScriptDir/config.sh'${ANSI_RESET}"
- exit -1
-elif [ ! -d $SourceDir ]; then
- echo -e "${COLORED_ERROR} Path '$SourceDir' does not exist.${ANSI_RESET}"
- exit -1
-fi
+# -> $SourceDirectories
+# -> $DestinationDirectories
+# -> $SrcDir
+# -> $DestDir
+# -> $GHDLBinDir
+# <= $SourceDirectory
+# <= $DestinationDirectory
+# <= $GHDLBinary
+SetupDirectories XilinxISE "Xilinx ISE"
+
+# create "xilinx-ise" directory and change to it
+# => $DestinationDirectory
+CreateDestinationDirectory
+cd $DestinationDirectory
+
+
+# => $SUPPRESS_WARNINGS
+# <= $GRC_COMMAND
+SetupGRCat
+
+
+# -> $VHDLStandard
+# <= $VHDLVersion
+# <= $VHDLStandard
+# <= $VHDLFlavor
+GHDLSetup
-# set bash options
-set -o pipefail
# define global GHDL Options
GHDL_OPTIONS=(-fexplicit -frelaxed-rules --no-vital-checks --warn-binding --mb-comments)
-# create "xilinx" directory and change to it
-if [[ -d "$DestinationDir" ]]; then
- echo -e "${ANSI_YELLOW}Vendor directory '$DestinationDir' already exists.${ANSI_RESET}"
-else
- echo -e "${ANSI_YELLOW}Creating vendor directory: '$DestinationDir'${ANSI_RESET}"
- mkdir "$DestinationDir"
-fi
-cd $DestinationDir
-if [ -z "$(which grcat)" ]; then
- # if grcat (generic colourizer) is not installed, use a dummy pipe command like 'cat'
- GRC_COMMAND="cat"
-else
- if [ "$SUPPRESS_WARNINGS" == "TRUE" ]; then
- GRC_COMMAND="grcat $ScriptDir/ghdl.skipwarning.grcrules"
- else
- GRC_COMMAND="grcat $ScriptDir/ghdl.grcrules"
- fi
-fi
+GHDL_PARAMS=(${GHDL_OPTIONS[@]})
+GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard -P$DestinationDirectory)
-STOPCOMPILING=FALSE
+
+STOPCOMPILING=0
ERRORCOUNT=0
# Cleanup directory
# ==============================================================================
if [ "$CLEAN" == "TRUE" ]; then
+ echo 1>&2 -e "${COLORED_ERROR} '--clean' is not implemented!"
+ exit -1
echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_RESET}"
rm *.o 2> /dev/null
+ rm *.cf 2> /dev/null
fi
# Library unisim
# ==============================================================================
# compile unisim packages
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'unisim' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_UNISIM" == "TRUE" ]; then
+ Library="unisim"
Files=(
- $SourceDir/unisims/unisim_VPKG.vhd
- $SourceDir/unisims/unisim_VCOMP.vhd
+ ${Library}s/unisim_VPKG.vhd
+ ${Library}s/unisim_VCOMP.vhd
)
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping package '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing package '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=unisim "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile unisim primitives
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ]; then
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
- Files="$(LC_COLLATE=C ls $SourceDir/unisims/primitive/*.vhd)"
- for File in $Files; do
- FileName=$(basename "$File")
- FileSize=($(wc -c $File))
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -n ""
-# echo -e "${ANSI_CYAN}Skipping package '$File'${ANSI_RESET}"
- elif [ "$SKIP_LARGE_FILES" == "TRUE" ] && [ ${FileSize[0]} -gt $LARGE_FILESIZE ]; then
- echo -e "${ANSI_CYAN}Skipping large '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing primitive '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=unisim "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
- done
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_UNISIM" == "TRUE" ]; then
+ Library="unisim"
+ SourceFiles="$(LC_COLLATE=C ls $SourceDirectory/${Library}s/primitive/*.vhd)"
+
+ GHDLCompileLibrary
fi
# compile unisim secureip primitives
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ] && [ "$SECUREIP" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library secureip primitives${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
- Files="$(LC_COLLATE=C ls $SourceDir/unisims/secureip/*.vhd)"
- for File in $Files; do
- FileName=$(basename "$File")
- FileSize=($(wc -c $File))
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -n ""
-# echo -e "${ANSI_CYAN}Skipping package '$File'${ANSI_RESET}"
- elif [ "$SKIP_LARGE_FILES" == "TRUE" ] && [ ${FileSize[0]} -gt $LARGE_FILESIZE ]; then
- echo -e "${ANSI_CYAN}Skipping large '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing primitive '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=secureip "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
- done
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_UNISIM" == "TRUE" ] && [ "$COMPILE_SECUREIP" == "TRUE" ]; then
+ Library="secureip"
+ SourceFiles="$(LC_COLLATE=C ls $SourceDirectory/unisims/$Library/*.vhd)"
+
+ GHDLCompileLibrary
fi
# Library unimacro
# ==============================================================================
# compile unimacro packages
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNIMACRO" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'unimacro' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_UNIMACRO" == "TRUE" ]; then
+ Library="unimacro"
Files=(
- $SourceDir/unimacro/unimacro_VCOMP.vhd
+ $Library/unimacro_VCOMP.vhd
)
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping package '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing package '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=unimacro "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile unimacro macros
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNIMACRO" == "TRUE" ]; then
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
- Files="$(LC_COLLATE=C ls $SourceDir/unimacro/*_MACRO.vhd)"
- for File in $Files; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping package '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing primitive '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=unimacro "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
- done
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_UNIMACRO" == "TRUE" ]; then
+ Library="unimacro"
+ SourceFiles="$(LC_COLLATE=C ls $SourceDirectory/$Library/*_MACRO.vhd)"
+
+ GHDLCompileLibrary
fi
# Library simprim
# ==============================================================================
# compile simprim packages
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$SIMPRIM" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'simprim' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_SIMPRIM" == "TRUE" ]; then
+ Library="simprim"
Files=(
- $SourceDir/simprims/simprim_Vpackage.vhd
- $SourceDir/simprims/simprim_Vcomponents.vhd
+ ${Library}s/simprim_Vpackage.vhd
+ ${Library}s/simprim_Vcomponents.vhd
)
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping package '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing package '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=simprim "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile simprim primitives
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$SIMPRIM" == "TRUE" ]; then
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
- Files="$(LC_COLLATE=C ls $SourceDir/simprims/primitive/other/*.vhd)"
- for File in $Files; do
- FileName=$(basename "$File")
- FileSize=($(wc -c $File))
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -n ""
-# echo -e "${ANSI_CYAN}Skipping package '$File'${ANSI_RESET}"
- elif [ "$SKIP_LARGE_FILES" == "TRUE" ] && [ ${FileSize[0]} -gt $LARGE_FILESIZE ]; then
- echo -e "${ANSI_CYAN}Skipping large '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing primitive '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=simprim "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
- done
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_SIMPRIM" == "TRUE" ]; then
+ Library="simprim"
+ SourceFiles="$(LC_COLLATE=C ls $SourceDirectory/${Library}s/primitive/other/*.vhd)"
+
+ GHDLCompileLibrary
fi
# compile simprim secureip primitives
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$SIMPRIM" == "TRUE" ] && [ "$SECUREIP" == "TRUE" ]; then
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
- Files="$(LC_COLLATE=C ls $SourceDir/simprims/secureip/other/*.vhd)"
- for File in $Files; do
- FileName=$(basename "$File")
- FileSize=($(wc -c $File))
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -n ""
-# echo -e "${ANSI_CYAN}Skipping package '$File'${ANSI_RESET}"
- elif [ "$SKIP_LARGE_FILES" == "TRUE" ] && [ ${FileSize[0]} -gt $LARGE_FILESIZE ]; then
- echo -e "${ANSI_CYAN}Skipping large '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing primitive '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=simprim "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
- done
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_SIMPRIM" == "TRUE" ] && [ "$COMPILE_SECUREIP" == "TRUE" ]; then
+ Library="secureip"
+ SourceFiles="$(LC_COLLATE=C ls $SourceDirectory/simprims/$Library/other/*.vhd)"
+
+ GHDLCompileLibrary
fi
echo "--------------------------------------------------------------------------------"
@@ -442,5 +328,3 @@ if [ $ERRORCOUNT -gt 0 ]; then
else
echo -e $COLORED_SUCCESSFUL
fi
-
-cd $WorkingDir
diff --git a/libraries/vendors/compile-xilinx-vivado.sh b/libraries/vendors/compile-xilinx-vivado.sh
index 3bc06b037..f319b0e02 100755
--- a/libraries/vendors/compile-xilinx-vivado.sh
+++ b/libraries/vendors/compile-xilinx-vivado.sh
@@ -4,11 +4,11 @@
# kate: tab-width 2; replace-tabs off; indent-width 2;
#
# ==============================================================================
+# Authors: Patrick Lehmann
+#
# Bash Script: Script to compile the simulation libraries from Xilinx Vivado
# for GHDL on Linux
#
-# Authors: Patrick Lehmann
-#
# Description:
# ------------------------------------
# This is a Bash script (executable) which:
@@ -16,7 +16,7 @@
# - compiles all Xilinx Vivado simulation libraries and packages
#
# ==============================================================================
-# Copyright (C) 2015 Patrick Lehmann
+# Copyright (C) 2015-2016 Patrick Lehmann
#
# GHDL 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
@@ -38,64 +38,81 @@
# save working directory
WorkingDir=$(pwd)
ScriptDir="$(dirname $0)"
-ScriptDir="$(realpath $ScriptDir)"
+ScriptDir="$(readlink -f $ScriptDir)"
# source configuration file from GHDL's 'vendors' library directory
source $ScriptDir/config.sh
source $ScriptDir/shared.sh
-NO_COMMAND=TRUE
-
# command line argument processing
+NO_COMMAND=1
+SKIP_EXISTING_FILES=0
+SKIP_LARGE_FILES=0
+SUPPRESS_WARNINGS=0
+HALT_ON_ERROR=0
+VHDLStandard=93
+GHDLBinDir=""
+DestDir=""
+SrcDir=""
while [[ $# > 0 ]]; do
key="$1"
case $key in
-c|--clean)
CLEAN=TRUE
- NO_COMMAND=FALSE
+ NO_COMMAND=0
;;
-a|--all)
- ALL=TRUE
+ COMPILE_ALL=TRUE
NO_COMMAND=FALSE
;;
- -s|--skip-existing)
- SKIP_EXISTING_FILES=TRUE
- ;;
- -S|--skip-largefiles)
- SKIP_LARGE_FILES=TRUE
+ --unisim)
+ COMPILE_UNISIM=TRUE
+ NO_COMMAND=0
;;
- -n|--no-warnings)
- SUPPRESS_WARNINGS=TRUE
+ --unimacro)
+ COMPILE_UNIMACRO=TRUE
+ NO_COMMAND=0
;;
- -H|--halt-on-error)
- HALT_ON_ERROR=TRUE
+ --secureip)
+ COMPILE_SECUREIP=TRUE
;;
-# -v|--verbose)
-# VERBOSE=TRUE
-# ;;
-h|--help)
HELP=TRUE
- NO_COMMAND=FALSE
+ NO_COMMAND=0
;;
- --unisim)
- UNISIM=TRUE
- NO_COMMAND=FALSE
+ -s|--skip-existing)
+ SKIP_EXISTING_FILES=1
;;
- --unimacro)
- UNIMACRO=TRUE
- NO_COMMAND=FALSE
+ -S|--skip-largefiles)
+ SKIP_LARGE_FILES=1
;;
- --secureip)
- SECUREIP=TRUE
+ -n|--no-warnings)
+ SUPPRESS_WARNINGS=1
+ ;;
+ -H|--halt-on-error)
+ HALT_ON_ERROR=1
;;
--vhdl93)
- VHDL93=TRUE
+ VHDLStandard=93
;;
--vhdl2008)
- VHDL2008=TRUE
+ VHDLStandard=2008
+ ;;
+ --ghdl)
+ GHDLBinDir="$2"
+ shift # skip argument
+ ;;
+ --src)
+ SrcDir="$2"
+ shift # skip argument
+ ;;
+ --out)
+ DestDir="$2"
+ shift # skip argument
;;
*) # unknown option
- UNKNOWN_OPTION=TRUE
+ echo 1>&2 -e "${COLORED_ERROR} Unknown command line option.${ANSI_RESET}"
+ exit -1
;;
esac
shift # past argument or value
@@ -105,20 +122,16 @@ if [ "$NO_COMMAND" == "TRUE" ]; then
HELP=TRUE
fi
-if [ "$UNKNOWN_OPTION" == "TRUE" ]; then
- echo -e $COLORED_ERROR "Unknown command line option.${ANSI_RESET}"
- exit -1
-elif [ "$HELP" == "TRUE" ]; then
- if [ "$NO_COMMAND" == "TRUE" ]; then
- echo -e $COLORED_ERROR " No command selected."
- fi
+if [ "$HELP" == "TRUE" ]; then
+ test "$NO_COMMAND" == "TRUE" && echo 1>&2 -e "${COLORED_ERROR} No command selected."
echo ""
echo "Synopsis:"
- echo " Script to compile the simulation libraries from Xilinx Vivado for GHDL on Linux"
+ echo " A script to compile the Xilinx Vivado simulation libraries for GHDL on Linux."
+ echo " One library folder 'lib/v??' per VHDL library will be created relative to the current"
+ echo " working directory."
echo ""
echo "Usage:"
- echo " compile-xilinx-vivado.sh <common command>|<library> [<options>]"
-# [-v] [-c] [--unisim] [--unimacro] [--simprim] [--secureip] [-s|--skip-existing] [-S|--skip-largefiles] [-n|--no-warnings]
+ echo " compile-xilinx-vivado.sh <common command>|<library> [<options>] [<adv. options>]"
echo ""
echo "Common commands:"
echo " -h --help Print this help page"
@@ -137,243 +150,145 @@ elif [ "$HELP" == "TRUE" ]; then
echo " -S --skip-largefiles Don't compile large entities like DSP and PCIe primitives."
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 " --out <dir name> Name of the output directory."
+ echo " --src <Path to OSVVM> Name of the output directory."
+ echo ""
echo "Verbosity:"
-# echo " -v --verbose Print more messages"
echo " -n --no-warnings Suppress all warnings. Show only error messages."
echo ""
exit 0
fi
-if [ "$ALL" == "TRUE" ]; then
- UNISIM=TRUE
- UNIMACRO=TRUE
- SECUREIP=TRUE
+if [ "$COMPILE_ALL" == "TRUE" ]; then
+ COMPILE_UNISIM=TRUE
+ COMPILE_UNIMACRO=TRUE
+ COMPILE_SECUREIP=TRUE
fi
-if [ "$VHDL93" == "TRUE" ]; then
- VHDLStandard="93c"
- VHDLFlavor="synopsys"
-elif [ "$VHDL2008" == "TRUE" ]; then
- VHDLStandard="08"
- VHDLFlavor="standard"
+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
-else
- VHDLStandard="93c"
- VHDLFlavor="synopsys"
fi
-# extract data from configuration
-SourceDir=${SourceDirectory[XilinxVivado]}
-DestinationDir=${DestinationDirectory[XilinxVivado]}
-if [ -z $DestinationDir ]; then
- echo -e "${COLORED_ERROR} Xilinx Vivado is not configured in '$ScriptDir/config.sh'${ANSI_RESET}"
- exit -1
-elif [ ! -d $SourceDir ]; then
- echo -e "${COLORED_ERROR} Path '$SourceDir' does not exist.${ANSI_RESET}"
- exit -1
-fi
+# -> $SourceDirectories
+# -> $DestinationDirectories
+# -> $SrcDir
+# -> $DestDir
+# -> $GHDLBinDir
+# <= $SourceDirectory
+# <= $DestinationDirectory
+# <= $GHDLBinary
+SetupDirectories XilinxVivado "Xilinx Vivado"
+
+# create "xilinx-vivado" directory and change to it
+# => $DestinationDirectory
+CreateDestinationDirectory
+cd $DestinationDirectory
+
+
+# => $SUPPRESS_WARNINGS
+# <= $GRC_COMMAND
+SetupGRCat
+
+
+# -> $VHDLStandard
+# <= $VHDLVersion
+# <= $VHDLStandard
+# <= $VHDLFlavor
+GHDLSetup
-# set bash options
-set -o pipefail
# define global GHDL Options
GHDL_OPTIONS=(-fexplicit -frelaxed-rules --no-vital-checks --warn-binding --mb-comments)
-# create "vivado" directory and change to it
-if [[ -d "$DestinationDir" ]]; then
- echo -e "${ANSI_YELLOW}Vendor directory '$DestinationDir' already exists.${ANSI_RESET}"
-else
- echo -e "${ANSI_YELLOW}Creating vendor directory: '$DestinationDir'${ANSI_RESET}"
- mkdir "$DestinationDir"
-fi
-cd $DestinationDir
-if [ -z "$(which grcat)" ]; then
- # if grcat (generic colourizer) is not installed, use a dummy pipe command like 'cat'
- GRC_COMMAND="cat"
-else
- if [ "$SUPPRESS_WARNINGS" == "TRUE" ]; then
- GRC_COMMAND="grcat $ScriptDir/ghdl.skipwarning.grcrules"
- else
- GRC_COMMAND="grcat $ScriptDir/ghdl.grcrules"
- fi
-fi
+GHDL_PARAMS=(${GHDL_OPTIONS[@]})
+GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard -P$DestinationDirectory)
+
-STOPCOMPILING=FALSE
+STOPCOMPILING=0
ERRORCOUNT=0
# Cleanup directory
# ==============================================================================
if [ "$CLEAN" == "TRUE" ]; then
+ echo 1>&2 -e "${COLORED_ERROR} '--clean' is not implemented!"
+ exit -1
echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_RESET}"
rm *.o 2> /dev/null
+ rm *.cf 2> /dev/null
fi
# Library unisim
# ==============================================================================
# compile unisim packages
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'unisim' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_UNISIM" == "TRUE" ]; then
+ Library="unisim"
Files=(
- $SourceDir/unisims/unisim_VPKG.vhd
- $SourceDir/unisims/unisim_VCOMP.vhd
- $SourceDir/unisims/retarget_VCOMP.vhd
- $SourceDir/unisims/unisim_retarget_VCOMP.vhd
+ ${Library}s/unisim_VPKG.vhd
+ ${Library}s/unisim_VCOMP.vhd
+ ${Library}s/retarget_VCOMP.vhd
+ ${Library}s/unisim_retarget_VCOMP.vhd
)
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -n ""
- echo -e "${ANSI_CYAN}Skipping package '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing package '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=unisim "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile unisim primitives
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ]; then
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
- Files="$(LC_COLLATE=C ls $SourceDir/unisims/primitive/*.vhd)"
- for File in $Files; do
- FileName=$(basename "$File")
- FileSize=($(wc -c $File))
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -n ""
-# echo -e "${ANSI_CYAN}Skipping package '$File'${ANSI_RESET}"
- elif [ "$SKIP_LARGE_FILES" == "TRUE" ] && [ ${FileSize[0]} -gt $LARGE_FILESIZE ]; then
- echo -e "${ANSI_CYAN}Skipping large '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing primitive '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=unisim "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
- done
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_UNISIM" == "TRUE" ]; then
+ Library="unisim"
+ SourceFiles="$(LC_COLLATE=C ls $SourceDirectory/${Library}s/primitive/*.vhd)"
+
+ GHDLCompileLibrary
fi
# compile unisim retarget primitives
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ]; then
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
- Files="$(LC_COLLATE=C ls $SourceDir/unisims/retarget/*.vhd)"
- for File in $Files; do
- FileName=$(basename "$File")
- FileSize=($(wc -c $File))
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -n ""
-# echo -e "${ANSI_CYAN}Skipping package '$File'${ANSI_RESET}"
- elif [ "$SKIP_LARGE_FILES" == "TRUE" ] && [ ${FileSize[0]} -gt $LARGE_FILESIZE ]; then
- echo -e "${ANSI_CYAN}Skipping large '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing primitive '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=unisim "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
- done
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_UNISIM" == "TRUE" ]; then
+ Library="unisim"
+ SourceFiles="$(LC_COLLATE=C ls $SourceDirectory/${Library}s/retarget/*.vhd)"
+
+ GHDLCompileLibrary
fi
# compile unisim secureip primitives
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ] && [ "$SECUREIP" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library secureip primitives${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
- Files="$(LC_COLLATE=C ls $SourceDir/unisims/secureip/*.vhd)"
- for File in $Files; do
- FileName=$(basename "$File")
- FileSize=($(wc -c $File))
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -n ""
-# echo -e "${ANSI_CYAN}Skipping package '$File'${ANSI_RESET}"
- elif [ "$SKIP_LARGE_FILES" == "TRUE" ] && [ ${FileSize[0]} -gt $LARGE_FILESIZE ]; then
- echo -e "${ANSI_CYAN}Skipping large '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing primitive '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=secureip "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
- done
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_UNISIM" == "TRUE" ] && [ "$COMPILE_SECUREIP" == "TRUE" ]; then
+ Library="secureip"
+ SourceFiles="$(LC_COLLATE=C ls $SourceDirectory/unisims/$Library/*.vhd)"
+
+ GHDLCompileLibrary
fi
# Library unimacro
# ==============================================================================
# compile unimacro packages
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNIMACRO" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Compiling library 'unimacro' ...${ANSI_RESET}"
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_UNIMACRO" == "TRUE" ]; then
+ Library="unimacro"
Files=(
- $SourceDir/unimacro/unimacro_VCOMP.vhd
+ $Library/unimacro_VCOMP.vhd
)
+ # append absolute source path
+ SourceFiles=()
for File in ${Files[@]}; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping package '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing package '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=unimacro "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
+ SourceFiles+=("$SourceDirectory/$File")
done
+
+ GHDLCompilePackages
fi
# compile unimacro macros
-if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNIMACRO" == "TRUE" ]; then
- GHDL_PARAMS=(${GHDL_OPTIONS[@]})
- GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
- Files="$(LC_COLLATE=C ls $SourceDir/unimacro/*_MACRO.vhd)"
- for File in $Files; do
- FileName=$(basename "$File")
- if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping macro '$File'${ANSI_RESET}"
- else
- echo -e "${ANSI_CYAN}Analyzing macro '$File'${ANSI_RESET}"
- ghdl -a ${GHDL_PARAMS[@]} --work=unimacro "$File" 2>&1 | $GRC_COMMAND
- if [ $? -ne 0 ]; then
- let ERRORCOUNT++
- if [ "$HALT_ON_ERROR" == "TRUE" ]; then
- STOPCOMPILING=TRUE
- break
- fi
- fi
- fi
- done
+if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_UNIMACRO" == "TRUE" ]; then
+ Library="unimacro"
+ SourceFiles="$(LC_COLLATE=C ls $SourceDirectory/$Library/*_MACRO.vhd)"
+
+ GHDLCompileLibrary
fi
# Library UNIFAST
@@ -387,5 +302,3 @@ if [ $ERRORCOUNT -gt 0 ]; then
else
echo -e $COLORED_SUCCESSFUL
fi
-
-cd $WorkingDir
diff --git a/libraries/vendors/config.sh b/libraries/vendors/config.sh
index 9395269b4..813c609ea 100644
--- a/libraries/vendors/config.sh
+++ b/libraries/vendors/config.sh
@@ -39,31 +39,31 @@
#
# These values are used if no command line argument (--src) is passed to a
# compile script. Empty strings means not configured.
-declare -A InstallationDirectory
-InstallationDirectory[AlteraQuartus]="/opt/Altera/15.1"
-InstallationDirectory[XilinxISE]="/opt/Xilinx/14.7"
-InstallationDirectory[XilinxVivado]="/opt/Xilinx/Vivado/2016.1"
-InstallationDirectory[LatticeDiamond]="/usr/local/diamond/3.7_x64"
-InstallationDirectory[OSVVM]="/home/paebbels/git/PoC/lib/osvvm"
-InstallationDirectory[VUnit]="/home/paebbels/git/PoC/lib/vunit"
+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"
# Configure preferred output directories for each library set:
-declare -A DestinationDirectory
-DestinationDirectory[AlteraQuartus]="altera"
-DestinationDirectory[XilinxISE]="xilinx-ise"
-DestinationDirectory[XilinxVivado]="xilinx-vivado"
-DestinationDirectory[LatticeDiamond]="lattice"
-DestinationDirectory[OSVVM]="osvvm"
-DestinationDirectory[VUnit]="vuint"
+declare -A DestinationDirectories
+DestinationDirectories[AlteraQuartus]="altera"
+DestinationDirectories[XilinxISE]="xilinx-ise"
+DestinationDirectories[XilinxVivado]="xilinx-vivado"
+DestinationDirectories[LatticeDiamond]="lattice"
+DestinationDirectories[OSVVM]="." # "osvvm"
+DestinationDirectories[VUnit]="." # "vunit_lib"
# Declare source directories depending on the installation paths:
-declare -A SourceDirectory
-SourceDirectory[AlteraQuartus]="${InstallationDirectory[AlteraQuartus]}/quartus/eda/sim_lib"
-SourceDirectory[XilinxISE]="${InstallationDirectory[XilinxISE]}/ISE_DS/ISE/vhdl/src"
-SourceDirectory[XilinxVivado]="${InstallationDirectory[XilinxVivado]}/data/vhdl/src"
-SourceDirectory[LatticeDiamond]="${InstallationDirectory[LatticeDiamond]}/cae_library/simulation/vhdl"
-SourceDirectory[OSVVM]="${InstallationDirectory[OSVVM]}"
-SourceDirectory[VUnit]="${InstallationDirectory[VUnit]}/vunit/vhdl"
+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"
# 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 adf732081..690e5008b 100644
--- a/libraries/vendors/shared.sh
+++ b/libraries/vendors/shared.sh
@@ -4,10 +4,10 @@
# kate: tab-width 2; replace-tabs off; indent-width 2;
#
# ==============================================================================
-# Bash Script: This is a Bash resource file.
-#
# Authors: Patrick Lehmann
#
+# Bash Script: This is a Bash resource file.
+#
# Description:
# ------------------------------------
# TODO
@@ -46,3 +46,140 @@ COLORED_FAILED="$ANSI_RED[FAILED]$ANSI_RESET"
# green texts
COLORED_DONE="$ANSI_GREEN[DONE]$ANSI_RESET"
COLORED_SUCCESSFUL="$ANSI_GREEN[SUCCESSFUL]$ANSI_RESET"
+
+# set bash options
+set -o pipefail
+
+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
+ 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
+ fi
+
+ if [ -z $SourceDirectory ] || [ -z $DestinationDirectory ]; then
+ echo 1>&2 -e "${COLORED_ERROR} $Name is not configured in '$ScriptDir/config.sh'${ANSI_RESET}"
+ echo 1>&2 -e " Use adv. options '--src' and '--out' or configure 'config.sh'."
+ exit -1
+ elif [ ! -d $SourceDirectory ]; then
+ echo 1>&2 -e "${COLORED_ERROR} Path '$SourceDirectory' does not exist.${ANSI_RESET}"
+ exit -1
+ fi
+
+ # Resolve paths to an absolute paths
+ SourceDirectory=$(readlink -f $SourceDirectory)
+ DestinationDirectory=$(readlink -f $DestinationDirectory)
+
+ # Use GHDL binary directory from command line argument, if set
+ if [ ! -z "$GHDLBinDir" ]; then
+ GHDLBinary=$GHDLBinDir/ghdl
+ if [[ ! -x "$GHDLBinary" ]]; then
+ echo 1>&2 -e "${COLORED_ERROR} GHDL not found or is not executable.${ANSI_RESET}"
+ exit -1
+ fi
+ else # fall back to GHDL found via PATH
+ GHDLBinary=$(which ghdl 2>/dev/null)
+ if [ $? -ne 0 ]; then
+ echo 1>&2 -e "${COLORED_ERROR} GHDL not found in PATH.${ANSI_RESET}"
+ echo 1>&2 -e " Use adv. options '--ghdl' to set the GHDL binary directory."
+ exit -1
+ fi
+ fi
+}
+
+SetupGRCat() {
+ if [ -z "$(which grcat 2>/dev/null)" ]; then
+ # if grcat (generic colourizer) is not installed, use a dummy pipe command like 'cat'
+ GRC_COMMAND="cat"
+ elif [ $SUPPRESS_WARNINGS -eq 1 ]; then
+ GRC_COMMAND="grcat $ScriptDir/ghdl.skipwarning.grcrules"
+ else
+ GRC_COMMAND="grcat $ScriptDir/ghdl.grcrules"
+ fi
+}
+
+CreateDestinationDirectory() {
+ if [[ -d "$DestinationDirectory" ]]; then
+ echo -e "${ANSI_YELLOW}Vendor directory '$DestinationDirectory' already exists.${ANSI_RESET}"
+ else
+ echo -e "${ANSI_YELLOW}Creating vendor directory: '$DestinationDirectory'${ANSI_RESET}"
+ mkdir -p "$DestinationDirectory"
+ fi
+}
+
+GHDLSetup() {
+ if [ $VHDLStandard -eq 93 ]; then
+ VHDLVersion="v93"
+ VHDLStandard="93c"
+ VHDLFlavor="synopsys"
+ elif [ $VHDLStandard -eq 2008 ]; then
+ VHDLVersion="v08"
+ VHDLStandard="08"
+ VHDLFlavor="standard"
+ fi
+}
+
+GHDLCompileLibrary() {
+ # assembling output directory
+ LibraryDirectory=$DestinationDirectory/$Library/$VHDLVersion
+ mkdir -p $LibraryDirectory
+ cd $LibraryDirectory
+ echo -e "${ANSI_YELLOW}Compiling library '$Library'...${ANSI_RESET}"
+
+ for File in ${SourceFiles[@]}; do
+ FileName=$(basename "$File")
+ FileSize=($(wc -c $File))
+ if [ $SKIP_EXISTING_FILES -eq 1 ] && [ -e "${FileName%.*}.o" ]; then
+ echo -e "${ANSI_CYAN}Skipping existing file '$File'${ANSI_RESET}"
+ elif [ $SKIP_LARGE_FILES -eq 1 ] && [ ${FileSize[0]} -gt $LARGE_FILESIZE ]; then
+ echo -e "${ANSI_CYAN}Skipping large file '$File'${ANSI_RESET}"
+ else
+ echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
+ $GHDLBinary -a ${GHDL_PARAMS[@]} --work=$Library "$File" 2>&1 | $GRC_COMMAND
+ if [ $? -ne 0 ]; then
+ let ERRORCOUNT++
+ test $HALT_ON_ERROR -eq 1 && return 1
+ fi
+ fi
+ done
+ return 0
+}
+
+GHDLCompilePackages() {
+ # assembling output directory
+ LibraryDirectory=$DestinationDirectory/$Library/$VHDLVersion
+ mkdir -p $LibraryDirectory
+ cd $LibraryDirectory
+ echo -e "${ANSI_YELLOW}Compiling library '$Library'...${ANSI_RESET}"
+
+ for File in ${SourceFiles[@]}; do
+ FileName=$(basename "$File")
+ if [ $SKIP_EXISTING_FILES -eq 1 ] && [ -e "${FileName%.*}.o" ]; then
+ echo -e "${ANSI_CYAN}Skipping existing package '$File'${ANSI_RESET}"
+ else
+ echo -e "${ANSI_CYAN}Analyzing package '$File'${ANSI_RESET}"
+ $GHDLBinary -a ${GHDL_PARAMS[@]} --work=$Library "$File" 2>&1 | $GRC_COMMAND
+ if [ $? -ne 0 ]; then
+ let ERRORCOUNT++
+ test $HALT_ON_ERROR -eq 1 && return 1
+ fi
+ fi
+ done
+ return 0
+}
+