From 944c6f2a4655a9ad6985a7e9b92e11391daedab4 Mon Sep 17 00:00:00 2001
From: Patrick Lehmann <Patrick.Lehmann@tu-dresden.de>
Date: Sat, 10 Dec 2016 22:59:52 +0100
Subject: Updated pre-compile script for UVVM.

---
 libraries/vendors/compile-uvvm.ps1 | 285 +++++++++++++++++--------------------
 1 file changed, 131 insertions(+), 154 deletions(-)

diff --git a/libraries/vendors/compile-uvvm.ps1 b/libraries/vendors/compile-uvvm.ps1
index 62b8b4a29..073aa5121 100644
--- a/libraries/vendors/compile-uvvm.ps1
+++ b/libraries/vendors/compile-uvvm.ps1
@@ -43,45 +43,44 @@
 [CmdletBinding()]
 param(
 	# Show the embedded help page(s).
-	[switch]$Help =									$false,
+	[switch]$Help =								$false,
 	
 	# Compile all packages.
-	[switch]$All =									$false,
+	[switch]$All =								$true,
 	
 	# Compile all UVVM packages.
-	[switch]$UVVM =									$false,
+	[switch]$UVVM =								$true,
 	# Compile all UVVM Utility packages.
-	[switch]$UVVM_Utilities =				$false,
+	[switch]$UVVM_Utilities =			$true,
 	# Compile all UVVM VCC Framework packages.
-	[switch]$UVVM_VCC_Framework =		$false,
-	
+	[switch]$UVVM_VCC_Framework =	$true,
 	# Compile all UVVM Verification IPs (VIPs).
-	[switch]$UVVM_VIP =							$false,
-	# Compile VIP: AXI-Lite
-	[switch]$UVVM_VIP_AXI_Lite =		$false,
-	# Compile VIP: AXI-Stream
-	[switch]$UVVM_VIP_AXI_Stream =	$false,
-	# Compile VIP: I2C
-	[switch]$UVVM_VIP_I2C =					$false,
-	# Compile VIP: SBI (Simple Byte Interface)
-	[switch]$UVVM_VIP_SBI =					$false,
-	# Compile VIP: UART
-	[switch]$UVVM_VIP_UART =				$false,
+	[switch]$UVVM_VIP =								$true,
+		# Compile VIP: AXI-Lite
+		[switch]$UVVM_VIP_AXI_Lite =		$true,
+		# Compile VIP: AXI-Stream
+		[switch]$UVVM_VIP_AXI_Stream =	$true,
+		# Compile VIP: I2C
+		[switch]$UVVM_VIP_I2C =					$true,
+		# Compile VIP: SBI (Simple Byte Interface)
+		[switch]$UVVM_VIP_SBI =					$true,
+		# Compile VIP: UART
+		[switch]$UVVM_VIP_UART =				$true,
 	
 	# Clean up directory before analyzing.
-	[switch]$Clean =								$false,
+	[switch]$Clean =							$false,
 	
 	#Skip warning messages. (Show errors only.)
-	[switch]$SuppressWarnings = 		$false,
+	[switch]$SuppressWarnings = 	$false,
 	# Halt on errors.
-	[switch]$HaltOnError =					$false,
+	[switch]$HaltOnError =				$false,
 	
 	# Set vendor library source directory.
-	[string]$Source =								"",
+	[string]$Source =							"",
 	# Set output directory name.
-	[string]$Output =								"",
+	[string]$Output =							"",
 	# Set GHDL executable.
-	[string]$GHDL =									""
+	[string]$GHDL =								""
 )
 
 # ---------------------------------------------
