aboutsummaryrefslogtreecommitdiffstats
path: root/libraries/vendors/compile-osvvm.sh
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/vendors/compile-osvvm.sh')
-rwxr-xr-xlibraries/vendors/compile-osvvm.sh263
1 files changed, 143 insertions, 120 deletions
diff --git a/libraries/vendors/compile-osvvm.sh b/libraries/vendors/compile-osvvm.sh
index 45c1db580..b1d1a2701 100755
--- a/libraries/vendors/compile-osvvm.sh
+++ b/libraries/vendors/compile-osvvm.sh
@@ -1,8 +1,4 @@
#! /usr/bin/env bash
-# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*-
-# vim: tabstop=2:shiftwidth=2:noexpandtab
-# kate: tab-width 2; replace-tabs off; indent-width 2;
-#
# ==============================================================================
# Authors:
# Patrick Lehmann
@@ -32,81 +28,89 @@
# along with this program. If not, see <gnu.org/licenses>.
# ==============================================================================
-# ---------------------------------------------
-# work around for Darwin (Mac OS)
+# Work around for Darwin (Mac OS)
READLINK=readlink; if [[ $(uname) == "Darwin" ]]; then READLINK=greadlink; fi
-# save working directory
+# Save working directory
WorkingDir=$(pwd)
ScriptDir="$(dirname $0)"
ScriptDir="$($READLINK -f $ScriptDir)"
-# source configuration file from GHDL's 'vendors' library directory
-. $ScriptDir/../ansi_color.sh
-. $ScriptDir/config.sh
-. $ScriptDir/shared.sh
+# Source Bash utilities
+source $ScriptDir/../ansi_color.sh
+if [[ $? -ne 0 ]]; then echo 1>&2 -e "${COLORED_ERROR} While loading Bash utilities.${ANSI_NOCOLOR}" ; exit 1; fi
+
-# command line argument processing
-NO_COMMAND=1
+# Command line argument processing
+COMMAND=1
+CLEAN=0
+COMPILE_OSVVM=0
+VERBOSE=0
+DEBUG=0
+FILTERING=0 # TODO: 1
SUPPRESS_WARNINGS=0
HALT_ON_ERROR=0
-GHDLBinDir=""
DestDir=""
SrcDir=""
-while [[ $# > 0 ]]; do
- key="$1"
- case $key in
+while [[ $# -gt 0 ]]; do
+ case "$1" in
-c|--clean)
- CLEAN=TRUE
- NO_COMMAND=0
- ;;
+ COMMAND=3
+ CLEAN=1
+ ;;
-a|--all)
- COMPILE_ALL=TRUE
- NO_COMMAND=0
- ;;
+ COMMAND=2
+ ;;
--osvvm)
- COMPILE_OSVVM=TRUE
- NO_COMMAND=0
- ;;
+ COMMAND=3
+ COMPILE_OSVVM=1
+ ;;
+ -v|--verbose)
+ VERBOSE=1
+ ;;
+ -d|--debug)
+ VERBOSE=1
+ DEBUG=1
+ ;;
-h|--help)
- HELP=TRUE
- NO_COMMAND=0
- ;;
- -n|--no-warnings)
- SUPPRESS_WARNINGS=1
- ;;
+ COMMAND=0
+ break
+ ;;
+ -n|--no-filter)
+ FILTERING=0
+ ;;
+ -N|--no-warnings)
+ SUPPRESS_WARNINGS=1
+ ;;
-H|--halt-on-error)
- HALT_ON_ERROR=1
- ;;
+ HALT_ON_ERROR=1
+ ;;
--ghdl)
- GHDLBinDir="$2"
- shift # skip argument
- ;;
- --src)
- SrcDir="$2"
- shift # skip argument
- ;;
- --out)
- DestDir="$2"
- shift # skip argument
- ;;
+ GHDL="$2" # overwrite a potentially existing GHDL environment variable
+ shift # skip argument
+ ;;
+ --source)
+ SrcDir="$2"
+ shift # skip argument
+ ;;
+ --output)
+ DestDir="$2"
+ shift # skip argument
+ ;;
*) # unknown option
- echo 1>&2 -e "${COLORED_ERROR} Unknown command line option '$key'.${ANSI_NOCOLOR}"
- exit -1
- ;;
+ echo 1>&2 -e "\n${COLORED_ERROR} Unknown command line option '$1'.${ANSI_NOCOLOR}"
+ COMMAND=0
+ break
+ ;;
esac
- shift # skip argument or value
+ shift # parsed argument or value
done
-# makes no sense to enable it for OSVVM
-SKIP_EXISTING_FILES=0
-
-if [ $NO_COMMAND -eq 1 ]; then
- HELP=TRUE
-fi
+ERRORCOUNT=0
+Libraries=()
-if [ "$HELP" == "TRUE" ]; then
- test $NO_COMMAND -eq 1 && echo 1>&2 -e "\n${COLORED_ERROR} No command selected."
+if [[ $COMMAND -le 1 ]]; then
+ test $COMMAND -eq 1 && echo 1>&2 -e "\n${COLORED_ERROR} No command selected.${ANSI_NOCOLOR}"
echo ""
echo "Synopsis:"
echo " A script to compile the simulation library 'OSVVM' for GHDL on Linux."
@@ -116,46 +120,61 @@ if [ "$HELP" == "TRUE" ]; then
echo " Use the adv. options or edit 'config.sh' to supply paths and default params."
echo ""
echo "Usage:"
- echo " compile-osvvm.sh <common command>|<library> [<options>] [<adv. options>]"
+ echo " compile-osvvm.sh [<verbosity>] <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 libraries."
- echo " --osvvm Compile library osvvm."
+ echo " -a --all Compile all libraries."
+ echo " --osvvm Compile library osvvm."
+ # echo " --osvvm-vip Compile OSVVM Verification IPs (VIPs)."
+ # echo ""
+ # echo "Verification IPs:"
+ # echo " --osvvm-vip-axi ARM AMBA AXI4"
echo ""
echo "Library compile options:"
- echo " -H --halt-on-error Halt on error(s)."
+ echo " -H --halt-on-error Halt on error(s)."
echo ""
echo "Advanced options:"
- echo " --ghdl <GHDL bin dir> Path to GHDL's binary directory, e.g. /usr/local/bin"
- echo " --out <dir name> Name of the output directory, e.g. vunit"
- echo " --src <Path to OSVVM> Path to the sources."
+ echo " --ghdl <GHDL binary> Path to GHDL's executable, e.g. /usr/local/bin/ghdl"
+ echo " --output <dir name> Name of the output directory, e.g. osvvm"
+ echo " --source <Path to OSVVM> Path to the sources."
echo ""
echo "Verbosity:"
- echo " -n --no-warnings Suppress all warnings. Show only error messages."
+ echo " -v --verbose Print verbose messages."
+ echo " -d --debug Print debug messages."
+# echo " -n --no-filter Disable output filtering scripts."
+ echo " -N --no-warnings Suppress all warnings. Show only error messages."
echo ""
- exit 0
+ exit $COMMAND
fi
-if [ "$COMPILE_ALL" == "TRUE" ]; then
- COMPILE_OSVVM=TRUE
+if [[ $COMMAND -eq 2 ]]; then
+ COMPILE_OSVVM=1
+# COMPILE_OSVVM_VIP=1
fi
+# if [[ $COMPILE_OSVVM_VIP -eq 1 ]]; then
+ # COMPILE_OSVVM_VIP_AXI=1
+# fi
+
+# Source configuration file from GHDL's 'vendors' library directory
+source $ScriptDir/config.sh
+if [[ $? -ne 0 ]]; then echo 1>&2 -e "${COLORED_ERROR} While loading configuration.${ANSI_NOCOLOR}" ; exit 1; fi
+source $ScriptDir/shared.sh
+if [[ $? -ne 0 ]]; then echo 1>&2 -e "${COLORED_ERROR} While loading further procedures.${ANSI_NOCOLOR}"; exit 1; fi
# -> $SourceDirectories
# -> $DestinationDirectories
# -> $SrcDir
# -> $DestDir
-# -> $GHDLBinDir
# <= $SourceDirectory
# <= $DestinationDirectory
-# <= $GHDLBinary
SetupDirectories OSVVM "OSVVM"
-# create "osvvm" directory and change to it
+# Create "osvvm" directory and change to it
# => $DestinationDirectory
CreateDestinationDirectory
cd $DestinationDirectory
@@ -166,64 +185,68 @@ cd $DestinationDirectory
SetupGRCat
-# define global GHDL Options
-GHDL_OPTIONS=(-fexplicit -frelaxed-rules --no-vital-checks --warn-binding --mb-comments)
+# Extend global GHDL Options
+Analyze_Parameters+=(
+ -fexplicit
+ --no-vital-checks
+ -Wbinding
+ -Wno-hide
+ -Wno-others
+ -Wno-static
+ --std=08
+ -P$DestinationDirectory
+)
+VHDLVersion="v08"
# Cleanup directory
# ==============================================================================
-if [ "$CLEAN" == "TRUE" ]; then
+if [[ $CLEAN -eq 1 ]]; then
echo -e "${ANSI_YELLOW}Cleaning up directory ...${ANSI_NOCOLOR}"
rm *.o 2> /dev/null
rm *.cf 2> /dev/null
fi
-# create local set of GHDL parameters
-GHDL_PARAMS=(--std=08)
-GHDL_PARAMS+=(${GHDL_OPTIONS[@]})
-VHDLVersion="v08"
-
# Library osvvm
# ==============================================================================
-# compile osvvm packages
-ERRORCOUNT=0
-if [ "$COMPILE_OSVVM" == "TRUE" ]; then
- Library="osvvm"
- Files=(
- NamePkg.vhd
- OsvvmGlobalPkg.vhd
- VendorCovApiPkg.vhd
- TranscriptPkg.vhd
- TextUtilPkg.vhd
- AlertLogPkg.vhd
- MessagePkg.vhd
- SortListPkg_int.vhd
- RandomBasePkg.vhd
- RandomPkg.vhd
- CoveragePkg.vhd
- MemoryPkg.vhd
- ScoreboardGenericPkg.vhd
- ScoreboardPkg_slv.vhd
- ScoreboardPkg_int.vhd
- ResolutionPkg.vhd
- TbUtilPkg.vhd
- OsvvmContext.vhd
- )
-
- # append absolute source path
- SourceFiles=()
- for File in ${Files[@]}; do
- SourceFiles+=("$SourceDirectory/$File")
- done
-
- GHDLCompilePackages
-fi
-
-echo "--------------------------------------------------------------------------------"
-echo -n "Compiling OSVVM packages "
-if [ $ERRORCOUNT -gt 0 ]; then
- echo -e $COLORED_FAILED
+StructName="OSVVM"
+Files=(
+ NamePkg.vhd
+ OsvvmGlobalPkg.vhd
+ VendorCovApiPkg.vhd
+ TranscriptPkg.vhd
+ TextUtilPkg.vhd
+ AlertLogPkg.vhd
+ MessagePkg.vhd
+ SortListPkg_int.vhd
+ RandomBasePkg.vhd
+ RandomPkg.vhd
+ CoveragePkg.vhd
+ MemoryPkg.vhd
+ ScoreboardGenericPkg.vhd
+ ScoreboardPkg_slv.vhd
+ ScoreboardPkg_int.vhd
+ ResolutionPkg.vhd
+ TbUtilPkg.vhd
+ OsvvmContext.vhd
+)
+CreateLibraryStruct $StructName "osvvm" "." $VHDLVersion "${Files[@]}"
+test $COMPILE_OSVVM -eq 1 && Libraries+=($StructName)
+
+# for VIPName in ${VIPNames[*]}; do
+ # VarName="COMPILE_OSVVM_${VIPName}"
+ # if [[ ${!VarName} -eq 1 ]]; then
+ # Libraries="$Libraries $VIPName"
+ # fi
+# done
+
+# Compile libraries
+if [[ "$Libraries" != "" ]]; then
+ Compile "$SourceDirectory" "${Libraries[*]}"
+
+ echo "--------------------------------------------------------------------------------"
+ echo -e "Compiling OSVVM packages and VIPs $(test $ERRORCOUNT -eq 0 && echo $COLORED_SUCCESSFUL || echo $COLORED_FAILED)"
else
- echo -e $COLORED_SUCCESSFUL
+ echo -e "${ANSI_RED}Neither OSVVM packages nor VIPs selected.${ANSI_NOCOLOR}"
fi