@@ -89,27 +88,21 @@ param(
 $WorkingDir =		Get-Location
 
 # set default values
-$EnableVerbose =			$PSCmdlet.MyInvocation.BoundParameters["Verbose"]
-$EnableDebug =				$PSCmdlet.MyInvocation.BoundParameters["Debug"]
-if ($EnableVerbose -eq $null)	{	$EnableVerbose =	$false	}
-if ($EnableDebug	 -eq $null)	{	$EnableDebug =		$false	}
-if ($EnableDebug	 -eq $true)	{	$EnableVerbose =	$true		}
+$EnableDebug =		[bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"]
+$EnableVerbose =	[bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug
 
 # load modules from GHDL's 'vendors' library directory
 Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -Debug:$false -ArgumentList "UVVM"
 Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -Debug:$false -ArgumentList @("UVVM", "$WorkingDir")
 
 # Display help if no command was selected
-$Help = $Help -or (-not ($All -or
-									($UVVM -or $UVVM_VIP) -or
-									($UVVM_Utilities -or $UVVM_VVC_Framework) -or
-									($UVVM_VIP_AXI_Lite -or $UVVM_VIP_AXI_Stream -or $UVVM_VIP_I2C -or $UVVM_VIP_SBI -or $UVVM_VIP_UART) -or
-									$Clean))
-
-if ($Help)
+if ($Help -or (-not ($All -or $Clean -or
+										($UVVM -or			($UVVM_Utilities -or $UVVM_VVC_Framework)) -or
+										($UVVM_VIP -or	($UVVM_VIP_AXI_Lite -or $UVVM_VIP_AXI_Stream -or $UVVM_VIP_I2C -or $UVVM_VIP_SBI -or $UVVM_VIP_UART))		)))
 {	Get-Help $MYINVOCATION.InvocationName -Detailed
 	Exit-CompileScript
 }
+
 if ($All)
 {	$UVVM =									$true
 	$UVVM_VIP =							$true
@@ -156,25 +149,106 @@ if ($Clean)
 	rm *.cf
 }
 
+$UVVM_Util_Files = @(
+	"uvvm_util\src\types_pkg.vhd",
+	"uvvm_util\src\adaptations_pkg.vhd",
+	"uvvm_util\src\string_methods_pkg.vhd",
+	"uvvm_util\src\protected_types_pkg.vhd",
+	"uvvm_util\src\hierarchy_linked_list_pkg.vhd",
+	"uvvm_util\src\alert_hierarchy_pkg.vhd",
+	"uvvm_util\src\license_pkg.vhd",
+	"uvvm_util\src\methods_pkg.vhd",
+	"uvvm_util\src\bfm_common_pkg.vhd",
+	"uvvm_util\src\uvvm_util_context.vhd"
+)
+$UVVM_VVC_Files = @(
+	"uvvm_vvc_framework\src\ti_vvc_framework_support_pkg.vhd",
+	"uvvm_vvc_framework\src\ti_generic_queue_pkg.vhd",
+	"uvvm_vvc_framework\src\ti_data_queue_pkg.vhd",
+	"uvvm_vvc_framework\src\ti_data_fifo_pkg.vhd",
+	"uvvm_vvc_framework\src\ti_data_stack_pkg.vhd"
+)
+$VIP_Files = @{
+	"AXILite" = @{
+		"Variable" =	"UVVM_VIP_AXI_Lite";
+		"Library" =		"bitvis_vip_axilite";
+		"Files" =			@(
+			"bitvis_vip_axilite\src\axilite_bfm_pkg.vhd",
+			"bitvis_vip_axilite\src\vvc_cmd_pkg.vhd",
+			"uvvm_vvc_framework\src_target_dependent\td_target_support_pkg.vhd",
+			"uvvm_vvc_framework\src_target_dependent\td_vvc_framework_common_methods_pkg.vhd",
+			"bitvis_vip_axilite\src\vvc_methods_pkg.vhd",
+			"uvvm_vvc_framework\src_target_dependent\td_queue_pkg.vhd",
+			"uvvm_vvc_framework\src_target_dependent\td_vvc_entity_support_pkg.vhd",
+			"bitvis_vip_axilite\src\axilite_vvc.vhd"
+		)
+	};
+	"AXIStream" = @{
+		"Variable" =	"UVVM_VIP_AXI_Stream";
+		"Library" =		"bitvis_vip_axistream";
+		"Files" =			@(
+			"bitvis_vip_axistream\src\axistream_bfm_pkg.vhd",
+			"bitvis_vip_axistream\src\vvc_cmd_pkg.vhd",
+			"uvvm_vvc_framework\src_target_dependent\td_target_support_pkg.vhd",
+			"uvvm_vvc_framework\src_target_dependent\td_vvc_framework_common_methods_pkg.vhd",
+			"bitvis_vip_axistream\src\vvc_methods_pkg.vhd",
+			"uvvm_vvc_framework\src_target_dependent\td_queue_pkg.vhd",
+			"uvvm_vvc_framework\src_target_dependent\td_vvc_entity_support_pkg.vhd",
+			"bitvis_vip_axistream\src\axistream_vvc.vhd"
+		)
+	};
+	"I2C" = @{
+		"Variable" =	"UVVM_VIP_I2C";
+		"Library" =		"bitvis_vip_i2c";
+		"Files" =			@(
+			"bitvis_vip_i2c\src\i2c_bfm_pkg.vhd",
+			"bitvis_vip_i2c\src\vvc_cmd_pkg.vhd",
+			"uvvm_vvc_framework\src_target_dependent\td_target_support_pkg.vhd",
+			"uvvm_vvc_framework\src_target_dependent\td_vvc_framework_common_methods_pkg.vhd",
+			"bitvis_vip_i2c\src\vvc_methods_pkg.vhd",
+			"uvvm_vvc_framework\src_target_dependent\td_queue_pkg.vhd",
+			"uvvm_vvc_framework\src_target_dependent\td_vvc_entity_support_pkg.vhd",
+			"bitvis_vip_i2c\src\i2c_vvc.vhd"
+		)
+	};
+	"SBI" = @{
+		"Variable" =	"UVVM_VIP_SBI";
+		"Library" =		"bitvis_vip_sbi";
+		"Files" =			@(
+			"bitvis_vip_sbi/src/sbi_bfm_pkg.vhd",
+			"bitvis_vip_sbi/src/vvc_cmd_pkg.vhd",
+			"uvvm_vvc_framework/src_target_dependent/td_target_support_pkg.vhd",
+			"uvvm_vvc_framework/src_target_dependent/td_vvc_framework_common_methods_pkg.vhd",
+			"bitvis_vip_sbi/src/vvc_methods_pkg.vhd",
+			"uvvm_vvc_framework/src_target_dependent/td_queue_pkg.vhd",
+			"uvvm_vvc_framework/src_target_dependent/td_vvc_entity_support_pkg.vhd",
+			"bitvis_vip_sbi/src/sbi_vvc.vhd"
+		)
+	};
+	"UART" = @{
+		"Variable" =	"UVVM_VIP_UART";
+		"Library" =		"bitvis_vip_uart";
+		"Files" =			@(
+			"bitvis_vip_uart\src\uart_bfm_pkg.vhd",
+			"bitvis_vip_uart\src\vvc_cmd_pkg.vhd",
+			"uvvm_vvc_framework\src_target_dependent\td_target_support_pkg.vhd",
+			"uvvm_vvc_framework\src_target_dependent\td_vvc_framework_common_methods_pkg.vhd",
+			"bitvis_vip_uart\src\vvc_methods_pkg.vhd",
+			"uvvm_vvc_framework\src_target_dependent\td_queue_pkg.vhd",
+			"uvvm_vvc_framework\src_target_dependent\td_vvc_entity_support_pkg.vhd",
+			"bitvis_vip_uart\src\uart_rx_vvc.vhd",
+			"bitvis_vip_uart\src\uart_tx_vvc.vhd",
+			"bitvis_vip_uart\src\uart_vvc.vhd"
+		)
+	}
+}
 
 # UVVM packages
 # ==============================================================================
 # compile uvvm_util library
 if ((-not $StopCompiling) -and $UVVM_Utilities)
 {	$Library = "uvvm_util"
-	$Files = @(
-		"uvvm_util\src\types_pkg.vhd",
-		"uvvm_util\src\adaptations_pkg.vhd",
-		"uvvm_util\src\string_methods_pkg.vhd",
-		"uvvm_util\src\protected_types_pkg.vhd",
-		"uvvm_util\src\hierarchy_linked_list_pkg.vhd",
-		"uvvm_util\src\alert_hierarchy_pkg.vhd",
-		"uvvm_util\src\license_pkg.vhd",
-		"uvvm_util\src\methods_pkg.vhd",
-		"uvvm_util\src\bfm_common_pkg.vhd",
-		"uvvm_util\src\uvvm_util_context.vhd"
-	)
-	$SourceFiles = $Files | % { "$SourceDirectory\$_" }
+	$SourceFiles = $UVVM_Util_Files | % { "$SourceDirectory\$_" }
 	
 	$ErrorCount += 0
 	Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
@@ -184,120 +258,23 @@ if ((-not $StopCompiling) -and $UVVM_Utilities)
 # compile uvvm_vvc_framework library
 if ((-not $StopCompiling) -and $UVVM_VCC_Framework)
 {	$Library = "uvvm_vvc_framework"
-	$Files = @(
-		"uvvm_vvc_framework\src\ti_vvc_framework_support_pkg.vhd",
-		"uvvm_vvc_framework\src\ti_generic_queue_pkg.vhd",
-		"uvvm_vvc_framework\src\ti_data_queue_pkg.vhd",
-		"uvvm_vvc_framework\src\ti_data_fifo_pkg.vhd",
-		"uvvm_vvc_framework\src\ti_data_stack_pkg.vhd"
-	)
-	$SourceFiles = $Files | % { "$SourceDirectory\$_" }
-	
-	$ErrorCount += 0
-	Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
-	$StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
-}
-
-# compile bitvis_vip_axilite library
-if ((-not $StopCompiling) -and $UVVM_VIP_AXI_Lite)
-{	$Library = "bitvis_vip_axilite"
-	$Files = @(
-		"bitvis_vip_axilite\src\axilite_bfm_pkg.vhd",
-		"bitvis_vip_axilite\src\vvc_cmd_pkg.vhd",
-		"uvvm_vvc_framework\src_target_dependent\td_target_support_pkg.vhd",
-		"uvvm_vvc_framework\src_target_dependent\td_vvc_framework_common_methods_pkg.vhd",
-		"bitvis_vip_axilite\src\vvc_methods_pkg.vhd",
-		"uvvm_vvc_framework\src_target_dependent\td_queue_pkg.vhd",
-		"uvvm_vvc_framework\src_target_dependent\td_vvc_entity_support_pkg.vhd",
-		"bitvis_vip_axilite\src\axilite_vvc.vhd"
-	)
-	$SourceFiles = $Files | % { "$SourceDirectory\$_" }
-	
-	$ErrorCount += 0
-	Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
-	$StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
-}
-
-# compile bitvis_vip_axistream library
-if ((-not $StopCompiling) -and $UVVM_VIP_AXI_Stream)
-{	$Library = "bitvis_vip_axistream"
-	$Files = @(
-		"bitvis_vip_axistream\src\axistream_bfm_pkg.vhd",
-		"bitvis_vip_axistream\src\vvc_cmd_pkg.vhd",
-		"uvvm_vvc_framework\src_target_dependent\td_target_support_pkg.vhd",
-		"uvvm_vvc_framework\src_target_dependent\td_vvc_framework_common_methods_pkg.vhd",
-		"bitvis_vip_axistream\src\vvc_methods_pkg.vhd",
-		"uvvm_vvc_framework\src_target_dependent\td_queue_pkg.vhd",
-		"uvvm_vvc_framework\src_target_dependent\td_vvc_entity_support_pkg.vhd",
-		"bitvis_vip_axistream\src\axistream_vvc.vhd"
-	)
-	$SourceFiles = $Files | % { "$SourceDirectory\$_" }
+	$SourceFiles = $UVVM_VVC_Files | % { "$SourceDirectory\$_" }
 	
 	$ErrorCount += 0
 	Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
 	$StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
 }
 
-# compile bitvis_vip_i2c library
-if ((-not $StopCompiling) -and $UVVM_VIP_I2C)
-{	$Library = "bitvis_vip_i2c"
-	$Files = @(
-		"bitvis_vip_i2c\src\i2c_bfm_pkg.vhd",
-		"bitvis_vip_i2c\src\vvc_cmd_pkg.vhd",
-		"uvvm_vvc_framework\src_target_dependent\td_target_support_pkg.vhd",
-		"uvvm_vvc_framework\src_target_dependent\td_vvc_framework_common_methods_pkg.vhd",
-		"bitvis_vip_i2c\src\vvc_methods_pkg.vhd",
-		"uvvm_vvc_framework\src_target_dependent\td_queue_pkg.vhd",
-		"uvvm_vvc_framework\src_target_dependent\td_vvc_entity_support_pkg.vhd",
-		"bitvis_vip_i2c\src\i2c_vvc.vhd"
-	)
-	$SourceFiles = $Files | % { "$SourceDirectory\$_" }
-	
-	$ErrorCount += 0
-	Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
-	$StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
-}
 
-# compile bitvis_vip_sbi library
-if ((-not $StopCompiling) -and $UVVM_VIP_UART)
-{	$Library = "bitvis_vip_sbi"
-	$Files = @(
-		"bitvis_vip_sbi/src/sbi_bfm_pkg.vhd",
-		"bitvis_vip_sbi/src/vvc_cmd_pkg.vhd",
-		"uvvm_vvc_framework/src_target_dependent/td_target_support_pkg.vhd",
-		"uvvm_vvc_framework/src_target_dependent/td_vvc_framework_common_methods_pkg.vhd",
-		"bitvis_vip_sbi/src/vvc_methods_pkg.vhd",
-		"uvvm_vvc_framework/src_target_dependent/td_queue_pkg.vhd",
-		"uvvm_vvc_framework/src_target_dependent/td_vvc_entity_support_pkg.vhd",
-		"bitvis_vip_sbi/src/sbi_vvc.vhd"
-	)
-	$SourceFiles = $Files | % { "$SourceDirectory\$_" }
-	
-	$ErrorCount += 0
-	Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
-	$StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
-}
+foreach ($vip in $VIP_Files.Keys)
+{	if ((-not $StopCompiling) -and (Get-Variable $VIP_Files[$vip]["Variable"] -ValueOnly))
+	{	$Library =			$VIP_Files[$vip]["Library"]
+		$SourceFiles =	$VIP_Files[$vip]["Files"] | % { "$SourceDirectory\$_" }
 
-# compile bitvis_vip_uart library
-if ((-not $StopCompiling) -and $UVVM_VIP_UART)
-{	$Library = "bitvis_vip_uart"
-	$Files = @(
-		"bitvis_vip_uart\src\uart_bfm_pkg.vhd",
-		"bitvis_vip_uart\src\vvc_cmd_pkg.vhd",
-		"uvvm_vvc_framework\src_target_dependent\td_target_support_pkg.vhd",
-		"uvvm_vvc_framework\src_target_dependent\td_vvc_framework_common_methods_pkg.vhd",
-		"bitvis_vip_uart\src\vvc_methods_pkg.vhd",
-		"uvvm_vvc_framework\src_target_dependent\td_queue_pkg.vhd",
-		"uvvm_vvc_framework\src_target_dependent\td_vvc_entity_support_pkg.vhd",
-		"bitvis_vip_uart\src\uart_rx_vvc.vhd",
-		"bitvis_vip_uart\src\uart_tx_vvc.vhd",
-		"bitvis_vip_uart\src\uart_vvc.vhd"
-	)
-	$SourceFiles = $Files | % { "$SourceDirectory\$_" }
-	
-	$ErrorCount += 0
-	Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
-	$StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+		$ErrorCount += 0
+		Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+		$StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+	}
 }
 
 Write-Host "--------------------------------------------------------------------------------"
-- 
cgit v1.2.3