aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/vendors
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/vendors')
-rw-r--r--scripts/vendors/README.md132
-rw-r--r--scripts/vendors/compile-altera.ps1578
-rwxr-xr-xscripts/vendors/compile-altera.sh708
-rw-r--r--scripts/vendors/compile-intel.ps1578
-rwxr-xr-xscripts/vendors/compile-intel.sh666
-rw-r--r--scripts/vendors/compile-lattice.ps1394
-rwxr-xr-xscripts/vendors/compile-lattice.sh598
-rw-r--r--scripts/vendors/compile-osvvm.ps1336
-rwxr-xr-xscripts/vendors/compile-osvvm.sh264
-rw-r--r--scripts/vendors/compile-uvvm.ps1280
-rwxr-xr-xscripts/vendors/compile-uvvm.sh437
-rw-r--r--scripts/vendors/compile-xilinx-ise.ps1308
-rwxr-xr-xscripts/vendors/compile-xilinx-ise.sh389
-rw-r--r--scripts/vendors/compile-xilinx-vivado.ps1258
-rwxr-xr-xscripts/vendors/compile-xilinx-vivado.sh359
-rw-r--r--scripts/vendors/config.psm1113
-rwxr-xr-xscripts/vendors/config.sh84
-rw-r--r--scripts/vendors/filter.analyze.sh143
-rw-r--r--scripts/vendors/shared.psm1510
-rwxr-xr-xscripts/vendors/shared.sh323
20 files changed, 7458 insertions, 0 deletions
diff --git a/scripts/vendors/README.md b/scripts/vendors/README.md
new file mode 100644
index 000000000..4b3e90ec9
--- /dev/null
+++ b/scripts/vendors/README.md
@@ -0,0 +1,132 @@
+# Compile Scripts for Vendor VHDL Libraries
+
+Vendors like Altera, Lattice and Xilinx have their own simulation libraries,
+especially for FPGA primitives, soft and hard macros. These libraries cannot be
+shipped with GHDL, but GHDL offers prepared compile scripts to pre-compile the
+vendor libraries, if the vendor tool is present on the computer.
+
+There are also popular simulation and verification libraries like [OSVVM][osvvm]
+and [UVVM][uvvm], which can be pre-compile, too.
+
+The compilation scripts are writen in the shell languages: PowerShell for Windows
+and Bash for Linux, MacOS, MSYS2/MinGW. The compile scripts can colorize the GHDL
+warning and error lines with the help of grc/grcat ([generic colourizer][grc]).
+
+ [osvvm]: http://osvvm.org/
+ [uvvm]: https://github.com/UVVM/UVVM_All
+ [grc]: http://kassiopeia.juls.savba.sk/~garabik/software/grc.html
+
+See the [GHDL Documentation](https://ghdl.github.io/ghdl) for a detailed
+documentation on how to use [Precompile Scripts](https://ghdl.github.io/ghdl/getting/PrecompileVendorPrimitives.html)
+
+---------------------------------------------------------------------
+
+## Quick Start
+### Compiling in Bash (e.g. Linux)
+
+ - **Step 1 - Browse to your simulation working directory**
+ ```Bash
+ $ cd <MySimulationFolder>
+ ```
+
+ - **Step 2 - Start the compilation script(s)**
+ Choose one of the provided pre-compilation scripts and run:
+ ```Bash
+ $ /usr/local/lib/ghdl/vendors/compile-osvvm.sh --all --source ../path/to/osvvm
+ ```
+
+ In most cases GHDL is installed into `/usr/local/`. The scripts are
+ installed into the `lib/ghdl/vendors` directory.
+
+ - **Step 3 - Viewing the result**
+ This creates vendor directories in your current working directory and
+ compiles the vendor files into them.
+
+ ```Bash
+ $ ls -ahl
+ ...
+ drwxr-xr-x 2 <user> <group> 56K Nov 30 17:48 osvvm
+ drwxr-xr-x 2 <user> <group> 56K Nov 30 17:58 osvvm_common
+ drwxr-xr-x 2 <user> <group> 56K Nov 30 17:58 osvvm_axi4
+ drwxr-xr-x 2 <user> <group> 56K Nov 30 17:48 osvvm_uart
+ ```
+
+
+---------------------------------------------------------------------
+### Compiling in PowerShell (e.g. Windows)
+
+ - **Step 1 - Browse to your simulation working directory**
+ ```PowerShell
+ PS> cd <MySimulationFolder>
+ ```
+
+ - **Step 2 - Start the compilation script(s)**
+ Choose one of the provided pre-compilation scripts and run:
+ ```PowerShell
+ PS> <GHDL>\lib\ghdl\vendors\compile-osvvm.ps1 -All -Source ..\path\to\osvvm
+ ```
+
+ - **Step 3 - Viewing the result**
+ This creates vendor directories in your current working directory and
+ compiles the vendor files into them.
+
+ ```PowerShell
+ PS> dir
+ Directory: D:\temp\ghdl
+
+ Mode LastWriteTime Length Name
+ ---- ------------- ------ ----
+ d---- 20.11.2019 19:38 <DIR> osvvm
+ d---- 20.11.2019 19:45 <DIR> osvvm_common
+ d---- 20.11.2019 19:06 <DIR> osvvm_axi4
+ d---- 20.11.2019 19:40 <DIR> osvvm_uart
+ ```
+
+---------------------------------------------------------------------
+
+## Usage
+
+*TODO*
+
+
+
+---------------------------------------------------------------------
+
+## Options
+
+Each script has an integrated help. Use `script.sh --help` (Bash) or
+`script.ps1 -Help` (PoSh) to print all options. When setting verbose or debug
+mode, scripts will print more information or all commands executed by
+the script itself.
+
+With `--source` (Bash) or `-Source` (PoSh) the 3rd party libraries VHDL
+directory can be specified. With `-output` (Bash) or `-Output` (PoSh) the
+output directory can be specified. If GHDL is not automatically found, then
+the path to the GHDL executable can be specified with `--ghdl` (Bash) or
+`-GHDL` (PoSh).
+
+For a detailed documentation and all command line options see
+[Precompile Scripts](https://ghdl.github.io/ghdl/getting/PrecompileVendorPrimitives.html)
+
+
+---------------------------------------------------------------------
+
+## TODOs
+
+- OSVVM
+ - switch / search directories if normal OSVVM or OsvvmLibraries is specified as source
+- Missing features
+ - Implement `-Clean` ```--clean` commands
+- describe usage with -P
+- document offered procedures and functions
+- don't enforce `--output` if `--source` is used.
+- UVVM (OSVVM)
+ - create a list of components as array and generate from that:
+ - variables
+ - cli options
+ - help text
+ - default values
+
+------------------------
+Author: Patrick Lehmann
+Last update: 14.01.2020
diff --git a/scripts/vendors/compile-altera.ps1 b/scripts/vendors/compile-altera.ps1
new file mode 100644
index 000000000..76f47b1c4
--- /dev/null
+++ b/scripts/vendors/compile-altera.ps1
@@ -0,0 +1,578 @@
+# ==============================================================================
+# Authors:
+# Patrick Lehmann
+#
+# ==============================================================================
+# Copyright (C) 2017-2021 Patrick Lehmann - Boetzingen, Germany
+# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany
+#
+# This program 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 Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <gnu.org/licenses>.
+# ==============================================================================
+
+# .SYNOPSIS
+# Script to compile the simulation libraries from Altera Quartus for GHDL on Windows.
+#
+# .DESCRIPTION
+# This CmdLet:
+# (1) creates a subdirectory in the current working directory
+# (2) compiles all Altera Quartus simulation libraries and packages
+# o Altera standard libraries: lpm, sgate, altera, altera_mf, altera_lnsim
+# o Altera device libraries:
+# - arriaii, arriaii_pcie_hip, arriaiigz
+# - arriav, arriavgz, arriavgz_pcie_hip
+# - cycloneiv, cycloneiv_pcie_hip, cycloneive
+# - cyclonev
+# - max, maxii, maxv
+# - stratixiv, stratixiv_pcie_hip
+# - stratixv, stratixv_pcie_hip
+# - fiftyfivenm, twentynm
+#
+[CmdletBinding()]
+param(
+ # Show the embedded help page(s)
+ [switch]$Help = $false,
+
+ # Compile all libraries and packages.
+ [switch]$All = $false,
+
+ # Compile the Altera standard libraries: lpm, sgate, altera, altera_mf, altera_lnsim
+ [switch]$Altera = $false,
+
+ # Compile the Altera Max device libraries
+ [switch]$Max = $false,
+
+ # Compile the Altera Cyclone device libraries
+ [switch]$Cyclone = $false,
+
+ # Compile the Altera Arria device libraries
+ [switch]$Arria = $false,
+
+ # Compile the Altera Stratix device libraries
+ [switch]$Stratix = $false,
+
+ # Unknown device library
+ [switch]$Nanometer = $false,
+
+ # Clean up directory before analyzing.
+ [switch]$Clean = $false,
+
+ # Set VHDL Standard to '93.
+ [switch]$VHDL93 = $false,
+ # Set VHDL Standard to '08.
+ [switch]$VHDL2008 = $false,
+
+ # Skip warning messages. (Show errors only.)
+ [switch]$SuppressWarnings = $false,
+ # Halt on errors.
+ [switch]$HaltOnError = $false,
+
+ # Set vendor library source directory.
+ [string]$Source = "",
+ # Set output directory name.
+ [string]$Output = "",
+ # Set GHDL binary directory.
+ [string]$GHDL = ""
+)
+
+# ---------------------------------------------
+# save working directory
+$WorkingDir = Get-Location
+
+# set default values
+$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"]
+$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug
+
+# load modules from GHDL's 'vendors' library directory
+$EnableVerbose -and (Write-Host "Loading modules..." -ForegroundColor Gray ) | Out-Null
+$EnableDebug -and (Write-Host " Import-Module $PSScriptRoot\config.psm1 -Verbose:`$$false -Debug:`$$false -ArgumentList `"AlteraQuartus`"" -ForegroundColor DarkGray ) | Out-Null
+Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -ArgumentList "AlteraQuartus"
+$EnableDebug -and (Write-Host " Import-Module $PSScriptRoot\shared.psm1 -Verbose:`$$false -Debug:`$$false -ArgumentList @(`"Altera Quartus`", `"$WorkingDir`")" -ForegroundColor DarkGray ) | Out-Null
+Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -ArgumentList @("Altera Quartus", "$WorkingDir")
+
+# Display help if no command was selected
+$Help = $Help -or (-not ($All -or $Altera -or $Max -or $Cyclone -or $Arria -or $Stratix -or $Nanometer -or $Clean))
+
+if ($Help)
+{ Get-Help $MYINVOCATION.MyCommand.Path -Detailed
+ Exit-CompileScript
+}
+if ($All)
+{ $Altera = $true
+ $Max = $true
+ $Cyclone = $true
+ $Arria = $true
+ $Stratix = $true
+ $Nanometer = $true
+}
+
+function Get-AlteraQuartusDirectory
+{ if (Test-Path env:QUARTUS_ROOTDIR)
+ { return $QUARTUS_ROOTDIR + "\" + (Get-VendorToolSourceDirectory) }
+ else
+ { $EnvSourceDir = ""
+ foreach ($Drive in Get-PSDrive -PSProvider 'FileSystem')
+ { $Path = $Drive.Name + ":\" + "Altera"
+ if (Test-Path $Path -PathType Container)
+ { foreach ($Major in 16..13)
+ { foreach ($Minor in 3..0)
+ { $Dir = $Path + "\" + $Major + "." + $Minor + "\quartus"
+ if (Test-Path $Dir -PathType Container)
+ { $EnvSourceDir = $Dir + "\" + (Get-VendorToolSourceDirectory)
+ return $EnvSourceDir
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+$SourceDirectory = Get-SourceDirectory $Source (Get-AlteraQuartusDirectory)
+$DestinationDirectory = Get-DestinationDirectory $Output
+$GHDLBinary = Get-GHDLBinary $GHDL
+
+# create "Altera" directory and change to it
+New-DestinationDirectory $DestinationDirectory
+cd $DestinationDirectory
+
+
+$VHDLVersion,$VHDLStandard,$VHDLFlavor = Get-VHDLVariables $VHDL93 $VHDL2008
+
+# define global GHDL Options
+$Analyze_Parameters = @(
+ "-fexplicit",
+ "-frelaxed-rules",
+ "--mb-comments",
+ "-Wbinding"
+)
+if (-not $EnableDebug)
+{ $Analyze_Parameters += @(
+ "-Wno-hide"
+ )
+}
+if (-not ($EnableVerbose -or $EnableDebug))
+{ $Analyze_Parameters += @(
+ "-Wno-library",
+ "-Wno-others",
+ "-Wno-static"
+ )
+}
+$Analyze_Parameters += @(
+ "--ieee=$VHDLFlavor",
+ "--no-vital-checks",
+ "--std=$VHDLStandard",
+ "-P$DestinationDirectory"
+)
+
+# extract data from configuration
+# $SourceDir = $InstallationDirectory["AlteraQuartus"] + "\quartus\eda\sim_lib"
+
+$StopCompiling = $false
+$ErrorCount = 0
+
+# Cleanup directories
+# ==============================================================================
+if ($Clean)
+{ Write-Host "[ERROR]: '-Clean' is not implemented!" -ForegroundColor Red
+ Exit-CompileScript -1
+
+ Write-Host "Cleaning up vendor directory ..." -ForegroundColor Yellow
+ rm *.cf
+}
+
+
+# Altera standard libraries
+# ==============================================================================
+# compile lpm library
+if ((-not $StopCompiling) -and $Altera)
+{ $Library = "lpm"
+ $Files = @(
+ "220pack.vhd",
+ "220model.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# compile sgate library
+if ((-not $StopCompiling) -and $Altera)
+{ $Library = "sgate"
+ $Files = @(
+ "sgate_pack.vhd",
+ "sgate.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# compile altera library
+if ((-not $StopCompiling) -and $Altera)
+{ $Library = "altera"
+ $Files = @(
+ "altera_europa_support_lib.vhd",
+ "altera_primitives_components.vhd",
+ "altera_primitives.vhd",
+ "altera_standard_functions.vhd",
+ "altera_syn_attributes.vhd",
+ "alt_dspbuilder_package.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# compile altera_mf library
+if ((-not $StopCompiling) -and $Altera)
+{ $Library = "altera_mf"
+ $Files = @(
+ "altera_mf_components.vhd",
+ "altera_mf.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# compile altera_lnsim library
+if ((-not $StopCompiling) -and $Altera)
+{ $Library = "altera_lnsim"
+ $Files = @(
+ "altera_lnsim_components.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Altera device libraries
+# ==============================================================================
+# compile max library
+if ((-not $StopCompiling) -and $Max)
+{ $Library = "max"
+ $Files = @(
+ "max_atoms.vhd",
+ "max_components.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile maxii library
+if ((-not $StopCompiling) -and $Max)
+{ $Library = "maxii"
+ $Files = @(
+ "maxii_atoms.vhd",
+ "maxii_components.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile maxv library
+if ((-not $StopCompiling) -and $Max)
+{ $Library = "maxv"
+ $Files = @(
+ "maxv_atoms.vhd",
+ "maxv_components.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile arriaii library
+if ((-not $StopCompiling) -and $Arria)
+{ $Library = "arriaii"
+ $Files = @(
+ "arriaii_atoms.vhd",
+ "arriaii_components.vhd",
+ "arriaii_hssi_components.vhd",
+ "arriaii_hssi_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile arriaii_pcie_hip library
+if ((-not $StopCompiling) -and $Arria)
+{ $Library = "arriaii_pcie_hip"
+ $Files = @(
+ "arriaii_pcie_hip_components.vhd",
+ "arriaii_pcie_hip_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile arriaiigz library
+if ((-not $StopCompiling) -and $Arria)
+{ $Library = "arriaiigz"
+ $Files = @(
+ "arriaiigz_atoms.vhd",
+ "arriaiigz_components.vhd",
+ "arriaiigz_hssi_components.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile arriav library
+if ((-not $StopCompiling) -and $Arria)
+{ $Library = "arriav"
+ $Files = @(
+ "arriav_atoms.vhd",
+ "arriav_components.vhd",
+ "arriav_hssi_components.vhd",
+ "arriav_hssi_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile arriavgz library
+if ((-not $StopCompiling) -and $Arria)
+{ $Library = "arriavgz"
+ $Files = @(
+ "arriavgz_atoms.vhd",
+ "arriavgz_components.vhd",
+ "arriavgz_hssi_components.vhd",
+ "arriavgz_hssi_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile arriavgz_pcie_hip library
+if ((-not $StopCompiling) -and $Arria)
+{ $Library = "arriavgz_pcie_hip"
+ $Files = @(
+ "arriavgz_pcie_hip_components.vhd",
+ "arriavgz_pcie_hip_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile cycloneiv library
+if ((-not $StopCompiling) -and $Cyclone)
+{ $Library = "cycloneiv"
+ $Files = @(
+ "cycloneiv_atoms.vhd",
+ "cycloneiv_components.vhd",
+ "cycloneiv_hssi_components.vhd",
+ "cycloneiv_hssi_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile cycloneiv_pcie_hip library
+if ((-not $StopCompiling) -and $Cyclone)
+{ $Library = "cycloneiv_pcie_hip"
+ $Files = @(
+ "cycloneiv_pcie_hip_components.vhd",
+ "cycloneiv_pcie_hip_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile cycloneive library
+if ((-not $StopCompiling) -and $Cyclone)
+{ $Library = "cycloneive"
+ $Files = @(
+ "cycloneive_atoms.vhd",
+ "cycloneive_components.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile cyclonev library
+if ((-not $StopCompiling) -and $Cyclone)
+{ $Library = "cyclonev"
+ $Files = @(
+ "cyclonev_atoms.vhd",
+ "cyclonev_components.vhd",
+ "cyclonev_hssi_components.vhd",
+ "cyclonev_hssi_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile stratixiv library
+if ((-not $StopCompiling) -and $Stratix)
+{ $Library = "stratixiv"
+ $Files = @(
+ "stratixiv_atoms.vhd",
+ "stratixiv_components.vhd",
+ "stratixiv_hssi_components.vhd",
+ "stratixiv_hssi_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile stratixiv_pcie_hip library
+if ((-not $StopCompiling) -and $Stratix)
+{ $Library = "stratixiv_pcie_hip"
+ $Files = @(
+ "stratixiv_pcie_hip_components.vhd",
+ "stratixiv_pcie_hip_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile stratixv library
+if ((-not $StopCompiling) -and $Stratix)
+{ $Library = "stratixv"
+ $Files = @(
+ "stratixv_atoms.vhd",
+ "stratixv_components.vhd",
+ "stratixv_hssi_components.vhd",
+ "stratixv_hssi_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile stratixv_pcie_hip library
+if ((-not $StopCompiling) -and $Stratix)
+{ $Library = "stratixv_pcie_hip"
+ $Files = @(
+ "stratixv_pcie_hip_components.vhd",
+ "stratixv_pcie_hip_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile fiftyfivenm library
+if ((-not $StopCompiling) -and $Nanometer)
+{ $Library = "fiftyfivenm"
+ $Files = @(
+ "fiftyfivenm_atoms.vhd",
+ "fiftyfivenm_components.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile twentynm library
+if ((-not $StopCompiling) -and $Nanometer)
+{ $Library = "twentynm"
+ $Files = @(
+ "twentynm_atoms.vhd",
+ "twentynm_components.vhd",
+ "twentynm_hip_components.vhd",
+ "twentynm_hip_atoms.vhd",
+ "twentynm_hssi_components.vhd",
+ "twentynm_hssi_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+Write-Host "--------------------------------------------------------------------------------"
+Write-Host "Compiling Altera libraries " -NoNewline
+if ($ErrorCount -gt 0)
+{ Write-Host "[FAILED]" -ForegroundColor Red }
+else
+{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green }
+
+Exit-CompileScript
diff --git a/scripts/vendors/compile-altera.sh b/scripts/vendors/compile-altera.sh
new file mode 100755
index 000000000..73aaeb164
--- /dev/null
+++ b/scripts/vendors/compile-altera.sh
@@ -0,0 +1,708 @@
+#! /usr/bin/env bash
+# ==============================================================================
+# Authors:
+# Patrick Lehmann
+#
+# Bash Script (executable):
+# Script to compile the simulation libraries from Altera Quartus for GHDL on
+# Linux
+#
+# Description:
+# - Creates a subdirectory in the current working directory
+# - Compiles all Altera Quartus-II simulation libraries and packages
+#
+# ==============================================================================
+# Copyright (C) 2017-2021 Patrick Lehmann - Boetzingen, Germany
+# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany
+#
+# This program 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 Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <gnu.org/licenses>.
+# ==============================================================================
+
+# Work around for Darwin (Mac OS)
+test greadlink --version > /dev/null 2>&1 && READLINK=greadlink || READLINK=readlink
+
+# Save working directory
+WorkingDir=$(pwd)
+ScriptDir="$(dirname $0)"
+ScriptDir="$($READLINK -f $ScriptDir)"
+
+# 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
+COMMAND=1
+CLEAN=0
+COMPILE_ALTERA=0
+COMPILE_MAX=0
+COMPILE_CYCLONE=0
+COMPILE_ARRIA=0
+COMPILE_STRATIX=0
+COMPILE_NM=0
+VERBOSE=0
+DEBUG=0
+FILTERING=1
+SKIP_LARGE_FILES=0
+SUPPRESS_WARNINGS=0
+HALT_ON_ERROR=0
+VHDLStandard=93
+DestDir=""
+SrcDir=""
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ -c|--clean)
+ COMMAND=3
+ CLEAN=1
+ ;;
+ -a|--all)
+ COMMAND=2
+ ;;
+ --altera)
+ COMMAND=3
+ COMPILE_ALTERA=1
+ ;;
+ --max)
+ COMMAND=3
+ COMPILE_MAX=1
+ ;;
+ --cyclone)
+ COMMAND=3
+ COMPILE_CYCLONE=1
+ ;;
+ --arria)
+ COMMAND=3
+ COMPILE_ARRIA=1
+ ;;
+ --stratix)
+ COMMAND=3
+ COMPILE_STRATIX=1
+ ;;
+ --nanometer)
+ COMMAND=3
+ COMPILE_NM=1
+ ;;
+ -S|--skip-largefiles)
+ SKIP_LARGE_FILES=1
+ ;;
+ --vhdl93)
+ VHDLStandard=93
+ ;;
+ --vhdl2008)
+ VHDLStandard=2008
+ ;;
+ -v|--verbose)
+ VERBOSE=1
+ ;;
+ -d|--debug)
+ VERBOSE=1
+ DEBUG=1
+ ;;
+ -h|--help)
+ COMMAND=0
+ break
+ ;;
+ -n|--no-filter)
+ FILTERING=0
+ ;;
+ -N|--no-warnings)
+ SUPPRESS_WARNINGS=1
+ ;;
+ -H|--halt-on-error)
+ HALT_ON_ERROR=1
+ ;;
+ --ghdl)
+ 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 "\n${COLORED_ERROR} Unknown command line option '$1'.${ANSI_NOCOLOR}"
+ COMMAND=0
+ break
+ ;;
+ esac
+ shift # parsed argument or value
+done
+
+ERRORCOUNT=0
+Libraries=()
+
+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 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 " Use the adv. options or edit 'config.sh' to supply paths and default params."
+ echo ""
+ echo "Usage:"
+ echo " compile-altera.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 ""
+ 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 ""
+ echo "Library compile options:"
+ echo " --vhdl93 Compile the libraries with VHDL-93."
+ echo " --vhdl2008 Compile the libraries with VHDL-2008."
+ 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 binary> Path to GHDL's executable, e.g. /usr/local/bin/ghdl"
+ echo " --output <dir name> Name of the output directory, e.g. altera"
+ echo " --source <Path to Quartus>Path to the sources."
+ echo ""
+ echo "Verbosity:"
+ 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 $COMMAND
+fi
+
+if [[ $COMMAND -eq 2 ]]; then
+ COMPILE_ALTERA=1
+ COMPILE_MAX=1
+ COMPILE_CYCLONE=1
+ COMPILE_ARRIA=1
+ COMPILE_STRATIX=1
+ COMPILE_NM=1
+fi
+
+
+# Source configuration file from GHDL's 'vendors' library directory
+echo -e "${ANSI_MAGENTA}Loading environment...${ANSI_NOCOLOR}"
+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
+
+# Warn that some files might not be VHDL-2008 ready. Thus enabled continue on error.
+if [[ $VHDLStandard -eq 2008 ]]; then
+ echo -e "${ANSI_RED}Not all Altera packages are VHDL-2008 compatible! Setting CONTINUE_ON_ERROR to TRUE.${ANSI_NOCOLOR}"
+ CONTINUE_ON_ERROR=1
+fi
+
+# Search Altera Quartus in default installation locations
+DefaultDirectories=("/opt/Altera" "/opt/altera" "/c/Altera")
+if [ ! -z $QUARTUS_ROOTDIR ]; then
+ EnvSourceDir="$QUARTUS_ROOTDIR/${Altera_Quartus_Settings[SourceDirectory]}"
+else
+ for DefaultDir in "${DefaultDirectories[@]}"; do
+ for Major in 16 15 14 13; do
+ for Minor in 1 0; do
+ Dir=$DefaultDir/${Major}.${Minor}/quartus
+ if [ -d $Dir ]; then
+ EnvSourceDir="$Dir/${Altera_Quartus_Settings[SourceDirectory]}"
+ break 3
+ fi
+ done
+ done
+ done
+fi
+
+
+# <= $VHDLVersion
+# <= $VHDLStandard
+# <= $VHDLFlavor
+GHDLSetup $VHDLStandard
+
+# -> $SourceDirectories
+# -> $DestinationDirectories
+# -> $SrcDir
+# -> $DestDir
+# <= $SourceDirectory
+# <= $DestinationDirectory
+SetupDirectories Altera_Quartus "Altera Quartus"
+
+# create "osvvm" directory and change to it
+# => $DestinationDirectory
+CreateDestinationDirectory
+cd $DestinationDirectory
+
+
+# Extend global GHDL Options TODO: move to GHDLSetup
+Analyze_Parameters+=(
+ -fexplicit
+ -Wbinding
+)
+if [[ $DEBUG -eq 0 ]]; then
+ Analyze_Parameters+=(
+ -Wno-hide
+ )
+fi
+if [[ ! (VERBOSE -eq 1) && ($DEBUG -eq 1) ]]; then
+ Analyze_Parameters+=(
+ -Wno-others
+ -Wno-static
+ )
+fi
+Analyze_Parameters+=(
+ --ieee=$VHDLFlavor
+ --no-vital-checks
+ --std=$VHDLStandard
+ -frelaxed
+ -P$DestinationDirectory
+)
+
+
+# Cleanup directories
+# ==============================================================================
+if [[ $CLEAN -eq 1 ]]; then
+ echo 1>&2 -e "${COLORED_ERROR} '--clean' is not implemented!"
+ exit 1
+ echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_NOCOLOR}"
+ rm *.o 2> /dev/null
+ rm *.cf 2> /dev/null
+fi
+
+
+# Altera standard libraries
+# ==============================================================================
+StructName="LPM"
+Files=(
+ 220pack.vhd
+ 220model.vhd
+)
+CreateLibraryStruct $StructName "lpm" "." $VHDLVersion "${Files[@]}"
+test $COMPILE_ALTERA -eq 1 && Libraries+=("$StructName")
+
+StructName="SGATE"
+Files=(
+ sgate_pack.vhd
+ sgate.vhd
+)
+CreateLibraryStruct $StructName "sgate" "." $VHDLVersion "${Files[@]}"
+test $COMPILE_ALTERA -eq 1 && Libraries+=("$StructName")
+
+StructName="ALTERA"
+Files=(
+ altera_europa_support_lib.vhd
+ altera_primitives_components.vhd
+ altera_primitives.vhd
+ altera_standard_functions.vhd
+ altera_syn_attributes.vhd
+ alt_dspbuilder_package.vhd
+)
+CreateLibraryStruct $StructName "altera" "." $VHDLVersion "${Files[@]}"
+test $COMPILE_ALTERA -eq 1 && Libraries+=("$StructName")
+
+StructName="ALTERA_MF"
+Files=(
+ altera_mf_components.vhd
+ altera_mf.vhd
+)
+CreateLibraryStruct $StructName "altera_mf" "." $VHDLVersion "${Files[@]}"
+test $COMPILE_ALTERA -eq 1 && Libraries+=("$StructName")
+
+
+StructName="ALTERA_LNSIM"
+Files=(
+ altera_lnsim_components.vhd
+)
+CreateLibraryStruct $StructName "altera_lnsim" "." $VHDLVersion "${Files[@]}"
+test $COMPILE_ALTERA -eq 1 && Libraries+=("$StructName")
+
+
+# Altera device libraries
+# ==============================================================================
+test $VERBOSE -eq 1 && echo -e " Searching available devices ..."
+
+# Max library
+StructName="MAX"
+Files=(
+ max_atoms.vhd
+ max_components.vhd
+)
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Max'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "max" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_MAX -eq 1 && Libraries+=("$StructName")
+fi
+
+# Max II library
+StructName="MAX_II"
+Files=(
+ maxii_atoms.vhd
+ maxii_components.vhd
+)
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Max II'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "maxii" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_MAX -eq 1 && Libraries+=("$StructName")
+fi
+
+# Max V library
+StructName="MAX_V"
+Files=(
+ maxv_atoms.vhd
+ maxv_components.vhd
+)
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Max V'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "maxv" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_MAX -eq 1 && Libraries+=("$StructName")
+fi
+
+# Arria II library
+StructName="ARRIA_II"
+Files=(
+ arriaii_atoms.vhd
+ arriaii_components.vhd
+)
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ Files+=(
+ arriaii_hssi_components.vhd
+ arriaii_hssi_atoms.vhd
+ )
+fi
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Arria II'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "arriaii" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_ARRIA -eq 1 && Libraries+=("$StructName")
+fi
+
+# Arria II (PCIe) library
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ StructName="ARRIA_II_PCIe"
+ Files=(
+ arriaii_pcie_hip_components.vhd
+ arriaii_pcie_hip_atoms.vhd
+ )
+ if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Arria II (PCIe)'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "arriaii_pcie_hip" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_ARRIA -eq 1 && Libraries+=("$StructName")
+ fi
+fi
+
+# ArriaII GZ library
+StructName="ARRIA_II_GZ"
+Files=(
+ arriaiigz_atoms.vhd
+ arriaiigz_components.vhd
+)
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ Files+=(
+ arriaiigz_hssi_components.vhd
+ )
+fi
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Arria II GZ'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "arriaiigz" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_ARRIA -eq 1 && Libraries+=("$StructName")
+fi
+
+# ArriaV library
+StructName="ARRIA_V"
+Files=(
+ arriav_atoms.vhd
+ arriav_components.vhd
+)
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ Files+=(
+ arriav_hssi_components.vhd
+ arriav_hssi_atoms.vhd
+ )
+fi
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Arria V'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "arriav" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_ARRIA -eq 1 && Libraries+=("$StructName")
+fi
+
+# Arria V GZ library
+StructName="ARRIA_V_GZ"
+Files=(
+ arriavgz_atoms.vhd
+ arriavgz_components.vhd
+)
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ Files+=(
+ arriavgz_hssi_components.vhd
+ arriavgz_hssi_atoms.vhd
+ )
+fi
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Arria V GZ'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "arriavgz" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_ARRIA -eq 1 && Libraries+=("$StructName")
+fi
+
+# Arria V GZ (PCIe) library
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ StructName="ARRIA_V_GZ_PCIe"
+ Files=(
+ arriavgz_pcie_hip_components.vhd
+ arriavgz_pcie_hip_atoms.vhd
+ )
+ if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Arria V GZ (PCIe)'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "arriavgz_pcie_hip" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_ARRIA -eq 1 && Libraries+=("$StructName")
+ fi
+fi
+
+# Cyclone library
+StructName="CYCLONE"
+Files=(
+ cyclone_atoms.vhd
+ cyclone_components.vhd
+)
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Cyclone'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "cyclone" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_CYCLONE -eq 1 && Libraries+=("$StructName")
+fi
+
+# Cyclone II library
+StructName="CYCLONE_II"
+Files=(
+ cycloneii_atoms.vhd
+ cycloneii_components.vhd
+)
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Cyclone II'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "cycloneii" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_CYCLONE -eq 1 && Libraries+=("$StructName")
+fi
+
+# Cyclone III library
+StructName="CYCLONE_III"
+Files=(
+ cycloneiii_atoms.vhd
+ cycloneiii_components.vhd
+)
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Cyclone III'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "cycloneiii" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_CYCLONE -eq 1 && Libraries+=("$StructName")
+fi
+
+# Cyclone IV library
+StructName="CYCLONE_IV"
+Files=(
+ cycloneiv_atoms.vhd
+ cycloneiv_components.vhd
+)
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ Files+=(
+ cycloneiv_hssi_components.vhd
+ cycloneiv_hssi_atoms.vhd
+ )
+fi
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Cyclone IV'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "cycloneiv" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_CYCLONE -eq 1 && Libraries+=("$StructName")
+fi
+
+# Cyclone IV (PCIe) library
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ StructName="CYCLONE_IV_PCIe"
+ Files=(
+ cycloneiv_pcie_hip_components.vhd
+ cycloneiv_pcie_hip_atoms.vhd
+ )
+ if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Cyclone IV (PCIe)'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "cycloneiv_pcie_hip" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_CYCLONE -eq 1 && Libraries+=("$StructName")
+ fi
+fi
+
+# Cyclone IV E library
+StructName="CYCLONE_IV_E"
+Files=(
+ cycloneive_atoms.vhd
+ cycloneive_components.vhd
+)
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Cyclone IV E'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "cycloneive" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_CYCLONE -eq 1 && Libraries+=("$StructName")
+fi
+
+# Cyclone V library
+StructName="CYCLONE_V"
+Files=(
+ cyclonev_atoms.vhd
+ cyclonev_components.vhd
+)
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ Files+=(
+ cyclonev_hssi_components.vhd
+ cyclonev_hssi_atoms.vhd
+ )
+fi
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Cyclone V'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "cyclonev" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_CYCLONE -eq 1 && Libraries+=("$StructName")
+fi
+
+# Stratix IV library
+StructName="STRATIX_IV"
+Files=(
+ stratixiv_atoms.vhd
+ stratixiv_components.vhd
+)
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ Files+=(
+ stratixiv_hssi_components.vhd
+ stratixiv_hssi_atoms.vhd
+ )
+fi
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Stratix IV'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "stratixiv" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_STRATIX -eq 1 && Libraries+=("$StructName")
+fi
+
+# Stratix IV (PCIe) library
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ StructName="STRATIX_IV_PCIe"
+ Files=(
+ stratixiv_pcie_hip_components.vhd
+ stratixiv_pcie_hip_atoms.vhd
+ )
+ if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Stratix IV (PCIe)'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "stratixiv_pcie_hip" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_STRATIX -eq 1 && Libraries+=("$StructName")
+ fi
+fi
+
+# Stratix V library
+StructName="STRATIX_V"
+Files=(
+ stratixv_atoms.vhd
+ stratixv_components.vhd
+)
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ Files+=(
+ stratixv_hssi_components.vhd
+ stratixv_hssi_atoms.vhd
+ )
+fi
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Stratix V'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "stratixv" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_STRATIX -eq 1 && Libraries+=("$StructName")
+fi
+
+# Stratix V (PCIe) library
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ StructName="STRATIX_V_PCIe"
+ Files=(
+ stratixv_pcie_hip_components.vhd
+ stratixv_pcie_hip_atoms.vhd
+ )
+ if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Stratix V (PCIe)'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "stratixv_pcie_hip" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_STRATIX -eq 1 && Libraries+=("$StructName")
+ fi
+fi
+
+# 55 nm library
+StructName="NM_55"
+Files=(
+ fiftyfivenm_atoms.vhd
+ fiftyfivenm_components.vhd
+)
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device '55 nm'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "fiftyfivenm" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_NM -eq 1 && Libraries+=("$StructName")
+fi
+
+# 20 nm library
+StructName="NM_20"
+Files=(
+ 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
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device '20 nm'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "twentynm" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_NM -eq 1 && Libraries+=("$StructName")
+fi
+
+# if [[ $DEBUG -eq 1 ]]; then
+ # for StructName in ${Libraries[*]}; do
+ # PrintLibraryStruct $StructName " "
+ # done
+# fi
+
+# Compile libraries
+if [[ ${#Libraries[@]} -ne 0 ]]; then
+ Compile "$SourceDirectory" "${Libraries[*]}"
+
+ echo "--------------------------------------------------------------------------------"
+ echo -e "Compiling Altera Quartus packages and device libraries $(test $ERRORCOUNT -eq 0 && echo $COLORED_SUCCESSFUL || echo $COLORED_FAILED)"
+else
+ echo -e "${ANSI_RED}Neither Altera Quartus packages nor device libraries selected.${ANSI_NOCOLOR}"
+fi
diff --git a/scripts/vendors/compile-intel.ps1 b/scripts/vendors/compile-intel.ps1
new file mode 100644
index 000000000..e554f292d
--- /dev/null
+++ b/scripts/vendors/compile-intel.ps1
@@ -0,0 +1,578 @@
+# ==============================================================================
+# Authors:
+# Patrick Lehmann
+#
+# ==============================================================================
+# Copyright (C) 2017-2021 Patrick Lehmann - Boetzingen, Germany
+# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany
+#
+# This program 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 Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <gnu.org/licenses>.
+# ==============================================================================
+
+# .SYNOPSIS
+# Script to compile the simulation libraries from Intel Quartus for GHDL on Windows.
+#
+# .DESCRIPTION
+# This CmdLet:
+# (1) creates a subdirectory in the current working directory
+# (2) compiles all Altera Quartus simulation libraries and packages
+# o Altera standard libraries: lpm, sgate, altera, altera_mf, altera_lnsim
+# o Altera device libraries:
+# - arriaii, arriaii_pcie_hip, arriaiigz
+# - arriav, arriavgz, arriavgz_pcie_hip
+# - cycloneiv, cycloneiv_pcie_hip, cycloneive
+# - cyclonev
+# - max, maxii, maxv
+# - stratixiv, stratixiv_pcie_hip
+# - stratixv, stratixv_pcie_hip
+# - fiftyfivenm, twentynm
+#
+[CmdletBinding()]
+param(
+ # Show the embedded help page(s)
+ [switch]$Help = $false,
+
+ # Compile all libraries and packages.
+ [switch]$All = $false,
+
+ # Compile the Altera standard libraries: lpm, sgate, altera, altera_mf, altera_lnsim
+ [switch]$Altera = $false,
+
+ # Compile the Altera Max device libraries
+ [switch]$Max = $false,
+
+ # Compile the Altera Cyclone device libraries
+ [switch]$Cyclone = $false,
+
+ # Compile the Altera Arria device libraries
+ [switch]$Arria = $false,
+
+ # Compile the Altera Stratix device libraries
+ [switch]$Stratix = $false,
+
+ # Unknown device library
+ [switch]$Nanometer = $false,
+
+ # Clean up directory before analyzing.
+ [switch]$Clean = $false,
+
+ # Set VHDL Standard to '93.
+ [switch]$VHDL93 = $false,
+ # Set VHDL Standard to '08.
+ [switch]$VHDL2008 = $false,
+
+ # Skip warning messages. (Show errors only.)
+ [switch]$SuppressWarnings = $false,
+ # Halt on errors.
+ [switch]$HaltOnError = $false,
+
+ # Set vendor library source directory.
+ [string]$Source = "",
+ # Set output directory name.
+ [string]$Output = "",
+ # Set GHDL binary directory.
+ [string]$GHDL = ""
+)
+
+# ---------------------------------------------
+# save working directory
+$WorkingDir = Get-Location
+
+# set default values
+$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"]
+$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug
+
+# load modules from GHDL's 'vendors' library directory
+$EnableVerbose -and (Write-Host "Loading modules..." -ForegroundColor Gray ) | Out-Null
+$EnableDebug -and (Write-Host " Import-Module $PSScriptRoot\config.psm1 -Verbose:`$$false -Debug:`$$false -ArgumentList `"IntelQuartus`"" -ForegroundColor DarkGray ) | Out-Null
+Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -Debug:$false -ArgumentList "IntelQuartus"
+$EnableDebug -and (Write-Host " Import-Module $PSScriptRoot\shared.psm1 -Verbose:`$$false -Debug:`$$false -ArgumentList @(`"Intel Quartus Prime`", `"$WorkingDir`")" -ForegroundColor DarkGray ) | Out-Null
+Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -Debug:$false -ArgumentList @("Intel Quartus Prime", "$WorkingDir")
+
+# Display help if no command was selected
+$Help = $Help -or (-not ($All -or $Altera -or $Max -or $Cyclone -or $Arria -or $Stratix -or $Nanometer -or $Clean))
+
+if ($Help)
+{ Get-Help $MYINVOCATION.MyCommand.Path -Detailed
+ Exit-CompileScript
+}
+if ($All)
+{ $Altera = $true
+ $Max = $true
+ $Cyclone = $true
+ $Arria = $true
+ $Stratix = $true
+ $Nanometer = $true
+}
+
+function Get-AlteraQuartusDirectory
+{ if (Test-Path env:QUARTUS_ROOTDIR)
+ { return $QUARTUS_ROOTDIR + "\" + (Get-VendorToolSourceDirectory) }
+ else
+ { $EnvSourceDir = ""
+ foreach ($Drive in Get-PSDrive -PSProvider 'FileSystem')
+ { $Path = $Drive.Name + ":\" + "Altera"
+ if (Test-Path $Path -PathType Container)
+ { foreach ($Major in 21..13)
+ { foreach ($Minor in 5..0)
+ { $Dir = $Path + "\" + $Major + "." + $Minor + "\quartus"
+ if (Test-Path $Dir -PathType Container)
+ { $EnvSourceDir = $Dir + "\" + (Get-VendorToolSourceDirectory)
+ return $EnvSourceDir
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+$SourceDirectory = Get-SourceDirectory $Source (Get-AlteraQuartusDirectory)
+$DestinationDirectory = Get-DestinationDirectory $Output
+$GHDLBinary = Get-GHDLBinary $GHDL
+
+# create "Altera" directory and change to it
+New-DestinationDirectory $DestinationDirectory
+cd $DestinationDirectory
+
+
+$VHDLVersion,$VHDLStandard,$VHDLFlavor = Get-VHDLVariables $VHDL93 $VHDL2008
+
+# define global GHDL Options
+$Analyze_Parameters = @(
+ "-fexplicit",
+ "-frelaxed-rules",
+ "--mb-comments",
+ "-Wbinding"
+)
+if (-not $EnableDebug)
+{ $Analyze_Parameters += @(
+ "-Wno-hide"
+ )
+}
+if (-not ($EnableVerbose -or $EnableDebug))
+{ $Analyze_Parameters += @(
+ "-Wno-library",
+ "-Wno-others",
+ "-Wno-static"
+ )
+}
+$Analyze_Parameters += @(
+ "--ieee=$VHDLFlavor",
+ "--no-vital-checks",
+ "--std=$VHDLStandard",
+ "-P$DestinationDirectory"
+)
+
+# extract data from configuration
+# $SourceDir = $InstallationDirectory["AlteraQuartus"] + "\quartus\eda\sim_lib"
+
+$StopCompiling = $false
+$ErrorCount = 0
+
+# Cleanup directories
+# ==============================================================================
+if ($Clean)
+{ Write-Host "[ERROR]: '-Clean' is not implemented!" -ForegroundColor Red
+ Exit-CompileScript -1
+
+ Write-Host "Cleaning up vendor directory ..." -ForegroundColor Yellow
+ rm *.cf
+}
+
+
+# Altera standard libraries
+# ==============================================================================
+# compile lpm library
+if ((-not $StopCompiling) -and $Altera)
+{ $Library = "lpm"
+ $Files = @(
+ "220pack.vhd",
+ "220model.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# compile sgate library
+if ((-not $StopCompiling) -and $Altera)
+{ $Library = "sgate"
+ $Files = @(
+ "sgate_pack.vhd",
+ "sgate.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# compile altera library
+if ((-not $StopCompiling) -and $Altera)
+{ $Library = "altera"
+ $Files = @(
+ "altera_europa_support_lib.vhd",
+ "altera_primitives_components.vhd",
+ "altera_primitives.vhd",
+ "altera_standard_functions.vhd",
+ "altera_syn_attributes.vhd",
+ "alt_dspbuilder_package.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# compile altera_mf library
+if ((-not $StopCompiling) -and $Altera)
+{ $Library = "altera_mf"
+ $Files = @(
+ "altera_mf_components.vhd",
+ "altera_mf.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# compile altera_lnsim library
+if ((-not $StopCompiling) -and $Altera)
+{ $Library = "altera_lnsim"
+ $Files = @(
+ "altera_lnsim_components.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Altera device libraries
+# ==============================================================================
+# compile max library
+if ((-not $StopCompiling) -and $Max)
+{ $Library = "max"
+ $Files = @(
+ "max_atoms.vhd",
+ "max_components.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile maxii library
+if ((-not $StopCompiling) -and $Max)
+{ $Library = "maxii"
+ $Files = @(
+ "maxii_atoms.vhd",
+ "maxii_components.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile maxv library
+if ((-not $StopCompiling) -and $Max)
+{ $Library = "maxv"
+ $Files = @(
+ "maxv_atoms.vhd",
+ "maxv_components.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile arriaii library
+if ((-not $StopCompiling) -and $Arria)
+{ $Library = "arriaii"
+ $Files = @(
+ "arriaii_atoms.vhd",
+ "arriaii_components.vhd",
+ "arriaii_hssi_components.vhd",
+ "arriaii_hssi_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile arriaii_pcie_hip library
+if ((-not $StopCompiling) -and $Arria)
+{ $Library = "arriaii_pcie_hip"
+ $Files = @(
+ "arriaii_pcie_hip_components.vhd",
+ "arriaii_pcie_hip_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile arriaiigz library
+if ((-not $StopCompiling) -and $Arria)
+{ $Library = "arriaiigz"
+ $Files = @(
+ "arriaiigz_atoms.vhd",
+ "arriaiigz_components.vhd",
+ "arriaiigz_hssi_components.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile arriav library
+if ((-not $StopCompiling) -and $Arria)
+{ $Library = "arriav"
+ $Files = @(
+ "arriav_atoms.vhd",
+ "arriav_components.vhd",
+ "arriav_hssi_components.vhd",
+ "arriav_hssi_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile arriavgz library
+if ((-not $StopCompiling) -and $Arria)
+{ $Library = "arriavgz"
+ $Files = @(
+ "arriavgz_atoms.vhd",
+ "arriavgz_components.vhd",
+ "arriavgz_hssi_components.vhd",
+ "arriavgz_hssi_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile arriavgz_pcie_hip library
+if ((-not $StopCompiling) -and $Arria)
+{ $Library = "arriavgz_pcie_hip"
+ $Files = @(
+ "arriavgz_pcie_hip_components.vhd",
+ "arriavgz_pcie_hip_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile cycloneiv library
+if ((-not $StopCompiling) -and $Cyclone)
+{ $Library = "cycloneiv"
+ $Files = @(
+ "cycloneiv_atoms.vhd",
+ "cycloneiv_components.vhd",
+ "cycloneiv_hssi_components.vhd",
+ "cycloneiv_hssi_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile cycloneiv_pcie_hip library
+if ((-not $StopCompiling) -and $Cyclone)
+{ $Library = "cycloneiv_pcie_hip"
+ $Files = @(
+ "cycloneiv_pcie_hip_components.vhd",
+ "cycloneiv_pcie_hip_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile cycloneive library
+if ((-not $StopCompiling) -and $Cyclone)
+{ $Library = "cycloneive"
+ $Files = @(
+ "cycloneive_atoms.vhd",
+ "cycloneive_components.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile cyclonev library
+if ((-not $StopCompiling) -and $Cyclone)
+{ $Library = "cyclonev"
+ $Files = @(
+ "cyclonev_atoms.vhd",
+ "cyclonev_components.vhd",
+ "cyclonev_hssi_components.vhd",
+ "cyclonev_hssi_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile stratixiv library
+if ((-not $StopCompiling) -and $Stratix)
+{ $Library = "stratixiv"
+ $Files = @(
+ "stratixiv_atoms.vhd",
+ "stratixiv_components.vhd",
+ "stratixiv_hssi_components.vhd",
+ "stratixiv_hssi_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile stratixiv_pcie_hip library
+if ((-not $StopCompiling) -and $Stratix)
+{ $Library = "stratixiv_pcie_hip"
+ $Files = @(
+ "stratixiv_pcie_hip_components.vhd",
+ "stratixiv_pcie_hip_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile stratixv library
+if ((-not $StopCompiling) -and $Stratix)
+{ $Library = "stratixv"
+ $Files = @(
+ "stratixv_atoms.vhd",
+ "stratixv_components.vhd",
+ "stratixv_hssi_components.vhd",
+ "stratixv_hssi_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile stratixv_pcie_hip library
+if ((-not $StopCompiling) -and $Stratix)
+{ $Library = "stratixv_pcie_hip"
+ $Files = @(
+ "stratixv_pcie_hip_components.vhd",
+ "stratixv_pcie_hip_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile fiftyfivenm library
+if ((-not $StopCompiling) -and $Nanometer)
+{ $Library = "fiftyfivenm"
+ $Files = @(
+ "fiftyfivenm_atoms.vhd",
+ "fiftyfivenm_components.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+# compile twentynm library
+if ((-not $StopCompiling) -and $Nanometer)
+{ $Library = "twentynm"
+ $Files = @(
+ "twentynm_atoms.vhd",
+ "twentynm_components.vhd",
+ "twentynm_hip_components.vhd",
+ "twentynm_hip_atoms.vhd",
+ "twentynm_hssi_components.vhd",
+ "twentynm_hssi_atoms.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ if (Test-Path $SourceFiles[0])
+ { $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+Write-Host "--------------------------------------------------------------------------------"
+Write-Host "Compiling Altera libraries " -NoNewline
+if ($ErrorCount -gt 0)
+{ Write-Host "[FAILED]" -ForegroundColor Red }
+else
+{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green }
+
+Exit-CompileScript
diff --git a/scripts/vendors/compile-intel.sh b/scripts/vendors/compile-intel.sh
new file mode 100755
index 000000000..79686f8b5
--- /dev/null
+++ b/scripts/vendors/compile-intel.sh
@@ -0,0 +1,666 @@
+#! /usr/bin/env bash
+# ==============================================================================
+# Authors:
+# Patrick Lehmann
+#
+# Bash Script (executable):
+# Script to compile the simulation libraries from Altera Quartus for GHDL on
+# Linux
+#
+# Description:
+# - Creates a subdirectory in the current working directory
+# - Compiles all Altera Quartus-II simulation libraries and packages
+#
+# ==============================================================================
+# Copyright (C) 2017-2021 Patrick Lehmann - Boetzingen, Germany
+# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany
+#
+# This program 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 Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <gnu.org/licenses>.
+# ==============================================================================
+
+# Work around for Darwin (Mac OS)
+test greadlink --version > /dev/null 2>&1 && READLINK=greadlink || READLINK=readlink
+
+# Save working directory
+WorkingDir=$(pwd)
+ScriptDir="$(dirname $0)"
+ScriptDir="$($READLINK -f $ScriptDir)"
+
+# 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
+COMMAND=1
+CLEAN=0
+COMPILE_ALTERA=0
+COMPILE_MAX=0
+COMPILE_CYCLONE=0
+COMPILE_ARRIA=0
+COMPILE_STRATIX=0
+COMPILE_NM=0
+VERBOSE=0
+DEBUG=0
+FILTERING=1
+SKIP_LARGE_FILES=0
+SUPPRESS_WARNINGS=0
+HALT_ON_ERROR=0
+VHDLStandard=93
+DestDir=""
+SrcDir=""
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ -c|--clean)
+ COMMAND=3
+ CLEAN=1
+ ;;
+ -a|--all)
+ COMMAND=2
+ ;;
+ --altera)
+ COMMAND=3
+ COMPILE_ALTERA=1
+ ;;
+ --max)
+ COMMAND=3
+ COMPILE_MAX=1
+ ;;
+ --cyclone)
+ COMMAND=3
+ COMPILE_CYCLONE=1
+ ;;
+ --arria)
+ COMMAND=3
+ COMPILE_ARRIA=1
+ ;;
+ --stratix)
+ COMMAND=3
+ COMPILE_STRATIX=1
+ ;;
+ --nanometer)
+ COMMAND=3
+ COMPILE_NM=1
+ ;;
+ -S|--skip-largefiles)
+ SKIP_LARGE_FILES=1
+ ;;
+ --vhdl93)
+ VHDLStandard=93
+ ;;
+ --vhdl2008)
+ VHDLStandard=2008
+ ;;
+ -v|--verbose)
+ VERBOSE=1
+ ;;
+ -d|--debug)
+ VERBOSE=1
+ DEBUG=1
+ ;;
+ -h|--help)
+ COMMAND=0
+ break
+ ;;
+ -n|--no-filter)
+ FILTERING=0
+ ;;
+ -N|--no-warnings)
+ SUPPRESS_WARNINGS=1
+ ;;
+ -H|--halt-on-error)
+ HALT_ON_ERROR=1
+ ;;
+ --ghdl)
+ 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 "\n${COLORED_ERROR} Unknown command line option '$1'.${ANSI_NOCOLOR}"
+ COMMAND=0
+ break
+ ;;
+ esac
+ shift # parsed argument or value
+done
+
+ERRORCOUNT=0
+Libraries=()
+
+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 Intel Quartus Prime 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 " Use the adv. options or edit 'config.sh' to supply paths and default params."
+ echo ""
+ echo "Usage:"
+ echo " compile-intel.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 ""
+ echo "Libraries:"
+ echo " -a --all Compile all Intel simulation libraries."
+ echo " --intel Compile the Altera standard libraries: lpm, sgate, altera, altera_mf, altera_lnsim."
+ echo " --max Compile the Intel Max device libraries."
+ echo " --cyclone Compile the Intel Cyclone device libraries."
+ echo " --arria Compile the Intel Arria device libraries."
+ echo " --stratix Compile the Intel 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-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 binary> Path to GHDL's executable, e.g. /usr/local/bin/ghdl"
+ echo " --output <dir name> Name of the output directory, e.g. intel"
+ echo " --source <Path to Quartus>Path to the sources."
+ echo ""
+ echo "Verbosity:"
+ 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 $COMMAND
+fi
+
+if [[ $COMMAND -eq 2 ]]; then
+ COMPILE_ALTERA=1
+ COMPILE_MAX=1
+ COMPILE_CYCLONE=1
+ COMPILE_ARRIA=1
+ COMPILE_STRATIX=1
+ COMPILE_NM=1
+fi
+
+
+# Source configuration file from GHDL's 'vendors' library directory
+echo -e "${ANSI_MAGENTA}Loading environment...${ANSI_NOCOLOR}"
+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
+
+# Warn that some files might not be VHDL-2008 ready. Thus enabled continue on error.
+if [[ $VHDLStandard -eq 2008 ]]; then
+ echo -e "${ANSI_RED}Not all Altera packages are VHDL-2008 compatible! Setting CONTINUE_ON_ERROR to TRUE.${ANSI_NOCOLOR}"
+ CONTINUE_ON_ERROR=1
+fi
+
+# Search Intel Quartus in default installation locations
+DefaultDirectories=("/opt/IntelFPGA" "/opt/intelfpga" "/opt/Intel" "/opt/intel" "/opt/Altera" "/opt/altera" "/c/intelFPGA")
+if [ ! -z $QUARTUS_ROOTDIR ]; then
+ EnvSourceDir="$QUARTUS_ROOTDIR/${Intel_Quartus_Settings[SourceDirectory]}"
+else
+ for DefaultDir in "${DefaultDirectories[@]}"; do
+ for Major in 21 20 19 18 17 16; do
+ for Minor in 4 3 2 1 0; do
+ Dir=$DefaultDir/${Major}.${Minor}/quartus
+ if [ -d $Dir ]; then
+ EnvSourceDir="$Dir/${Intel_Quartus_Settings[SourceDirectory]}"
+ break 3
+ fi
+ done
+ done
+ done
+fi
+
+
+# <= $VHDLVersion
+# <= $VHDLStandard
+# <= $VHDLFlavor
+GHDLSetup $VHDLStandard
+
+# -> $SourceDirectories
+# -> $DestinationDirectories
+# -> $SrcDir
+# -> $DestDir
+# <= $SourceDirectory
+# <= $DestinationDirectory
+SetupDirectories Intel_Quartus "Intel Quartus"
+
+# create "osvvm" directory and change to it
+# => $DestinationDirectory
+CreateDestinationDirectory
+cd $DestinationDirectory
+
+
+# Extend global GHDL Options TODO: move to GHDLSetup
+Analyze_Parameters+=(
+ -fexplicit
+ -Wbinding
+)
+if [[ $DEBUG -eq 0 ]]; then
+ Analyze_Parameters+=(
+ -Wno-hide
+ )
+fi
+if [[ ! (VERBOSE -eq 1) && ($DEBUG -eq 1) ]]; then
+ Analyze_Parameters+=(
+ -Wno-others
+ -Wno-static
+ )
+fi
+Analyze_Parameters+=(
+ --ieee=$VHDLFlavor
+ --no-vital-checks
+ --std=$VHDLStandard
+ -frelaxed
+ -P$DestinationDirectory
+)
+
+# Cleanup directories
+# ==============================================================================
+if [[ $CLEAN -eq 1 ]]; then
+ echo 1>&2 -e "${COLORED_ERROR} '--clean' is not implemented!"
+ exit 1
+ echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_NOCOLOR}"
+ rm *.o 2> /dev/null
+ rm *.cf 2> /dev/null
+fi
+
+
+# Intel standard libraries
+# ==============================================================================
+StructName="LPM"
+Files=(
+ 220pack.vhd
+ 220model.vhd
+)
+CreateLibraryStruct $StructName "lpm" "." $VHDLVersion "${Files[@]}"
+test $COMPILE_ALTERA -eq 1 && Libraries+=("$StructName")
+
+StructName="SGATE"
+Files=(
+ sgate_pack.vhd
+ sgate.vhd
+)
+CreateLibraryStruct $StructName "sgate" "." $VHDLVersion "${Files[@]}"
+test $COMPILE_ALTERA -eq 1 && Libraries+=("$StructName")
+
+StructName="ALTERA"
+Files=(
+ altera_europa_support_lib.vhd
+ altera_primitives_components.vhd
+ altera_primitives.vhd
+ altera_standard_functions.vhd
+ altera_syn_attributes.vhd
+ alt_dspbuilder_package.vhd
+)
+CreateLibraryStruct $StructName "altera" "." $VHDLVersion "${Files[@]}"
+test $COMPILE_ALTERA -eq 1 && Libraries+=("$StructName")
+
+StructName="ALTERA_MF"
+Files=(
+ altera_mf_components.vhd
+ altera_mf.vhd
+)
+CreateLibraryStruct $StructName "altera_mf" "." $VHDLVersion "${Files[@]}"
+test $COMPILE_ALTERA -eq 1 && Libraries+=("$StructName")
+
+
+StructName="ALTERA_LNSIM"
+Files=(
+ altera_lnsim_components.vhd
+)
+CreateLibraryStruct $StructName "altera_lnsim" "." $VHDLVersion "${Files[@]}"
+test $COMPILE_ALTERA -eq 1 && Libraries+=("$StructName")
+
+# Intel device libraries
+# ==============================================================================
+test $VERBOSE -eq 1 && echo -e " Searching available devices ..."
+
+# Max library
+StructName="MAX"
+Files=(
+ max_atoms.vhd
+ max_components.vhd
+)
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Max'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "max" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_MAX -eq 1 && Libraries+=("$StructName")
+fi
+
+# Max II library
+StructName="MAX_II"
+Files=(
+ maxii_atoms.vhd
+ maxii_components.vhd
+)
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Max II'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "maxii" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_MAX -eq 1 && Libraries+=("$StructName")
+fi
+
+# Max V library
+StructName="MAX_V"
+Files=(
+ maxv_atoms.vhd
+ maxv_components.vhd
+)
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Max V'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "maxv" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_MAX -eq 1 && Libraries+=("$StructName")
+fi
+
+# Arria II library
+StructName="ARRIA_II"
+Files=(
+ arriaii_atoms.vhd
+ arriaii_components.vhd
+)
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ Files+=(
+ arriaii_hssi_components.vhd
+ arriaii_hssi_atoms.vhd
+ )
+fi
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Arria II'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "arriaii" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_ARRIA -eq 1 && Libraries+=("$StructName")
+fi
+
+# Arria II (PCIe) library
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ StructName="ARRIA_II_PCIe"
+ Files=(
+ arriaii_pcie_hip_components.vhd
+ arriaii_pcie_hip_atoms.vhd
+ )
+ if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Arria II (PCIe)'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "arriaii_pcie_hip" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_ARRIA -eq 1 && Libraries+=("$StructName")
+ fi
+fi
+
+# ArriaII GZ library
+StructName="ARRIA_II_GZ"
+Files=(
+ arriaiigz_atoms.vhd
+ arriaiigz_components.vhd
+)
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ Files+=(
+ arriaiigz_hssi_components.vhd
+ )
+fi
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Arria II GZ'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "arriaiigz" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_ARRIA -eq 1 && Libraries+=("$StructName")
+fi
+
+# ArriaV library
+StructName="ARRIA_V"
+Files=(
+ arriav_atoms.vhd
+ arriav_components.vhd
+)
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ Files+=(
+ arriav_hssi_components.vhd
+ arriav_hssi_atoms.vhd
+ )
+fi
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Arria V'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "arriav" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_ARRIA -eq 1 && Libraries+=("$StructName")
+fi
+
+# Arria V GZ library
+StructName="ARRIA_V_GZ"
+Files=(
+ arriavgz_atoms.vhd
+ arriavgz_components.vhd
+)
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ Files+=(
+ arriavgz_hssi_components.vhd
+ arriavgz_hssi_atoms.vhd
+ )
+fi
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Arria V GZ'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "arriavgz" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_ARRIA -eq 1 && Libraries+=("$StructName")
+fi
+
+# Arria V GZ (PCIe) library
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ StructName="ARRIA_V_GZ_PCIe"
+ Files=(
+ arriavgz_pcie_hip_components.vhd
+ arriavgz_pcie_hip_atoms.vhd
+ )
+ if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Arria V GZ (PCIe)'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "arriavgz_pcie_hip" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_ARRIA -eq 1 && Libraries+=("$StructName")
+ fi
+fi
+
+# Cyclone IV library
+StructName="CYCLONE_IV"
+Files=(
+ cycloneiv_atoms.vhd
+ cycloneiv_components.vhd
+)
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ Files+=(
+ cycloneiv_hssi_components.vhd
+ cycloneiv_hssi_atoms.vhd
+ )
+fi
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Cyclone IV'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "cycloneiv" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_CYCLONE -eq 1 && Libraries+=("$StructName")
+fi
+
+# Cyclone IV (PCIe) library
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ StructName="CYCLONE_IV_PCIe"
+ Files=(
+ cycloneiv_pcie_hip_components.vhd
+ cycloneiv_pcie_hip_atoms.vhd
+ )
+ if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Cyclone IV (PCIe)'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "cycloneiv_pcie_hip" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_CYCLONE -eq 1 && Libraries+=("$StructName")
+ fi
+fi
+
+# Cyclone IV E library
+StructName="CYCLONE_IV_E"
+Files=(
+ cycloneive_atoms.vhd
+ cycloneive_components.vhd
+)
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Cyclone IV E'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "cycloneive" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_CYCLONE -eq 1 && Libraries+=("$StructName")
+fi
+
+# Cyclone V library
+StructName="CYCLONE_V"
+Files=(
+ cyclonev_atoms.vhd
+ cyclonev_components.vhd
+)
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ Files+=(
+ cyclonev_hssi_components.vhd
+ cyclonev_hssi_atoms.vhd
+ )
+fi
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Cyclone V'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "cyclonev" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_CYCLONE -eq 1 && Libraries+=("$StructName")
+fi
+
+# Stratix IV library
+StructName="STRATIX_IV"
+Files=(
+ stratixiv_atoms.vhd
+ stratixiv_components.vhd
+)
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ Files+=(
+ stratixiv_hssi_components.vhd
+ stratixiv_hssi_atoms.vhd
+ )
+fi
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Stratix IV'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "stratixiv" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_STRATIX -eq 1 && Libraries+=("$StructName")
+fi
+
+# Stratix IV (PCIe) library
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ StructName="STRATIX_IV_PCIe"
+ Files=(
+ stratixiv_pcie_hip_components.vhd
+ stratixiv_pcie_hip_atoms.vhd
+ )
+ if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Stratix IV (PCIe)'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "stratixiv_pcie_hip" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_STRATIX -eq 1 && Libraries+=("$StructName")
+ fi
+fi
+
+# Stratix V library
+StructName="STRATIX_V"
+Files=(
+ stratixv_atoms.vhd
+ stratixv_components.vhd
+)
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ Files+=(
+ stratixv_hssi_components.vhd
+ stratixv_hssi_atoms.vhd
+ )
+fi
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Stratix V'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "stratixv" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_STRATIX -eq 1 && Libraries+=("$StructName")
+fi
+
+# Stratix V (PCIe) library
+if [[ $SKIP_LARGE_FILES -eq 0 ]]; then
+ StructName="STRATIX_V_PCIe"
+ Files=(
+ stratixv_pcie_hip_components.vhd
+ stratixv_pcie_hip_atoms.vhd
+ )
+ if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'Stratix V (PCIe)'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "stratixv_pcie_hip" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_STRATIX -eq 1 && Libraries+=("$StructName")
+ fi
+fi
+
+# 55 nm library
+StructName="NM_55"
+Files=(
+ fiftyfivenm_atoms.vhd
+ fiftyfivenm_components.vhd
+)
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device '55 nm'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "fiftyfivenm" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_NM -eq 1 && Libraries+=("$StructName")
+fi
+
+# 20 nm library
+StructName="NM_20"
+Files=(
+ 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
+if [[ -f "$SourceDirectory/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device '20 nm'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "twentynm" "." $VHDLVersion "${Files[@]}"
+
+ test $COMPILE_NM -eq 1 && Libraries+=("$StructName")
+fi
+
+# if [[ $DEBUG -eq 1 ]]; then
+ # for StructName in ${Libraries[*]}; do
+ # PrintLibraryStruct $StructName " "
+ # done
+# fi
+
+if [[ ${#Libraries[@]} -ne 0 ]]; then
+ Compile "$SourceDirectory" "${Libraries[*]}"
+
+ echo "--------------------------------------------------------------------------------"
+ echo -e "Compiling Intel Quartus packages and device libraries $(test $ERRORCOUNT -eq 0 && echo $COLORED_SUCCESSFUL || echo $COLORED_FAILED)"
+else
+ echo -e "${ANSI_RED}Neither Intel Quartus packages nor device libraries selected.${ANSI_NOCOLOR}"
+fi
diff --git a/scripts/vendors/compile-lattice.ps1 b/scripts/vendors/compile-lattice.ps1
new file mode 100644
index 000000000..ef8d1b59a
--- /dev/null
+++ b/scripts/vendors/compile-lattice.ps1
@@ -0,0 +1,394 @@
+# ==============================================================================
+# Authors:
+# Patrick Lehmann
+#
+# ==============================================================================
+# Copyright (C) 2017-2021 Patrick Lehmann - Boetzingen, Germany
+# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany
+#
+# This program 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 Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <gnu.org/licenses>.
+# ==============================================================================
+
+# .SYNOPSIS
+# Script to compile the simulation libraries from Lattice Diamond for GHDL on Windows.
+#
+# .DESCRIPTION
+# This CmdLet:
+# (1) creates a subdirectory in the current working directory
+# (2) compiles all Lattice Diamond simulation libraries and packages
+# o Lattice device libraries:
+# - EC, ECP, ECP2, ECP3, ECP5U
+# - LPTM, LPTM2
+# - MachXO, MachXO2, MachXO3L, MachXO3D
+# - SC, SCM
+# - XP, XP2
+#
+[CmdletBinding()]
+param(
+ # Show the embedded help page(s)
+ [switch]$Help = $false,
+
+ # Compile all libraries and packages.
+ [switch]$All = $false,
+
+ # Compile the Lattice EC device libraries
+ [switch]$ec = $false,
+ # Compile the Lattice ECP device libraries
+ [switch]$ecp = $false,
+ # Compile the Lattice ECP2 device libraries
+ [switch]$ecp2 = $false,
+ # Compile the Lattice ECP3 device libraries
+ [switch]$ecp3 = $false,
+ # Compile the Lattice ECP5U device libraries
+ [switch]$ecp5u = $false,
+
+ # Compile the Lattice LPTM device libraries
+ [switch]$lptm = $false,
+ # Compile the Lattice LPTM2 device libraries
+ [switch]$lptm2 = $false,
+
+ # Compile the Lattice MachXO device libraries
+ [switch]$MachXO = $false,
+ # Compile the Lattice MachXO2 device libraries
+ [switch]$MachXO2 = $false,
+ # Compile the Lattice MachXO3L device libraries
+ [switch]$MachXO3L = $false,
+ # Compile the Lattice MachXO3D device libraries
+ [switch]$MachXO3D = $false,
+
+ # Compile the Lattice SC device libraries
+ [switch]$sc = $false,
+ # Compile the Lattice SCM device libraries
+ [switch]$scm = $false,
+
+ # Compile the Lattice XP device libraries
+ [switch]$xp = $false,
+ # Compile the Lattice XP2 device libraries
+ [switch]$xp2 = $false,
+
+ # Clean up directory before analyzing.
+ [switch]$Clean = $false,
+
+ # Set VHDL Standard to '93
+ [switch]$VHDL93 = $false,
+ # Set VHDL Standard to '08
+ [switch]$VHDL2008 = $false,
+
+ # Skip warning messages. (Show errors only.)
+ [switch]$SuppressWarnings = $false,
+ # Halt on errors.
+ [switch]$HaltOnError = $false,
+
+ # Set vendor library source directory.
+ [string]$Source = "",
+ # Set output directory name.
+ [string]$Output = "",
+ # Set GHDL binary directory.
+ [string]$GHDL = ""
+)
+
+# ---------------------------------------------
+# save working directory
+$WorkingDir = Get-Location
+
+# set default values
+$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"]
+$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug
+
+# load modules from GHDL's 'vendors' library directory
+$EnableVerbose -and (Write-Host "Loading modules..." -ForegroundColor Gray ) | Out-Null
+$EnableDebug -and (Write-Host " Import-Module $PSScriptRoot\config.psm1 -Verbose:`$$false -Debug:`$$false -ArgumentList `"LatticeDiamond`"" -ForegroundColor DarkGray ) | Out-Null
+Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -ArgumentList "LatticeDiamond"
+$EnableDebug -and (Write-Host " Import-Module $PSScriptRoot\shared.psm1 -Verbose:`$$false -Debug:`$$false -ArgumentList @(`"Lattice Diamond`", `"$WorkingDir`")" -ForegroundColor DarkGray ) | Out-Null
+Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -ArgumentList @("Lattice Diamond", "$WorkingDir")
+
+# Display help if no command was selected
+$Help = $Help -or (-not ($All -or
+ ($ec -or $ecp -or $ecp2 -or $ecp3 -or $ecp5u) -or
+ ($lptm -or $lptm2) -or
+ ($MachXO -or $MachXO2 -or $MachXO3L -or $MachXO3D) -or
+ ($sc -or $scm) -or
+ ($xp -or $xp2) -or
+ $Clean))
+
+if ($Help)
+{ Get-Help $MYINVOCATION.MyCommand.Path -Detailed
+ Exit-CompileScript
+}
+if ($All)
+{ $ec = $true
+ $ecp = $true
+ $ecp2 = $true
+ $ecp3 = $true
+ $ecp5u = $true
+ $lptm = $true
+ $lptm2 = $true
+ $MachXO = $true
+ $MachXO2 = $true
+ $MachXO3L = $true
+ $MachXO3D = $true
+ $sc = $true
+ $scm = $true
+ $xp = $true
+ $xp2 = $true
+}
+
+function Get-LatticeDiamondDirectory
+{ if (Test-Path env:FOUNDRY)
+ { return $FOUNDRY + "\..\" + (Get-VendorToolSourceDirectory) }
+ else
+ { $EnvSourceDir = ""
+ foreach ($Drive in Get-PSDrive -PSProvider 'FileSystem')
+ { $Path = $Drive.Name + ":\" + "Lattice\Diamond"
+ if (Test-Path $Path -PathType Container)
+ { foreach ($Major in 4..3)
+ { foreach ($Minor in 9..0)
+ { $Dir = $Path + "\" + $Major + "." + $Minor + "_x64"
+ if (Test-Path $Dir -PathType Container)
+ { $EnvSourceDir = $Dir + "\" + (Get-VendorToolSourceDirectory)
+ return $EnvSourceDir
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+$SourceDirectory = Get-SourceDirectory $Source (Get-LatticeDiamondDirectory)
+$DestinationDirectory = Get-DestinationDirectory $Output
+$GHDLBinary = Get-GHDLBinary $GHDL
+
+# create "Lattice" directory and change to it
+New-DestinationDirectory $DestinationDirectory
+cd $DestinationDirectory
+
+$VHDLVersion,$VHDLStandard,$VHDLFlavor = Get-VHDLVariables $VHDL93 $VHDL2008
+
+# define global GHDL Options
+$Analyze_Parameters = @(
+ "-fexplicit",
+ "-frelaxed-rules",
+ "--mb-comments",
+ "-Wbinding"
+)
+if (-not $EnableDebug)
+{ $Analyze_Parameters += @(
+ "-Wno-hide"
+ )
+}
+if (-not ($EnableVerbose -or $EnableDebug))
+{ $Analyze_Parameters += @(
+ "-Wno-library",
+ "-Wno-others",
+ "-Wno-static"
+ )
+}
+$Analyze_Parameters += @(
+ "--ieee=$VHDLFlavor",
+ "--no-vital-checks",
+ "--std=$VHDLStandard",
+ "-P$DestinationDirectory"
+)
+
+$StopCompiling = $false
+$ErrorCount = 0
+
+$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");
+ "ecp" = @("ORCA_CMB.vhd", "ORCA_SEQ.vhd", "ORCACOMP.vhd", "ORCA_LUT.vhd", "ORCA_MISC.vhd", "ORCA_CNT.vhd", "ORCA_IO.vhd", "ORCA_MEM.vhd");
+ "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");
+ "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");
+ "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");
+ "lptm" = @("MACHXO_CMB.vhd", "MACHXO_SEQ.vhd", "MACHXOCOMP.vhd", "MACHXO_CNT.vhd", "MACHXO_IO.vhd", "MACHXO_LUT.vhd", "MACHXO_MEM.vhd", "MACHXO_MISC.vhd");
+ "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");
+ "machxo" = @("MACHXO_CMB.vhd", "MACHXO_SEQ.vhd", "MACHXOCOMP.vhd", "MACHXO_CNT.vhd", "MACHXO_IO.vhd", "MACHXO_LUT.vhd", "MACHXO_MEM.vhd", "MACHXO_MISC.vhd");
+ "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");
+ "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");
+ "machxo3d" = @("MACHXO3D_CMB.vhd", "MACHXO3D_SEQ.vhd", "MACHXO3DCOMP.vhd", "gsr_pur_assign.vhd", "MACHXO3D_CNT.vhd", "MACHXO3D_IO.vhd", "MACHXO3D_LUT.vhd", "MACHXO3D_MEM.vhd", "MACHXO3D_MISC.vhd");
+ "sc" = @("ORCA_CMB.vhd", "ORCA_SEQ.vhd", "ORCACOMP.vhd", "ORCA_CNT.vhd", "ORCA_IO.vhd", "ORCA_MEM.vhd", "ORCA_MIS.vhd", "ORCA_SL.vhd");
+ "scm" = @("ORCA_CMB.vhd", "ORCA_SEQ.vhd", "ORCACOMP.vhd", "ORCA_CNT.vhd", "ORCA_IO.vhd", "ORCA_MEM.vhd", "ORCA_MIS.vhd", "ORCA_SL.vhd");
+ "xp" = @("ORCA_CMB.vhd", "ORCA_SEQ.vhd", "ORCACOMP.vhd", "ORCA_LUT.vhd", "ORCA_MISC.vhd", "ORCA_CNT.vhd", "ORCA_IO.vhd", "ORCA_MEM.vhd");
+ "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")
+}
+
+# Cleanup directories
+# ==============================================================================
+if ($Clean)
+{ Write-Host "[ERROR]: '-Clean' is not implemented!" -ForegroundColor Red
+ Exit-CompileScript -1
+
+ Write-Host "Cleaning up vendor directory ..." -ForegroundColor Yellow
+ rm *.cf
+}
+
+
+# Lattice EC library
+# ==============================================================================
+if ((-not $StopCompiling) -and $ec)
+{ $Library = "ec"
+ $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Lattice ECP library
+# ==============================================================================
+if ((-not $StopCompiling) -and $ecp)
+{ $Library = "ecp"
+ $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Lattice ECP2 library
+# ==============================================================================
+if ((-not $StopCompiling) -and $ecp2)
+{ $Library = "ecp2"
+ $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Lattice ECP3 library
+# ==============================================================================
+if ((-not $StopCompiling) -and $ecp3)
+{ $Library = "ecp3"
+ $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Lattice ECP5U library
+# ==============================================================================
+if ((-not $StopCompiling) -and $ecp5u)
+{ $Library = "ecp5u"
+ $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Lattice LPTM library
+# ==============================================================================
+if ((-not $StopCompiling) -and $lptm)
+{ $Library = "lptm"
+ $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Lattice LPTM2 library
+# ==============================================================================
+if ((-not $StopCompiling) -and $lptm2)
+{ $Library = "lptm2"
+ $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Lattice MachXO library
+# ==============================================================================
+if ((-not $StopCompiling) -and $MachXO)
+{ $Library = "MachXO"
+ $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Lattice MachXO2 library
+# ==============================================================================
+if ((-not $StopCompiling) -and $MachXO2)
+{ $Library = "MachXO2"
+ $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Lattice MachXO3L library
+# ==============================================================================
+if ((-not $StopCompiling) -and $machxo3l)
+{ $Library = "machxo3l"
+ $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Lattice MachXO3D library
+# ==============================================================================
+if ((-not $StopCompiling) -and $machxo3d)
+{ $Library = "machxo3d"
+ $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Lattice SC library
+# ==============================================================================
+if ((-not $StopCompiling) -and $sc)
+{ $Library = "sc"
+ $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Lattice SCM library
+# ==============================================================================
+if ((-not $StopCompiling) -and $scm)
+{ $Library = "scm"
+ $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Lattice XP library
+# ==============================================================================
+if ((-not $StopCompiling) -and $xp)
+{ $Library = "xp"
+ $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Lattice XP2 library
+# ==============================================================================
+if ((-not $StopCompiling) -and $xp2)
+{ $Library = "xp2"
+ $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+Write-Host "--------------------------------------------------------------------------------"
+Write-Host "Compiling Lattice libraries " -NoNewline
+if ($ErrorCount -gt 0)
+{ Write-Host "[FAILED]" -ForegroundColor Red }
+else
+{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green }
+
+Exit-CompileScript
diff --git a/scripts/vendors/compile-lattice.sh b/scripts/vendors/compile-lattice.sh
new file mode 100755
index 000000000..a7cdfd7c3
--- /dev/null
+++ b/scripts/vendors/compile-lattice.sh
@@ -0,0 +1,598 @@
+#! /usr/bin/env bash
+# ==============================================================================
+# Authors:
+# Markus Koch
+# Patrick Lehmann
+#
+# Bash Script (executable):
+# Script to compile the simulation libraries from Lattice Diamond for GHDL on
+# Linux
+#
+# Description:
+# - Creates a subdirectory in the current working directory
+# - Compiles all Lattice Diamond simulation libraries and packages
+#
+# ==============================================================================
+# Copyright (C) 2017-2021 Patrick Lehmann - Boetzingen, Germany
+# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany
+# Copyright (C) 2015-2016 Markus Koch
+#
+# This program 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 Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <gnu.org/licenses>.
+# ==============================================================================
+
+# Work around for Darwin (Mac OS)
+test greadlink --version > /dev/null 2>&1 && READLINK=greadlink || READLINK=readlink
+
+# Save working directory
+WorkingDir=$(pwd)
+ScriptDir="$(dirname $0)"
+ScriptDir="$($READLINK -f $ScriptDir)"
+
+# 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
+
+
+DeviceList="EC ECP ECP2 ECP3 ECP5U LPTM LPTM2 MACHXO MACHXO2 MACHXO3L SC SCM XP XP2"
+for Device in $DeviceList; do
+ declare "DEV_${Device}_Enable"=0
+done
+
+
+# Command line argument processing
+COMMAND=1
+CLEAN=0
+VERBOSE=0
+DEBUG=0
+FILTERING=1
+SUPPRESS_WARNINGS=0
+HALT_ON_ERROR=0
+VHDLStandard=93
+DestDir=""
+SrcDir=""
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ -c|--clean)
+ COMMAND=3
+ CLEAN=1
+ ;;
+ -a|--all)
+ COMMAND=2
+ ;;
+ --vhdl93)
+ VHDLStandard=93
+ ;;
+ --vhdl2008)
+ VHDLStandard=2008
+ ;;
+ -v|--verbose)
+ VERBOSE=1
+ ;;
+ -d|--debug)
+ VERBOSE=1
+ DEBUG=1
+ ;;
+ -h|--help)
+ COMMAND=0
+ break
+ ;;
+ -n|--no-filter)
+ FILTERING=0
+ ;;
+ -N|--no-warnings)
+ SUPPRESS_WARNINGS=1
+ ;;
+ -H|--halt-on-error)
+ HALT_ON_ERROR=1
+ ;;
+ --ghdl)
+ 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
+ FOUND=0
+ if [[ "${1:0:2}" == "--" ]]; then
+ key=${1:2}; key=${key,,}
+ for Device in $DeviceList; do
+ if [[ $key == "${Device,,}" ]]; then
+ declare "DEV_${Device}_Enable"=1
+ COMMAND=3
+ FOUND=1
+ break
+ fi
+ done
+ fi
+ if [[ $FOUND -eq 0 ]]; then
+ echo 1>&2 -e "\n${COLORED_ERROR} Unknown command line option '$1'.${ANSI_NOCOLOR}"
+ COMMAND=0
+ break
+ fi
+ ;;
+ esac
+ shift # parsed argument or value
+done
+
+ERRORCOUNT=0
+Libraries=()
+
+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 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 " Use the adv. options or edit 'config.sh' to supply paths and default params."
+ echo ""
+ echo "Usage:"
+ echo " compile-lattice.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 Lattice simulation libraries."
+ for Device in $DeviceList; do
+ printf " --%-23s Device primitives for '%s'.\n" "${Device,,}" "$Device"
+ done
+ echo ""
+ echo "Library compile options:"
+ echo " --vhdl93 Compile the libraries with VHDL-93."
+ echo " --vhdl2008 Compile the libraries with VHDL-2008."
+ echo " -H --halt-on-error Halt on error(s)."
+ echo ""
+ echo "Advanced options:"
+ 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. lattice"
+ echo " --source <Path to Diamond>Path to the sources."
+ echo ""
+ echo "Verbosity:"
+ 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 $COMMAND
+fi
+
+if [[ $COMMAND -eq 2 ]]; then
+ for Device in $DeviceList; do
+ declare "DEV_${Device}_Enable"=1
+ done
+fi
+
+
+# Source configuration file from GHDL's 'vendors' library directory
+echo -e "${ANSI_MAGENTA}Loading environment...${ANSI_NOCOLOR}"
+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
+
+# Warn that some files might not be VHDL-2008 ready. Thus enabled continue on error.
+if [[ $VHDLStandard -eq 2008 ]]; then
+ echo -e "${ANSI_RED}Not all Lattice packages are VHDL-2008 compatible! Setting CONTINUE_ON_ERROR to TRUE.${ANSI_NOCOLOR}"
+ CONTINUE_ON_ERROR=1
+fi
+
+# Search Lattice Diamond in default installation locations
+DefaultDirectories=("/usr/local/diamond" "/opt/Diamond" "/opt/diamond" "/c/Lattice/Diamond")
+if [ ! -z $LSC_DIAMOND ]; then
+ EnvSourceDir="$FOUNDRY/../${Lattice_Diamond_Settings[SourceDirectory]}"
+else
+ for DefaultDir in "${DefaultDirectories[@]}"; do
+ for Major in 3; do
+ for Minor in 12 11 10 9 8 7 6 5; do
+ Dir=$DefaultDir/${Major}.${Minor}_x64
+ if [ -d $Dir ]; then
+ EnvSourceDir="$Dir/${Lattice_Diamond_Settings[SourceDirectory]}"
+ break 3
+ fi
+ done
+ done
+ done
+fi
+
+
+# <= $VHDLVersion
+# <= $VHDLStandard
+# <= $VHDLFlavor
+GHDLSetup $VHDLStandard
+
+# -> $SourceDirectories
+# -> $DestinationDirectories
+# -> $SrcDir
+# -> $EnvSourceDir
+# -> $DestDir
+# <= $SourceDirectory
+# <= $DestinationDirectory
+SetupDirectories LatticeDiamond "Lattice Diamond"
+
+# create "lattice" directory and change to it
+# => $DestinationDirectory
+CreateDestinationDirectory
+cd $DestinationDirectory
+
+
+# Extend global GHDL Options TODO: move to GHDLSetup
+Analyze_Parameters+=(
+ -fexplicit
+ -Wbinding
+)
+if [[ $DEBUG -eq 0 ]]; then
+ Analyze_Parameters+=(
+ -Wno-hide
+ )
+fi
+if [[ ! (VERBOSE -eq 1) && ($DEBUG -eq 1) ]]; then
+ Analyze_Parameters+=(
+ -Wno-others
+ -Wno-static
+ )
+fi
+Analyze_Parameters+=(
+ --ieee=$VHDLFlavor
+ --no-vital-checks
+ --std=$VHDLStandard
+ -frelaxed
+ -P$DestinationDirectory
+)
+
+
+# Cleanup directory
+# ==============================================================================
+if [[ $CLEAN -eq 1 ]]; then
+ echo 1>&2 -e "${COLORED_ERROR} '--clean' is not implemented!"
+ exit 1
+ echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_NOCOLOR}"
+ rm *.o 2> /dev/null
+ rm *.cf 2> /dev/null
+fi
+
+# Excluded: pmi
+#
+# Lattice device libraries
+# ==============================================================================
+# EC devices
+StructName="EC"
+SourceDir="ec/src"
+Files=(
+ ORCA_CMB.vhd
+ ORCA_SEQ.vhd
+ ORCACOMP.vhd
+ ORCA_LUT.vhd
+ ORCA_MISC.vhd
+ ORCA_CNT.vhd
+ ORCA_IO.vhd
+ ORCA_MEM.vhd
+)
+if [[ -f "$SourceDirectory/$SourceDir/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'EC'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "ec" $SourceDir $VHDLVersion "${Files[@]}"
+
+ VarName="DEV_${StructName}_Enable"
+ test ${!VarName} -eq 1 && Libraries+=("$StructName")
+#else
+# echo "not found: $SourceDirectory/${Files[0]}"
+fi
+
+# ECP devices
+StructName="ECP"
+SourceDir="ecp/src"
+Files=(
+ ORCA_CMB.vhd
+ ORCA_SEQ.vhd
+ ORCACOMP.vhd
+ ORCA_LUT.vhd
+ ORCA_MISC.vhd
+ ORCA_CNT.vhd
+ ORCA_IO.vhd
+ ORCA_MEM.vhd
+)
+if [[ -f "$SourceDirectory/$SourceDir/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'ECP'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "ecp" $SourceDir $VHDLVersion "${Files[@]}"
+
+ VarName="DEV_${StructName}_Enable"
+ test ${!VarName} -eq 1 && Libraries+=("$StructName")
+fi
+
+
+# ECP2 devices
+StructName="ECP2"
+SourceDir="ecp2/src"
+Files=(
+ 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
+)
+if [[ -f "$SourceDirectory/$SourceDir/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'ECP2'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "ecp2" $SourceDir $VHDLVersion "${Files[@]}"
+
+ VarName="DEV_${StructName}_Enable"
+ test ${!VarName} -eq 1 && Libraries+=("$StructName")
+fi
+
+# ECP3 devices
+StructName="ECP3"
+SourceDir="ecp3/src"
+Files=(
+ 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
+)
+if [[ -f "$SourceDirectory/$SourceDir/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'ECP3'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "ecp3" $SourceDir $VHDLVersion "${Files[@]}"
+
+ VarName="DEV_${StructName}_Enable"
+ test ${!VarName} -eq 1 && Libraries+=("$StructName")
+fi
+
+# ECP5U devices
+StructName="ECP5U"
+SourceDir="ecp5u/src"
+Files=(
+ 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
+)
+if [[ -f "$SourceDirectory/$SourceDir/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'ECP5U'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "ecp5u" $SourceDir $VHDLVersion "${Files[@]}"
+
+ VarName="DEV_${StructName}_Enable"
+ test ${!VarName} -eq 1 && Libraries+=("$StructName")
+fi
+
+# LPTM devices
+StructName="LPTM"
+SourceDir="lptm/src"
+Files=(
+ MACHXO_CMB.vhd
+ MACHXO_SEQ.vhd
+ MACHXOCOMP.vhd
+ MACHXO_CNT.vhd
+ MACHXO_IO.vhd
+ MACHXO_LUT.vhd
+ MACHXO_MEM.vhd
+ MACHXO_MISC.vhd
+)
+if [[ -f "$SourceDirectory/$SourceDir/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'LPTM'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "lptm" $SourceDir $VHDLVersion "${Files[@]}"
+
+ VarName="DEV_${StructName}_Enable"
+ test ${!VarName} -eq 1 && Libraries+=("$StructName")
+fi
+
+# LPTM2 devices
+StructName="LPTM2"
+SourceDir="lptm2/src"
+Files=(
+ 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
+)
+if [[ -f "$SourceDirectory/$SourceDir/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'LPTM2'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "lptm2" $SourceDir $VHDLVersion "${Files[@]}"
+
+ VarName="DEV_${StructName}_Enable"
+ test ${!VarName} -eq 1 && Libraries+=("$StructName")
+fi
+
+# MachXO devices
+StructName="MACHXO"
+SourceDir="machxo/src"
+Files=(
+ MACHXO_CMB.vhd
+ MACHXO_SEQ.vhd
+ MACHXOCOMP.vhd
+ MACHXO_CNT.vhd
+ MACHXO_IO.vhd
+ MACHXO_LUT.vhd
+ MACHXO_MEM.vhd
+ MACHXO_MISC.vhd
+)
+if [[ -f "$SourceDirectory/$SourceDir/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'MachXO'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "machxo" $SourceDir $VHDLVersion "${Files[@]}"
+
+ VarName="DEV_${StructName}_Enable"
+ test ${!VarName} -eq 1 && Libraries+=("$StructName")
+fi
+
+# MachXO2 devices
+StructName="MACHXO2"
+SourceDir="machxo2/src"
+Files=(
+ 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
+)
+if [[ -f "$SourceDirectory/$SourceDir/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'MachXO2'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "machxo2" $SourceDir $VHDLVersion "${Files[@]}"
+
+ VarName="DEV_${StructName}_Enable"
+ test ${!VarName} -eq 1 && Libraries+=("$StructName")
+fi
+
+# MachXO3L devices
+StructName="MACHXO3L"
+SourceDir="machxo3l/src"
+Files=(
+ 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
+)
+if [[ -f "$SourceDirectory/$SourceDir/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'MachXO3L'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "machxo3l" $SourceDir $VHDLVersion "${Files[@]}"
+
+ VarName="DEV_${StructName}_Enable"
+ test ${!VarName} -eq 1 && Libraries+=("$StructName")
+fi
+
+# SC devices
+StructName="SC"
+SourceDir="sc/src"
+Files=(
+ ORCA_CMB.vhd
+ ORCA_SEQ.vhd
+ ORCACOMP.vhd
+ ORCA_CNT.vhd
+ ORCA_IO.vhd
+ ORCA_MEM.vhd
+ ORCA_MIS.vhd
+ ORCA_SL.vhd
+)
+if [[ -f "$SourceDirectory/$SourceDir/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'SC'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "sc" $SourceDir $VHDLVersion "${Files[@]}"
+
+ VarName="DEV_${StructName}_Enable"
+ test ${!VarName} -eq 1 && Libraries+=("$StructName")
+fi
+
+# SCM devices
+StructName="SCM"
+SourceDir="scm/src"
+Files=(
+ ORCA_CMB.vhd
+ ORCA_SEQ.vhd
+ ORCACOMP.vhd
+ ORCA_CNT.vhd
+ ORCA_IO.vhd
+ ORCA_MEM.vhd
+ ORCA_MIS.vhd
+ ORCA_SL.vhd
+)
+if [[ -f "$SourceDirectory/$SourceDir/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'SCM'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "scm" $SourceDir $VHDLVersion "${Files[@]}"
+
+ VarName="DEV_${StructName}_Enable"
+ test ${!VarName} -eq 1 && Libraries+=("$StructName")
+fi
+
+# XP devices
+StructName="XP"
+SourceDir="xp/src"
+Files=(
+ ORCA_CMB.vhd
+ ORCA_SEQ.vhd
+ ORCACOMP.vhd
+ ORCA_LUT.vhd
+ ORCA_MISC.vhd
+ ORCA_CNT.vhd
+ ORCA_IO.vhd
+ ORCA_MEM.vhd
+)
+if [[ -f "$SourceDirectory/$SourceDir/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'XP'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "xp" $SourceDir $VHDLVersion "${Files[@]}"
+
+ VarName="DEV_${StructName}_Enable"
+ test ${!VarName} -eq 1 && Libraries+=("$StructName")
+fi
+
+# XP2 devices
+StructName="XP2"
+SourceDir="xp2/src"
+Files=(
+ 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
+)
+if [[ -f "$SourceDirectory/$SourceDir/${Files[0]}" ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Found device 'XP2'.${ANSI_NOCOLOR}"
+ CreateLibraryStruct $StructName "xp2" $SourceDir $VHDLVersion "${Files[@]}"
+
+ VarName="DEV_${StructName}_Enable"
+ test ${!VarName} -eq 1 && Libraries+=("$StructName")
+fi
+
+# if [[ $DEBUG -eq 1 ]]; then
+ # for StructName in ${Libraries[*]}; do
+ # PrintLibraryStruct $StructName " "
+ # done
+# fi
+
+# Compile libraries
+if [[ ${#Libraries[@]} -ne 0 ]]; then
+ Compile "$SourceDirectory" "${Libraries[*]}"
+
+ echo "--------------------------------------------------------------------------------"
+ echo -e "Compiling Lattice device libraries $(test $ERRORCOUNT -eq 0 && echo $COLORED_SUCCESSFUL || echo $COLORED_FAILED)"
+else
+ echo -e "${ANSI_RED}No Lattice device library selected.${ANSI_NOCOLOR}"
+fi
diff --git a/scripts/vendors/compile-osvvm.ps1 b/scripts/vendors/compile-osvvm.ps1
new file mode 100644
index 000000000..318d8bdaf
--- /dev/null
+++ b/scripts/vendors/compile-osvvm.ps1
@@ -0,0 +1,336 @@
+# ==============================================================================
+# Authors:
+# Patrick Lehmann
+#
+# ==============================================================================
+# Copyright (C) 2017-2021 Patrick Lehmann - Boetzingen, Germany
+# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany
+#
+# This program 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 Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <gnu.org/licenses>.
+# ==============================================================================
+
+# .SYNOPSIS
+# Script to compile the OSVVM libraries and verification models for GHDL on Windows.
+#
+# .DESCRIPTION
+# This CmdLet:
+# (1) creates a subdirectory in the current working directory
+# (2) compiles all OSVVM packages
+#
+[CmdletBinding()]
+param(
+ # Show the embedded help page(s)
+ [switch]$Help = $false,
+
+ # Compile all libraries and packages.
+ [switch]$All = $false,
+
+ # Compile all OSVVM packages (utility library and common packages).
+ [switch]$OSVVM = $false,
+ # Compile all OSVVM 'utility' packages.
+ [switch]$OSVVM_Utilities = $false,
+ # Compile all OSVVM 'common' packages.
+ [switch]$OSVVM_Common = $false,
+
+ # Compile all OSVVM verfication IPs.
+ [switch]$OSVVM_VIP = $false,
+ # Compile OSVVM's AXI4 models (AXI4, AXI4-Lite, AXI4-Stream).
+ [switch]$OSVVM_VIP_AXI4 = $false,
+ # Compile OSVVM's UART model.
+ [switch]$OSVVM_VIP_UART = $false,
+
+ # Clean up directory before analyzing.
+ [switch]$Clean = $false,
+
+ # Skip warning messages. (Show errors only.)
+ [switch]$SuppressWarnings = $false,
+ # Halt on errors
+ [switch]$HaltOnError = $false,
+
+ # Set vendor library source directory.
+ [string]$Source = "",
+ # Set output directory name.
+ [string]$Output = "",
+ # Set GHDL binary directory.
+ [string]$GHDL = ""
+)
+
+# ---------------------------------------------
+# save working directory
+$WorkingDir = Get-Location
+
+# set default values
+$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"]
+$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug
+
+# load modules from GHDL's 'vendors' library directory
+$EnableVerbose -and (Write-Host "Loading modules..." -ForegroundColor Gray ) | Out-Null
+$EnableDebug -and (Write-Host " Import-Module $PSScriptRoot\config.psm1 -Verbose:`$$false -Debug:`$$false -ArgumentList `"OSVVM`"" -ForegroundColor DarkGray ) | Out-Null
+Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -ArgumentList "OSVVM"
+$EnableDebug -and (Write-Host " Import-Module $PSScriptRoot\shared.psm1 -Verbose:`$$false -Debug:`$$false -ArgumentList @(`"OSVVM`", `"$WorkingDir`")" -ForegroundColor DarkGray ) | Out-Null
+Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -ArgumentList @("OSVVM", "$WorkingDir")
+
+# Display help if no command was selected
+if ($Help -or (-not ($All -or $Clean -or
+ ($OSVVM -or ($OSVVM_Utilities -or $OSVVM_Common)) -or
+ ($OSVVM_VIP -or ($OSVVM_VIP_AXI4 -or $OSVVM_VIP_UART))
+ )))
+{ Get-Help $MYINVOCATION.MyCommand.Path -Detailed
+ Exit-CompileScript
+}
+
+if ($All)
+{ $OSVVM = $true
+ $OSVVM_VIP = $true
+}
+if ($OSVVM)
+{ $OSVVM_Utilities = $true
+ $OSVVM_Common = $true
+}
+if ($OSVVM_VIP)
+{ $OSVVM_VIP_AXI4 = $true
+ $OSVVM_VIP_UART = $true
+}
+
+
+$SourceDirectory = Get-SourceDirectory $Source ""
+$DestinationDirectory = Get-DestinationDirectory $Output
+$GHDLBinary = Get-GHDLBinary $GHDL
+
+# create "Altera" directory and change to it
+New-DestinationDirectory $DestinationDirectory
+cd $DestinationDirectory
+
+$VHDLVersion,$VHDLStandard,$VHDLFlavor = Get-VHDLVariables -VHDL2008
+
+# define global GHDL Options
+$Analyze_Parameters = @(
+ "-fexplicit",
+ "-frelaxed-rules",
+ "--mb-comments",
+ "-Wbinding"
+)
+if (-not $EnableDebug)
+{ $Analyze_Parameters += @(
+ "-Wno-hide"
+ )
+}
+if (-not ($EnableVerbose -or $EnableDebug))
+{ $Analyze_Parameters += @(
+ "-Wno-others",
+ "-Wno-static"
+ )
+}
+$Analyze_Parameters += @(
+ "--ieee=$VHDLFlavor",
+ "--no-vital-checks",
+ "--std=$VHDLStandard",
+ "-P$DestinationDirectory"
+)
+
+
+$StopCompiling = $false
+$ErrorCount = 0
+
+# Cleanup directories
+# ==============================================================================
+if ($Clean)
+{ Write-Host "[ERROR]: '-Clean' is not implemented!" -ForegroundColor Red
+ Exit-CompileScript -1
+
+ Write-Host "Cleaning up vendor directory ..." -ForegroundColor Yellow
+ rm *.cf
+}
+
+
+function Get-CompileOrderedFiles
+{ <#
+ .SYNOPSIS
+ Read *.pro files
+
+ .DESCRIPTION
+ Recursive function to read *.pro files
+
+ .PARAMETER CurrentDirectory
+ Current working directory. All paths in *.pro files are relative to this directory.
+ .PARAMETER CompileOrderFile
+ *.pro file to read and analyze
+ .PARAMETER Level
+ Level since root directory
+ #>
+ [CmdletBinding()]
+ param(
+ [string]$CurrentDirectory,
+ [string]$CompileOrderFile,
+ [int]$Level = 0
+ )
+
+# Write-Host "$CurrentDirectory - $CompileOrderFile - $Level"
+
+ $FileSets = [ordered]@{}
+ $Libraries = [ordered]@{}
+ $Libraries["work"] = @{
+ "Library" = "work";
+ "Files" = @()
+ }
+ $CoverageFile = ""
+
+ $CompileOrder = Get-Content "$CurrentDirectory\$CompileOrderFile"
+ foreach ($Line in $CompileOrder)
+ { if ($Line.StartsWith("#") -or $Line -eq "")
+ { continue }
+ elseif ($Line.StartsWith("include "))
+ { $IncludeFile = $Line.Substring(8)
+ $File = "$CurrentDirectory\$IncludeFile"
+ if (Test-Path $File)
+ { $Dir = Split-Path -Path $File -Resolve
+ $File = Split-Path -Path $File -Resolve -Leaf
+
+ if ($Level -eq 0) # VIP Level
+ { $VIPName = Split-Path -Path $Dir -Leaf
+ $Lib = Get-CompileOrderedFiles $Dir $File ($Level + 1)
+
+ $VIPName = $VIPName.ToUpper()
+ $VariableName = switch ( $VIPName )
+ { "OSVVM" { "OSVVM_Utilities" }
+ "COMMON" { "OSVVM_Common" }
+ default { "OSVVM_VIP_$VIPName" }
+ }
+
+ $FileSets[$VIPName] = @{
+ "Variable" = $VariableName;
+ "Component" = $VIPName;
+ "Libraries" = $Lib
+ }
+ }
+ else
+ { $Lib = Get-CompileOrderedFiles $Dir $File ($Level + 1)
+ foreach ($LibName in $Lib.Keys)
+ { if ($LibName -eq "work")
+ { $LibraryName = $Libraries["work"]["Library"]
+ $Libraries[$LibraryName]["Files"] += $Lib["work"]["Files"]
+ }
+ elseif ($Libraries.Contains($LibName))
+ { $Libraries[$LibName]["Files"] += $Lib[$LibName]["Files"] }
+ else
+ { $Libraries[$LibName] = @{
+ "Library" = $LibName;
+ "Files" = $Lib[$LibName]["Files"]
+ }
+ }
+ } # for LibName
+ } # Level
+ } # Test-Path
+ continue
+ } # include
+ elseif ($Line.StartsWith("if"))
+ { continue }
+ elseif ($Line.StartsWith("}"))
+ { continue }
+ elseif ($Line.StartsWith("library "))
+ { $LibraryName = $Line.Substring(8)
+ $Libraries["work"]["Library"] = $LibraryName
+ $Libraries[$LibraryName] = @{
+ "Library" = $LibraryName;
+ "Files" = @()
+ }
+ continue
+ }
+ elseif ($Line.StartsWith("analyze "))
+ { $SourceFile = $Line.Substring(8) }
+ elseif ($Line.StartsWith(" analyze "))
+ { if ($CoverageFile -eq "")
+ { $CoverageFile = $Line.Substring(10)
+ continue
+ }
+ else
+ { $SourceFile = $Line.Substring(10) }
+ }
+ else
+ { Write-Host "[ERROR]: Unknown instruction in compile order file." -ForegroundColor Red
+ Write-Host " $Line"
+ continue
+ }
+
+ $Path = "$CurrentDirectory\$SourceFile"
+ try
+ { $LibraryName = $Libraries["work"]["Library"]
+ $Libraries[$LibraryName]["Files"] += Resolve-Path $Path }
+ catch
+ { Write-Host "[ERROR]: When resolving path '$Path'." -ForegroundColor Red }
+ }
+
+ if ($Level -eq 0)
+ { return $FileSets }
+ else
+ { return $Libraries }
+}
+
+
+$CompileOrderFile = "OsvvmLibraries.pro"
+if (Test-Path "$SourceDirectory\$CompileOrderFile")
+{ $FileSets = Get-CompileOrderedFiles $SourceDirectory $CompileOrderFile }
+else
+{ Write-Host "[ERROR]: File '$CompileOrderFile' not found." -ForegroundColor Red }
+
+
+# $CompileOrderFile = "osvvm.pro"
+# $EnableVerbose -and (Write-Host " Search for 'osvvm' directory..." -ForegroundColor Gray ) | Out-Null
+# if (Test-Path "$SourceDirectory\$CompileOrderFile")
+# { $PackageDirectory = $SourceDirectory }
+# elseif (Test-Path "$SourceDirectory\osvvm\$CompileOrderFile")
+# { $PackageDirectory = "$SourceDirectory\osvvm" }
+# $EnableDebug -and (Write-Host " Found '$CompileOrderFile' in '$PackageDirectory'" -ForegroundColor DarkGray ) | Out-Null
+
+# Analyze OSVVM library and models
+# ==============================================================================
+foreach ($VIPName in $FileSets.Keys)
+{ $VariableName = $FileSets[$VIPName]["Variable"]
+ try
+ { $Enabled = Get-Variable $VariableName -ValueOnly }
+ catch
+ { Write-Host "[ERROR]: Found a new OSVVM component not supported by this script. Skipping." -ForegroundColor Red
+ continue
+ }
+
+ if ((-not $StopCompiling) -and (Get-Variable $VariableName -ValueOnly))
+ { Write-Host ("Component: " + $FileSets[$VIPName]["Component"]) -ForegroundColor Magenta
+
+ foreach ($LibraryName in $FileSets[$VIPName]["Libraries"].Keys)
+ { if ($LibraryName -eq "work")
+ { if ($FileSets[$VIPName]["Libraries"][$LibraryName]["Files"].Count -ne 0)
+ { Write-Host ("[ERROR]: Library 'works' contains " + $FileSets[$VIPName]["Libraries"][$LibraryName]["Files"].Count + " files.") -ForegroundColor Red
+ foreach ($File in $FileSets[$VIPName]["Libraries"][$LibraryName]["Files"])
+ { Write-Host " $File" -ForegroundColor Red }
+ }
+ continue
+ }
+
+ $Library = $FileSets[$VIPName]["Libraries"][$LibraryName]["Library"]
+ $SourceFiles = $FileSets[$VIPName]["Libraries"][$LibraryName]["Files"]
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+ }
+}
+
+Write-Host "--------------------------------------------------------------------------------"
+Write-Host "Compiling OSVVM " -NoNewline
+if ($ErrorCount -gt 0)
+{ Write-Host "[FAILED]" -ForegroundColor Red }
+else
+{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green }
+
+Exit-CompileScript
diff --git a/scripts/vendors/compile-osvvm.sh b/scripts/vendors/compile-osvvm.sh
new file mode 100755
index 000000000..dbdf7c70b
--- /dev/null
+++ b/scripts/vendors/compile-osvvm.sh
@@ -0,0 +1,264 @@
+#! /usr/bin/env bash
+# ==============================================================================
+# Authors:
+# Patrick Lehmann
+#
+# Bash Script (executable):
+# Script to compile the OSVVM library for GHDL on Linux.
+#
+# Description:
+# - Creates a subdirectory in the current working directory
+# - Compiles all OSVVM packages and verification IPs
+#
+# ==============================================================================
+# Copyright (C) 2017-2021 Patrick Lehmann - Boetzingen, Germany
+# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany
+#
+# This program 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 Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <gnu.org/licenses>.
+# ==============================================================================
+
+# Work around for Darwin (Mac OS)
+test greadlink --version > /dev/null 2>&1 && READLINK=greadlink || READLINK=readlink
+
+# Save working directory
+WorkingDir=$(pwd)
+ScriptDir="$(dirname $0)"
+ScriptDir="$($READLINK -f $ScriptDir)"
+
+# 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
+COMMAND=1
+CLEAN=0
+COMPILE_OSVVM=0
+VERBOSE=0
+DEBUG=0
+FILTERING=1
+SUPPRESS_WARNINGS=0
+HALT_ON_ERROR=0
+DestDir=""
+SrcDir=""
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ -c|--clean)
+ COMMAND=3
+ CLEAN=1
+ ;;
+ -a|--all)
+ COMMAND=2
+ ;;
+ --osvvm)
+ COMMAND=3
+ COMPILE_OSVVM=1
+ ;;
+ -v|--verbose)
+ VERBOSE=1
+ ;;
+ -d|--debug)
+ VERBOSE=1
+ DEBUG=1
+ ;;
+ -h|--help)
+ COMMAND=0
+ break
+ ;;
+ -n|--no-filter)
+ FILTERING=0
+ ;;
+ -N|--no-warnings)
+ SUPPRESS_WARNINGS=1
+ ;;
+ -H|--halt-on-error)
+ HALT_ON_ERROR=1
+ ;;
+ --ghdl)
+ 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 "\n${COLORED_ERROR} Unknown command line option '$1'.${ANSI_NOCOLOR}"
+ COMMAND=0
+ break
+ ;;
+ esac
+ shift # parsed argument or value
+done
+
+ERRORCOUNT=0
+Libraries=()
+
+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."
+ echo " A library folder 'osvvm/v08' will be created relative to the current"
+ echo " working directory."
+ echo ""
+ echo " Use the adv. options or edit 'config.sh' to supply paths and default params."
+ echo ""
+ echo "Usage:"
+ 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 ""
+ echo "Libraries:"
+ 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 ""
+ echo "Advanced options:"
+ 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 " -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 $COMMAND
+fi
+
+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
+echo -e "${ANSI_MAGENTA}Loading environment...${ANSI_NOCOLOR}"
+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
+
+# <= $VHDLVersion
+# <= $VHDLStandard
+# <= $VHDLFlavor
+GHDLSetup 2008
+
+# -> $SourceDirectories
+# -> $DestinationDirectories
+# -> $SrcDir
+# -> $DestDir
+# <= $SourceDirectory
+# <= $DestinationDirectory
+SetupDirectories OSVVM "OSVVM"
+
+# Create "osvvm" directory and change to it
+# => $DestinationDirectory
+CreateDestinationDirectory
+cd $DestinationDirectory
+
+
+# Extend global GHDL Options TODO: move to GHDLSetup
+Analyze_Parameters+=(
+ -fexplicit
+ -Wbinding
+)
+if [[ $DEBUG -eq 0 ]]; then
+ Analyze_Parameters+=(
+ -Wno-hide
+ )
+fi
+if [[ ! (VERBOSE -eq 1) && ($DEBUG -eq 1) ]]; then
+ Analyze_Parameters+=(
+ -Wno-others
+ -Wno-static
+ )
+fi
+Analyze_Parameters+=(
+ --ieee=$VHDLFlavor
+ --no-vital-checks
+ --std=$VHDLStandard
+ -frelaxed
+ -P$DestinationDirectory
+)
+
+
+# Cleanup directory
+# ==============================================================================
+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
+
+
+# Library osvvm
+# ==============================================================================
+StructName="OSVVM_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[@]} -ne 0 ]]; 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 "${ANSI_RED}Neither OSVVM packages nor VIPs selected.${ANSI_NOCOLOR}"
+fi
diff --git a/scripts/vendors/compile-uvvm.ps1 b/scripts/vendors/compile-uvvm.ps1
new file mode 100644
index 000000000..fefd755a6
--- /dev/null
+++ b/scripts/vendors/compile-uvvm.ps1
@@ -0,0 +1,280 @@
+# ==============================================================================
+# Authors:
+# Patrick Lehmann
+#
+# ==============================================================================
+# Copyright (C) 2017-2021 Patrick Lehmann - Boetzingen, Germany
+# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany
+#
+# This program 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 Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <gnu.org/licenses>.
+# ==============================================================================
+
+# .SYNOPSIS
+# Script to compile the UVVM libraries and verification models for GHDL on Windows.
+#
+# .DESCRIPTION
+# This CmdLet:
+# (1) creates a subdirectory in the current working directory
+# (2) compiles all UVVM packages
+#
+[CmdletBinding()]
+param(
+ # Show the embedded help page(s).
+ [switch]$Help = $false,
+
+ # Compile all packages.
+ [switch]$All = $false,
+
+ # Compile all UVVM packages.
+ [switch]$UVVM = $false,
+ # Compile all UVVM Utility packages.
+ [switch]$UVVM_Utilities = $false,
+ # Compile all UVVM VVC Framework packages.
+ [switch]$UVVM_VVC_Framework = $false,
+ # Compile all UVVM Verification IPs (VIPs).
+ [switch]$UVVM_VIP = $false,
+ # Compile VIP: Avalon Memory Mapped
+ [switch]$UVVM_VIP_Avalon_MM = $false,
+ # Compile VIP: Avalon Stream
+ [switch]$UVVM_VIP_Avalon_ST = $false,
+ # Compile VIP: AXI
+ [switch]$UVVM_VIP_AXI = $false,
+ # Compile VIP: AXI-Lite
+ [switch]$UVVM_VIP_AXI_Lite = $false,
+ # Compile VIP: AXI-Stream
+ [switch]$UVVM_VIP_AXI_Stream = $false,
+ # Compile VIP: Clock Generator
+ [switch]$UVVM_VIP_Clock_Generator = $false,
+ # Compile VIP: Error Injection
+ [switch]$UVVM_VIP_Error_Injection = $false,
+ # Compile VIP: Ethernet
+ [switch]$UVVM_VIP_Ethernet = $false,
+ # Compile VIP: GMII
+ [switch]$UVVM_VIP_GMII = $false,
+ # Compile VIP: GPIO
+ [switch]$UVVM_VIP_GPIO = $false,
+ # Compile VIP: HVVC to VVC Bridge
+ [switch]$UVVM_VIP_HVVC2VVC = $false,
+ # Compile VIP: I2C
+ [switch]$UVVM_VIP_I2C = $false,
+ # Compile VIP: RGMII
+ [switch]$UVVM_VIP_RGMII = $false,
+ # Compile VIP: SBI (Simple Byte Interface)
+ [switch]$UVVM_VIP_SBI = $false,
+ # Compile VIP: Scoreboard
+ [switch]$UVVM_VIP_Scoreboard = $false,
+ # Compile VIP: Specifaction Coverage
+ [switch]$UVVM_VIP_Spec_Cov = $false,
+ # Compile VIP: SPI
+ [switch]$UVVM_VIP_SPI = $false,
+ # Compile VIP: UART
+ [switch]$UVVM_VIP_UART = $false,
+
+ # Clean up directory before analyzing.
+ [switch]$Clean = $false,
+
+ #Skip warning messages. (Show errors only.)
+ [switch]$SuppressWarnings = $false,
+ # Halt on errors.
+ [switch]$HaltOnError = $false,
+
+ # Set vendor library source directory.
+ [string]$Source = "",
+ # Set output directory name.
+ [string]$Output = "",
+ # Set GHDL binary directory.
+ [string]$GHDL = ""
+)
+
+# ---------------------------------------------
+# save working directory
+$WorkingDir = Get-Location
+
+# set default values
+$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"]
+$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug
+
+# load modules from GHDL's 'vendors' library directory
+$EnableVerbose -and (Write-Host "Loading modules..." -ForegroundColor Gray ) | Out-Null
+$EnableDebug -and (Write-Host " Import-Module $PSScriptRoot\config.psm1 -Verbose:`$$false -Debug:`$$false -ArgumentList `"UVVM`"" -ForegroundColor DarkGray ) | Out-Null
+Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -ArgumentList "UVVM"
+$EnableDebug -and (Write-Host " Import-Module $PSScriptRoot\shared.psm1 -Verbose:`$$false -Debug:`$$false -ArgumentList @(`"UVVM`", `"$WorkingDir`")" -ForegroundColor DarkGray ) | Out-Null
+Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -ArgumentList @("UVVM", "$WorkingDir")
+
+# Display help if no command was selected
+if ($Help -or (-not ($All -or $Clean -or
+ ($UVVM -or ($UVVM_Utilities -or $UVVM_VVC_Framework)) -or
+ ($UVVM_VIP -or ($UVVM_VIP_Avalon_MM -or $UVVM_VIP_Avalon_ST -or $UVVM_VIP_AXI -or $UVVM_VIP_AXI_Lite -or
+ $UVVM_VIP_AXI_Stream -or $UVVM_VIP_Clock_Generator -or $UVVM_VIP_Error_Injection -or
+ $UVVM_VIP_Ethernet -or $UVVM_VIP_GMII -or $UVVM_VIP_GPIO -or $UVVM_VIP_HVVC2VVC -or
+ $UVVM_VIP_I2C -or $UVVM_VIP_RGMII -or $UVVM_VIP_SBI -or $UVVM_VIP_Scoreboard -or
+ $UVVM_VIP_Spec_Cov -or $UVVM_VIP_SPI -or $UVVM_VIP_UART))
+ )))
+{ Get-Help $MYINVOCATION.MyCommand.Path -Detailed
+ Exit-CompileScript
+}
+
+if ($All)
+{ $UVVM = $true
+ $UVVM_VIP = $true
+}
+if ($UVVM)
+{ $UVVM_Utilities = $true
+ $UVVM_VVC_Framework = $true
+}
+if ($UVVM_VIP)
+{ $UVVM_VIP_Avalon_MM = $true
+ $UVVM_VIP_Avalon_ST = $true
+ $UVVM_VIP_AXI = $true
+ $UVVM_VIP_AXI_Lite = $true
+ $UVVM_VIP_AXI_Stream = $true
+ $UVVM_VIP_Clock_Generator = $true
+ $UVVM_VIP_Error_Injection = $true
+ $UVVM_VIP_Ethernet = $true
+ $UVVM_VIP_GMII = $true
+ $UVVM_VIP_GPIO = $true
+ $UVVM_VIP_HVVC2VVC = $true
+ $UVVM_VIP_I2C = $true
+ $UVVM_VIP_RGMII = $true
+ $UVVM_VIP_SBI = $true
+ $UVVM_VIP_Scoreboard = $true
+ $UVVM_VIP_Spec_Cov = $true
+ $UVVM_VIP_SPI = $true
+ $UVVM_VIP_UART = $true
+}
+
+
+$SourceDirectory = Get-SourceDirectory $Source ""
+$DestinationDirectory = Get-DestinationDirectory $Output
+$GHDLBinary = Get-GHDLBinary $GHDL
+
+# create "uvvm" directory and change to it
+New-DestinationDirectory $DestinationDirectory
+cd $DestinationDirectory
+
+
+$VHDLVersion,$VHDLStandard,$VHDLFlavor = Get-VHDLVariables
+
+# define global GHDL Options
+$Analyze_Parameters = @(
+ "--mb-comments",
+ "-Wbinding",
+ "-fexplicit",
+ "-Wno-shared" # UVVM specific
+)
+if (-not $EnableDebug)
+{ $Analyze_Parameters += @(
+ "-Wno-hide"
+ )
+}
+if (-not ($EnableVerbose -or $EnableDebug))
+{ $Analyze_Parameters += @(
+ "-Wno-others",
+ "-Wno-static"
+ )
+}
+$Analyze_Parameters += @(
+ "--ieee=$VHDLFlavor",
+ "--no-vital-checks",
+ "--std=$VHDLStandard",
+ "-frelaxed",
+ "-P$DestinationDirectory"
+)
+
+
+$StopCompiling = $false
+$ErrorCount = 0
+
+# Cleanup directories
+# ==============================================================================
+if ($Clean)
+{ Write-Host "[ERROR]: '-Clean' is not implemented!" -ForegroundColor Red
+ Exit-CompileScript -1
+
+ Write-Host "Cleaning up vendor directory ..." -ForegroundColor Yellow
+ rm *.cf
+}
+
+Write-Host "Reading VIP compile order files..." -ForegroundColor Cyan
+$VIP_Files = [ordered]@{}
+foreach ($VIPName in (Get-Content "$SourceDirectory\script\component_list.txt"))
+{ if ($VIPName.StartsWith("uvvm"))
+ { $VIPVariable = $VIPName.Substring(5).ToUpper()
+ $VIPVariable = $VIPVariable.Replace("UTIL", "Utilities")
+ }
+ elseif ($VIPName.StartsWith("bitvis"))
+ { $VIPVariable = $VIPName.Substring(7).ToUpper()
+ $VIPVariable = $VIPVariable.Replace("AXILITE", "AXI_LITE")
+ $VIPVariable = $VIPVariable.Replace("AXISTREAM", "AXI_STREAM")
+ $VIPVariable = $VIPVariable.Replace("HVVC_TO_VVC_BRIDGE", "HVVC2VVC")
+ }
+ $VIPVariable = "UVVM_$VIPVariable"
+
+ $EnableVerbose -and (Write-Host " Found VIP: $VIPName" -ForegroundColor Gray ) | Out-Null
+ $EnableDebug -and (Write-Host " Reading compile order from '$SourceDirectory\$VIPName\script\compile_order.txt'" -ForegroundColor DarkGray ) | Out-Null
+
+ $VIPFiles = @()
+ $CompileOrder = Get-Content "$SourceDirectory\$VIPName\script\compile_order.txt"
+ foreach ($Line in $CompileOrder)
+ { $Line = $Line.Trim()
+ if ($Line -eq "")
+ { continue }
+ elseif ($Line.StartsWith("#"))
+ { if ($Line.StartsWith("# library "))
+ { $VIPName = $Line.Substring(10) }
+ else
+ { Write-Host "Unknown parser instruction in compile order file." -ForegroundColor Yellow }
+ }
+ else
+ { $Path = Resolve-Path "$SourceDirectory\$VIPName\script\$Line"
+ $VIPFiles += $Path
+ }
+ }
+
+ if ($EnableDebug)
+ { Write-Host " VHDL Library name: $VIPName" -ForegroundColor DarkGray
+ foreach ($File in $VIPFiles)
+ { Write-Host " $File" -ForegroundColor DarkGray }
+ }
+
+ $VIP_Files[$VIPName] = @{
+ "Variable" = $VIPVariable;
+ "Library" = $VIPName;
+ "Files" = $VIPFiles
+ }
+}
+
+
+# UVVM packages
+# ==============================================================================
+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"]
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+}
+
+Write-Host "--------------------------------------------------------------------------------"
+Write-Host "Compiling UVVM packages " -NoNewline
+if ($ErrorCount -gt 0)
+{ Write-Host "[FAILED]" -ForegroundColor Red
+ Exit-CompileScript 1
+}
+else
+{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green
+ Exit-CompileScript
+}
diff --git a/scripts/vendors/compile-uvvm.sh b/scripts/vendors/compile-uvvm.sh
new file mode 100755
index 000000000..d33743a87
--- /dev/null
+++ b/scripts/vendors/compile-uvvm.sh
@@ -0,0 +1,437 @@
+#! /usr/bin/env bash
+# ==============================================================================
+# Authors:
+# Patrick Lehmann
+#
+# Bash Script (executable):
+# Script to compile the UVVM library for GHDL on Linux.
+#
+# Description:
+# - Creates a subdirectory in the current working directory
+# - Compiles all UVVM packages and verification IPs
+#
+# ==============================================================================
+# Copyright (C) 2017-2021 Patrick Lehmann - Boetzingen, Germany
+# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany
+#
+# This program 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 Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <gnu.org/licenses>.
+# ==============================================================================
+
+# Work around for Darwin (Mac OS)
+test greadlink --version > /dev/null 2>&1 && READLINK=greadlink || READLINK=readlink
+
+# Save working directory
+WorkingDir=$(pwd)
+ScriptDir="$(dirname $0)"
+ScriptDir="$($READLINK -f $ScriptDir)"
+
+# 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
+COMMAND=1
+CLEAN=0
+COMPILE_UVVM=0
+COMPILE_UVVM_UTILITIES=0
+COMPILE_UVVM_VVC_FRAMEWORK=0
+COMPILE_UVVM_VIP=0
+COMPILE_UVVM_VIP_AVALON_MM=0
+COMPILE_UVVM_VIP_AVALON_ST=0
+COMPILE_UVVM_VIP_AXI=0
+COMPILE_UVVM_VIP_AXILITE=0
+COMPILE_UVVM_VIP_AXISTREAM=0
+COMPILE_UVVM_VIP_CLOCK_GENERATOR=0
+COMPILE_UVVM_VIP_ERROR_INJECTION=0
+COMPILE_UVVM_VIP_ETHERNET=0
+COMPILE_UVVM_VIP_GMII=0
+COMPILE_UVVM_VIP_GPIO=0
+COMPILE_UVVM_VIP_HVVC_TO_VVC_BRIDGE=0
+COMPILE_UVVM_VIP_I2C=0
+COMPILE_UVVM_VIP_RGMII=0
+COMPILE_UVVM_VIP_SBI=0
+COMPILE_UVVM_VIP_SCOREBOARD=0
+COMPILE_UVVM_VIP_SPEC_COV=0
+COMPILE_UVVM_VIP_SPI=0
+COMPILE_UVVM_VIP_UART=0
+VERBOSE=0
+DEBUG=0
+FILTERING=1
+SUPPRESS_WARNINGS=0
+HALT_ON_ERROR=0
+DestDir=""
+SrcDir=""
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ -c|--clean)
+ COMMAND=3
+ CLEAN=1
+ ;;
+ -a|--all)
+ COMMAND=2
+ ;;
+ --uvvm)
+ COMMAND=3
+ COMPILE_UVVM=1
+ ;;
+ --uvvm-vip)
+ COMMAND=3
+ COMPILE_UVVM_VIP=1
+ ;;
+ --uvvm-utilities)
+ COMMAND=3
+ COMPILE_UVVM_UTILITIES=1
+ ;;
+ --uvvm-vvc-framework)
+ COMMAND=3
+ COMPILE_UVVM_VVC_FRAMEWORK=1
+ ;;
+ --uvvm-vip-avalon_mm)
+ COMMAND=3
+ COMPILE_UVVM_VIP_AVALON_MM=1
+ ;;
+ --uvvm-vip-avalon_st)
+ COMMAND=3
+ COMPILE_UVVM_VIP_AVALON_ST=1
+ ;;
+ --uvvm-vip-axi)
+ COMMAND=3
+ COMPILE_UVVM_VIP_AXI=1
+ ;;
+ --uvvm-vip-axi_lite)
+ COMMAND=3
+ COMPILE_UVVM_VIP_AXILITE=1
+ ;;
+ --uvvm-vip-axi_stream)
+ COMMAND=3
+ COMPILE_UVVM_VIP_AXISTREAM=1
+ ;;
+ --uvvm-vip-clock)
+ COMMAND=3
+ COMPILE_UVVM_VIP_CLOCK_GENERATOR=1
+ ;;
+ --uvvm-vip-error)
+ COMMAND=3
+ COMPILE_UVVM_VIP_ERROR_INJECTION=1
+ ;;
+ --uvvm-vip-ethernet)
+ COMMAND=3
+ COMPILE_UVVM_VIP_ETHERNET=1
+ ;;
+ --uvvm-vip-gmii)
+ COMMAND=3
+ COMPILE_UVVM_VIP_GMII=1
+ ;;
+ --uvvm-vip-gpio)
+ COMMAND=3
+ COMPILE_UVVM_VIP_GPIO=1
+ ;;
+ --uvvm-vip-hvvc2vvc)
+ COMMAND=3
+ COMPILE_UVVM_VIP_HVVC_TO_VVC_BRIDGE=1
+ ;;
+ --uvvm-vip-i2c)
+ COMMAND=3
+ COMPILE_UVVM_VIP_I2C=1
+ ;;
+ --uvvm-vip-rgmii)
+ COMMAND=3
+ COMPILE_UVVM_VIP_RGMII=1
+ ;;
+ --uvvm-vip-sbi)
+ COMMAND=3
+ COMPILE_UVVM_VIP_SBI=1
+ ;;
+ --uvvm-vip-spec)
+ COMMAND=3
+ COMPILE_UVVM_VIP_SPEC_COV=1
+ ;;
+ --uvvm-vip-spi)
+ COMMAND=3
+ COMPILE_UVVM_VIP_SPI=1
+ ;;
+ --uvvm-vip-scoreboard)
+ COMMAND=3
+ COMPILE_UVVM_VIP_SCOREBOARD=1
+ ;;
+ --uvvm-vip-uart)
+ COMMAND=3
+ COMPILE_UVVM_VIP_UART=1
+ ;;
+ -v|--verbose)
+ VERBOSE=1
+ ;;
+ -d|--debug)
+ VERBOSE=1
+ DEBUG=1
+ ;;
+ -h|--help)
+ COMMAND=0
+ break
+ ;;
+ -n|--no-filter)
+ FILTERING=0
+ ;;
+ -N|--no-warnings)
+ SUPPRESS_WARNINGS=1
+ ;;
+ -H|--halt-on-error)
+ HALT_ON_ERROR=1
+ ;;
+ --ghdl)
+ 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 "\n${COLORED_ERROR} Unknown command line option '$1'.${ANSI_NOCOLOR}"
+ COMMAND=0
+ break
+ ;;
+ esac
+ shift # parsed argument or value
+done
+
+ERRORCOUNT=0
+
+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 'uvvm' for GHDL on Linux."
+ echo " A library folder 'uvvm/v08' will be created relative to the current"
+ echo " working directory."
+ echo ""
+ echo " Use the adv. options or edit 'config.sh' to supply paths and default parameters."
+ echo ""
+ echo "Usage:"
+ echo " compile-uvvm.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 ""
+ echo "Libraries:"
+ echo " -a --all Compile all libraries."
+ echo " --uvvm Compile UVVM library packages."
+ echo " --uvvm-vip Compile UVVM Verification IPs (VIPs)."
+ echo ""
+ echo "Common Packages:"
+ echo " --uvvm-utilities UVVM utilities."
+ echo " --uvvm-vvc-framework VHDL Verification Component (VVC) framework."
+ echo ""
+ echo "Verification IPs:"
+ echo " --uvvm-vip-avalon_mm Altera/Intel Avalon Memory Mapped"
+ echo " --uvvm-vip-avalon_st Altera/Intel Avalon Stream"
+ echo " --uvvm-vip-axi ARM AMBA AXI4"
+ echo " --uvvm-vip-axi_lite ARM AMBA AXI4-Lite"
+ echo " --uvvm-vip-axi_stream ARM AMBA AXI4-Stream"
+ echo " --uvvm-vip-clock Clock generator"
+ echo " --uvvm-vip-error Error injection"
+ echo " --uvvm-vip-ethernet Ethernet"
+ echo " --uvvm-vip-gmii GMII"
+ echo " --uvvm-vip-gpio General Purpose Input/Output (GPIO)"
+ echo " --uvvm-vip-hvvc2vvc HVVC to VVC bridge"
+ echo " --uvvm-vip-i2c Inter-Integrated Circuit (I²C)"
+ echo " --uvvm-vip-rgmii RGMII"
+ echo " --uvvm-vip-sbi Simple Bus Interface"
+ echo " --uvvm-vip-scoreboard Scoreboard"
+ echo " --uvvm-vip-spec Specification Coverage"
+ echo " --uvvm-vip-spi Serial Peripheral Interface"
+ echo " --uvvm-vip-uart Universal Asynchronous Receiver Transmitter (UART)"
+ echo ""
+ echo "Library compile options:"
+ echo " -H --halt-on-error Halt on error(s)."
+ echo ""
+ echo "Advanced options:"
+ 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. uvvm_util"
+ echo " --source <Path to UVVM> Path to the sources."
+ echo ""
+ echo "Verbosity:"
+ 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 $COMMAND
+fi
+
+if [[ $COMMAND -eq 2 ]]; then
+ COMPILE_UVVM=1
+ COMPILE_UVVM_VIP=1
+fi
+if [[ $COMPILE_UVVM -eq 1 ]]; then
+ COMPILE_UVVM_UTILITIES=1
+ COMPILE_UVVM_VVC_FRAMEWORK=1
+fi
+if [[ $COMPILE_UVVM_VIP -eq 1 ]]; then
+ COMPILE_UVVM_VIP_AVALON_MM=1
+ COMPILE_UVVM_VIP_AVALON_ST=1
+ COMPILE_UVVM_VIP_AXI=1
+ COMPILE_UVVM_VIP_AXILITE=1
+ COMPILE_UVVM_VIP_AXISTREAM=1
+ COMPILE_UVVM_VIP_CLOCK_GENERATOR=1
+ COMPILE_UVVM_VIP_ERROR_INJECTION=1
+ COMPILE_UVVM_VIP_ETHERNET=1
+ COMPILE_UVVM_VIP_GMII=1
+ COMPILE_UVVM_VIP_GPIO=1
+ COMPILE_UVVM_VIP_HVVC_TO_VVC_BRIDGE=1
+ COMPILE_UVVM_VIP_I2C=1
+ COMPILE_UVVM_VIP_RGMII=1
+ COMPILE_UVVM_VIP_SBI=1
+ COMPILE_UVVM_VIP_SCOREBOARD=1
+ COMPILE_UVVM_VIP_SPEC_COV=1
+ COMPILE_UVVM_VIP_SPI=1
+ COMPILE_UVVM_VIP_UART=1
+fi
+
+
+# Source configuration file from GHDL's 'vendors' library directory
+echo -e "${ANSI_MAGENTA}Loading environment...${ANSI_NOCOLOR}"
+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
+
+# <= $VHDLVersion
+# <= $VHDLStandard
+# <= $VHDLFlavor
+GHDLSetup 2008
+
+# -> $SourceDirectories
+# -> $DestinationDirectories
+# -> $SrcDir
+# -> $DestDir
+# <= $SourceDirectory
+# <= $DestinationDirectory
+SetupDirectories UVVM "UVVM"
+
+# Create "uvvm" directory and change to it
+# => $DestinationDirectory
+CreateDestinationDirectory
+cd $DestinationDirectory
+
+
+# Extend global GHDL Options TODO: move to GHDLSetup
+Analyze_Parameters+=(
+ -fexplicit
+ -Wbinding
+ -Wno-shared
+)
+if [[ $DEBUG -eq 0 ]]; then
+ Analyze_Parameters+=(
+ -Wno-hide
+ )
+fi
+if [[ ! (VERBOSE -eq 1) && ($DEBUG -eq 1) ]]; then
+ Analyze_Parameters+=(
+ -Wno-others
+ -Wno-static
+ )
+fi
+Analyze_Parameters+=(
+ --ieee=$VHDLFlavor
+ --no-vital-checks
+ --std=$VHDLStandard
+ -frelaxed
+ -P$DestinationDirectory
+)
+
+
+# Cleanup directory
+# ==============================================================================
+if [[ $CLEAN -eq 1 ]]; then
+ echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_NOCOLOR}"
+ rm *.o 2> /dev/null
+ rm *.cf 2> /dev/null
+fi
+
+
+# Read order of components
+# ==============================================================================
+test $VERBOSE -eq 1 && echo -e " ${ANSI_GRAY}Reading compile order files...${ANSI_NOCOLOR}"
+
+Components=()
+while IFS= read -r Component; do
+ Component=${Component%\r}
+ if [[ ${Component:0:2} != "# " ]]; then
+ Components+=("$Component")
+ fi
+done < <(cat "$SourceDirectory/script/component_list.txt")
+
+
+# Read libraries and Verification IPs
+# ==============================================================================
+VIPNames=()
+
+for ComponentName in "${Components[@]}"; do
+ x="${ComponentName%%_*}"
+ pos=${#x}+1
+ l=${ComponentName:$pos}
+ VIPName=${l^^}
+ LibraryPath=$ComponentName
+
+ VIPName=${VIPName//UTIL/UTILITIES}
+ VIPName=${VIPName//AXILITE/AXI_LITE}
+ VIPName=${VIPName//AXISTREAM/AXI_STREAM}
+
+ test $VERBOSE -eq 1 && echo -e " ${ANSI_GRAY}Found VIP '$VIPName' in '$LibraryPath'.${ANSI_NOCOLOR}"
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Reading compile order from '$SourceDirectory/$LibraryPath/script/compile_order.txt'${ANSI_NOCOLOR}"
+
+ # Reading component's files
+ StructName=$VIPName
+ Files=()
+
+ CompileOrderFile="$SourceDirectory/$LibraryPath/script/compile_order.txt"
+ if [[ -f "$CompileOrderFile" ]]; then
+ echo -e "${COLORED_ERROR} Compile order file '$CompileOrderFile' does not exist..${ANSI_NOCOLOR}"
+ continue
+ fi
+
+ while IFS= read -r File; do
+ File=${File%\r}
+ if [[ ${File:0:2} == "# " ]]; then
+ if [[ ${File:2:7} == "library" ]]; then
+ LibraryName=${File:10}
+ fi
+ else
+ Files+=("${File:3}")
+ fi
+ done < <(cat "$CompileOrderFile")
+
+ CreateLibraryStruct $StructName $LibraryName $LibraryPath $VHDLVersion "${Files[@]}"
+
+ VarName="COMPILE_UVVM_${VIPName}"
+ test ${!VarName} -eq 1 && Libraries+=("$StructName")
+done
+
+# Compile components
+if [[ ${#Libraries[@]} -ne 0 ]]; then
+ Compile "$SourceDirectory" "${Libraries[*]}"
+
+ echo "--------------------------------------------------------------------------------"
+ echo -e "Compiling UVVM packages and VIPs $(test $ERRORCOUNT -eq 0 && echo $COLORED_SUCCESSFUL || echo $COLORED_FAILED)"
+else
+ echo -e "${COLORED_ERROR} Neither UVVM packages nor VIPs selected.${ANSI_NOCOLOR}"
+ exit 2
+fi
diff --git a/scripts/vendors/compile-xilinx-ise.ps1 b/scripts/vendors/compile-xilinx-ise.ps1
new file mode 100644
index 000000000..5c51f8f25
--- /dev/null
+++ b/scripts/vendors/compile-xilinx-ise.ps1
@@ -0,0 +1,308 @@
+# ==============================================================================
+# Authors:
+# Patrick Lehmann
+#
+# ==============================================================================
+# Copyright (C) 2017-2021 Patrick Lehmann - Boetzingen, Germany
+# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany
+#
+# This program 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 Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <gnu.org/licenses>.
+# ==============================================================================
+
+# .SYNOPSIS
+# Script to compile the simulation libraries from Xilinx ISE for GHDL on Windows.
+#
+# .DESCRIPTION
+# This CmdLet:
+# (1) creates a subdirectory in the current working directory
+# (2) compiles all Xilinx ISE simulation libraries and packages
+# - unisim (incl. secureip)
+# - unimacro
+# - simprim (incl. secureip)
+# - xilinxcorelib
+#
+[CmdletBinding()]
+param(
+ # Show the embedded help page(s)
+ [switch]$Help = $false,
+
+ # Compile all libraries and packages.
+ [switch]$All = $false,
+
+ # Compile the Xilinx simulation library.
+ [switch]$Unisim = $false,
+
+ # Compile the Xilinx macro library.
+ [switch]$Unimacro = $false,
+
+ # Compile the Xilinx post-map simulation library.
+ [switch]$Simprim = $false,
+
+ # Compile the Xilinx CoreLib simulation library.
+ [switch]$CoreLib = $false,
+
+ # Compile the Xilinx secureip library.
+ [switch]$SecureIP = $false,
+
+ # Clean up directory before analyzing.
+ [switch]$Clean = $false,
+
+ # Set VHDL Standard to '93
+ [switch]$VHDL93 = $false,
+ # Set VHDL Standard to '08
+ [switch]$VHDL2008 = $false,
+
+ # Skip warning messages. (Show errors only.)
+ [switch]$SuppressWarnings = $false,
+ # Halt on errors.
+ [switch]$HaltOnError = $false,
+
+ # Set vendor library source directory.
+ [string]$Source = "",
+ # Set output directory name.
+ [string]$Output = "",
+ # Set GHDL binary directory.
+ [string]$GHDL = ""
+)
+
+# ---------------------------------------------
+# save working directory
+$WorkingDir = Get-Location
+
+# set default values
+$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"]
+$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug
+
+# load modules from GHDL's 'vendors' library directory
+$EnableVerbose -and (Write-Host "Loading modules..." -ForegroundColor Gray ) | Out-Null
+$EnableDebug -and (Write-Host " Import-Module $PSScriptRoot\config.psm1 -Verbose:`$$false -Debug:`$$false -ArgumentList `"XilinxISE`"" -ForegroundColor DarkGray ) | Out-Null
+Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -ArgumentList "XilinxISE"
+$EnableDebug -and (Write-Host " Import-Module $PSScriptRoot\shared.psm1 -Verbose:`$$false -Debug:`$$false -ArgumentList @(`"Xilinx ISE`", `"$WorkingDir`")" -ForegroundColor DarkGray ) | Out-Null
+Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -ArgumentList @("Xilinx ISE", "$WorkingDir")
+
+# Display help if no command was selected
+$Help = $Help -or (-not ($All -or $Unisim -or $Simprim -or $Unimacro -or $CoreLib -or $Clean))
+
+if ($Help)
+{ Get-Help $MYINVOCATION.MyCommand.Path -Detailed
+ Exit-CompileScript
+}
+if ($All)
+{ $Unisim = $true
+ $Simprim = $true
+ $Unimacro = $true
+ $CoreLib = $true
+ $SecureIP = $true
+}
+
+function Get-XilinxISEDirectory
+{ if (Test-Path env:XILINX)
+ { return $XILINX + "\" + (Get-VendorToolSourceDirectory) }
+ else
+ { $EnvSourceDir = ""
+ foreach ($Drive in Get-PSDrive -PSProvider 'FileSystem')
+ { $Path = $Drive.Name + ":\" + "Xilinx"
+ if (Test-Path $Path -PathType Container)
+ { foreach ($Major in 14..12)
+ { foreach ($Minor in 7..1)
+ { $Dir = $Path + "\" + $Major + "." + $Minor + "\ISE_DS"
+ if (Test-Path $Dir -PathType Container)
+ { $EnvSourceDir = $Dir + "\" + (Get-VendorToolSourceDirectory)
+ return $EnvSourceDir
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+$SourceDirectory = Get-SourceDirectory $Source (Get-XilinxISEDirectory)
+$DestinationDirectory = Get-DestinationDirectory $Output
+$GHDLBinary = Get-GHDLBinary $GHDL
+
+# create "Altera" directory and change to it
+New-DestinationDirectory $DestinationDirectory
+cd $DestinationDirectory
+
+if ($VHDL2008)
+{ Write-Host "Not all Xilinx primitives are VHDL-2008 compatible! Setting HaltOnError to FALSE." -ForegroundColor Red
+ $HaltOnError = $false
+}
+$VHDLVersion,$VHDLStandard,$VHDLFlavor = Get-VHDLVariables $VHDL93 $VHDL2008
+
+# define global GHDL Options
+$Analyze_Parameters = @(
+ "-fexplicit",
+ "-frelaxed-rules",
+ "--mb-comments",
+ "-Wbinding"
+)
+if (-not $EnableDebug)
+{ $Analyze_Parameters += @(
+ "-Wno-hide"
+ )
+}
+if (-not ($EnableVerbose -or $EnableDebug))
+{ $Analyze_Parameters += @(
+ "-Wno-library",
+ "-Wno-others",
+ "-Wno-static"
+ )
+}
+$Analyze_Parameters += @(
+ "--ieee=$VHDLFlavor",
+ "--no-vital-checks",
+ "--std=$VHDLStandard",
+ "-P$DestinationDirectory"
+)
+
+# extract data from configuration
+# $SourceDir = $InstallationDirectory["AlteraQuartus"] + "\quartus\eda\sim_lib"
+
+$StopCompiling = $false
+$ErrorCount = 0
+
+
+# Cleanup directories
+# ==============================================================================
+if ($Clean)
+{ Write-Host "[ERROR]: '-Clean' is not implemented!" -ForegroundColor Red
+ Exit-CompileScript -1
+
+ Write-Host "Cleaning up vendor directory ..." -ForegroundColor Yellow
+ rm *.cf
+}
+
+
+# Library UniSim
+# ==============================================================================
+# compile unisim packages
+if ((-not $StopCompiling) -and $Unisim)
+{ $Library = "unisim"
+ $Files = @(
+ "unisims\unisim_VPKG.vhd",
+ "unisims\unisim_VCOMP.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# compile unisim primitives
+if ((-not $StopCompiling) -and $Unisim)
+{ $Library = "unisim"
+ $SourceFiles = dir "$SourceDirectory\unisims\primitive\*.vhd*"
+
+ $ErrorCount += Start-PrimitiveCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# compile unisim secureip primitives
+if ((-not $StopCompiling) -and $Unisim -and $SecureIP)
+{ $Library = "secureip"
+ $SourceFiles = dir "$SourceDirectory\unisims\secureip\*.vhd*"
+
+ $ErrorCount += Start-PrimitiveCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Library UNIMACRO
+# ==============================================================================
+# compile unimacro packages
+if ((-not $StopCompiling) -and $Unimacro)
+{ $Library = "unimacro"
+ $Files = @(
+ "unimacro\unimacro_VCOMP.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# compile unimacro macros
+if ((-not $StopCompiling) -and $Unimacro)
+{ $Library = "unimacro"
+ $SourceFiles = dir "$SourceDirectory\unimacro\*_MACRO.vhd*"
+
+ $ErrorCount += Start-PrimitiveCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Library SIMPRIM
+# ==============================================================================
+# compile simprim packages
+if ((-not $StopCompiling) -and $Simprim)
+{ $Library = "simprim"
+ $Files = (
+ "simprims\simprim_Vpackage.vhd",
+ "simprims\simprim_Vcomponents.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# compile simprim primitives
+if ((-not $StopCompiling) -and $Simprim)
+{ $Library = "simprim"
+ $SourceFiles = dir "$SourceDirectory\simprims\primitive\other\*.vhd*"
+
+ $ErrorCount += Start-PrimitiveCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# compile simprim secureip primitives
+if ((-not $StopCompiling) -and $Simprim -and $SecureIP)
+{ $Library = "secureip"
+ $SourceFiles = dir "$SourceDirectory\simprims\secureip\other\*.vhd*"
+
+ $ErrorCount += Start-PrimitiveCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Library XilinxCoreLib
+# ==============================================================================
+# compile CoreLib primitives
+if ((-not $StopCompiling) -and $CoreLib)
+{ $Library = "xilinxcorelib"
+
+ $AnalyzeFile = "$SourceDirectory\XilinxCoreLib\vhdl_analyze_order"
+ if (-not (Test-Path $AnalyzeFile -PathType Leaf))
+ { Write-Host "[ERROR]: Analyze file '$AnalyzeFile' not found!"
+ Exit-CompileScript -1
+ }
+
+ $AnalyzeOrder = Get-Content $AnalyzeFile -Encoding Ascii
+ $SourceFiles = @()
+ foreach ($line in $AnalyzeOrder)
+ { if (-not ($line.StartsWith("#") -or ($line -eq "")))
+ { $SourceFiles += "$SourceDirectory\XilinxCoreLib\$line" }
+ }
+
+ $ErrorCount += Start-PrimitiveCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+Write-Host "--------------------------------------------------------------------------------"
+Write-Host "Compiling Xilinx ISE libraries " -NoNewline
+if ($ErrorCount -gt 0)
+{ Write-Host "[FAILED]" -ForegroundColor Red }
+else
+{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green }
+
+Exit-CompileScript
diff --git a/scripts/vendors/compile-xilinx-ise.sh b/scripts/vendors/compile-xilinx-ise.sh
new file mode 100755
index 000000000..5ac581b28
--- /dev/null
+++ b/scripts/vendors/compile-xilinx-ise.sh
@@ -0,0 +1,389 @@
+#! /usr/bin/env bash
+# ==============================================================================
+# Authors:
+# Patrick Lehmann
+#
+# Bash Script (executable):
+# Script to compile the simulation libraries from Xilinx ISE for GHDL on
+# Linux
+#
+# Description:
+# - Creates a subdirectory in the current working directory
+# - Compiles all Xilinx ISE simulation libraries and packages
+#
+# ==============================================================================
+# Copyright (C) 2017-2021 Patrick Lehmann - Boetzingen, Germany
+# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany
+#
+# This program 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 Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <gnu.org/licenses>.
+# ==============================================================================
+
+# Work around for Darwin (Mac OS)
+test greadlink --version > /dev/null 2>&1 && READLINK=greadlink || READLINK=readlink
+
+# Save working directory
+WorkingDir=$(pwd)
+ScriptDir="$(dirname $0)"
+ScriptDir="$($READLINK -f $ScriptDir)"
+
+# 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
+COMMAND=1
+CLEAN=0
+COMPILE_UNISIM=0
+COMPILE_UNIMACRO=0
+COMPILE_SIMPRIM=0
+COMPILE_CORELIB=0
+COMPILE_SECUREIP=0
+VERBOSE=0
+DEBUG=0
+FILTERING=1
+SKIP_LARGE_FILES=0
+SUPPRESS_WARNINGS=0
+CONTINUE_ON_ERROR=1
+VHDLStandard=93
+GHDLBinDir=""
+DestDir=""
+SrcDir=""
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ -c|--clean)
+ COMMAND=3
+ CLEAN=1
+ ;;
+ -a|--all)
+ COMMAND=2
+ ;;
+ --unisim)
+ COMMAND=3
+ COMPILE_UNISIM=1
+ ;;
+ --unimacro)
+ COMMAND=3
+ COMPILE_UNIMACRO=1
+ ;;
+ --simprim)
+ COMMAND=3
+ COMPILE_SIMPRIM=1
+ ;;
+ --corelib)
+ COMMAND=3
+ COMPILE_CORELIB=1
+ ;;
+ --with-secureip)
+ COMPILE_SECUREIP=1
+ ;;
+ -S|--skip-largefiles)
+ SKIP_LARGE_FILES=1
+ ;;
+ --vhdl93)
+ VHDLStandard=93
+ ;;
+ --vhdl2008)
+ VHDLStandard=2008
+ ;;
+ -v|--verbose)
+ VERBOSE=1
+ ;;
+ -d|--debug)
+ VERBOSE=1
+ DEBUG=1
+ ;;
+ -h|--help)
+ COMMAND=0
+ break
+ ;;
+ -n|--no-filter)
+ FILTERING=0
+ ;;
+ -N|--no-warnings)
+ SUPPRESS_WARNINGS=1
+ ;;
+ -H|--halt-on-error)
+ CONTINUE_ON_ERROR=0
+ ;;
+ --ghdl)
+ 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 "\n${COLORED_ERROR} Unknown command line option '$1'.${ANSI_NOCOLOR}"
+ COMMAND=0
+ break
+ ;;
+ esac
+ shift # parsed argument or value
+done
+
+ERRORCOUNT=0
+Libraries=()
+
+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 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 " Use the adv. options or edit 'config.sh' to supply paths and default params."
+ echo ""
+ echo "Usage:"
+ echo " compile-xilinx-ise.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 Xilinx simulation libraries."
+ echo " --unisim Compile the unisim library."
+ echo " --unimacro Compile the unimacro library."
+ echo " --simprim Compile the simprim library."
+ echo " --corelib Compile the corelib library."
+ echo " --with-secureip Compile the secureip 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-largefiles Don't compile large files."
+ echo " -H --halt-on-error Halt on error(s)."
+ echo ""
+ echo "Advanced options:"
+ 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. ise"
+ echo " --source <Path to ISE> Path to the sources."
+ echo ""
+ echo "Verbosity:"
+ 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 $COMMAND
+fi
+
+if [[ $COMMAND -eq 2 ]]; then
+ COMPILE_UNISIM=1
+ COMPILE_UNIMACRO=1
+ COMPILE_SIMPRIM=1
+ COMPILE_CORELIB=1
+ COMPILE_SECUREIP=1
+fi
+
+
+# Source configuration file from GHDL's 'vendors' library directory
+echo -e "${ANSI_MAGENTA}Loading environment...${ANSI_NOCOLOR}"
+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
+
+# Warn that some files might not be VHDL-2008 ready. Thus enabled continue on error.
+if [[ $VHDLStandard -eq 2008 ]]; then
+ echo -e "${ANSI_RED}Not all Xilinx primitives are VHDL-2008 compatible! Setting CONTINUE_ON_ERROR to TRUE.${ANSI_NOCOLOR}"
+ CONTINUE_ON_ERROR=1
+fi
+
+# Search Xilinx ISE in default installation locations
+DefaultDirectories=("/opt/Xilinx" "/opt/xilinx" "/c/Xilinx")
+if [ ! -z $XILINX ]; then
+ EnvSourceDir="$XILINX/${Xilinx_ISE_Settings[SourceDirectory]}"
+else
+ for DefaultDir in "${DefaultDirectories[@]}"; do
+ for Major in 14 13; do
+ for Minor in 7 6 5 4 3 2 1 0; do
+ Dir=$DefaultDir/${Major}.${Minor}/ISE_DS
+ if [ -d $Dir ]; then
+ EnvSourceDir="$Dir/${Xilinx_ISE_Settings[SourceDirectory]}"
+ break 3
+ fi
+ done
+ done
+ done
+fi
+
+
+# <= $VHDLVersion
+# <= $VHDLStandard
+# <= $VHDLFlavor
+GHDLSetup $VHDLStandard
+
+# -> $SourceDirectories
+# -> $DestinationDirectories
+# -> $SrcDir
+# -> $EnvSourceDir
+# -> $DestDir
+# <= $SourceDirectory
+# <= $DestinationDirectory
+SetupDirectories Xilinx_ISE "Xilinx ISE"
+
+# create "xilinx-ise" directory and change to it
+# => $DestinationDirectory
+CreateDestinationDirectory
+cd $DestinationDirectory
+
+
+# Extend global GHDL Options TODO: move to GHDLSetup TODO: move to GHDLSetup
+Analyze_Parameters+=(
+ -fexplicit
+ -Wbinding
+)
+if [[ $DEBUG -eq 0 ]]; then
+ Analyze_Parameters+=(
+ -Wno-hide
+ )
+fi
+if [[ ! (VERBOSE -eq 1) && ($DEBUG -eq 1) ]]; then
+ Analyze_Parameters+=(
+ -Wno-others
+ -Wno-static
+ )
+fi
+Analyze_Parameters+=(
+ --ieee=$VHDLFlavor
+ --no-vital-checks
+ --std=$VHDLStandard
+ -frelaxed
+ -P$DestinationDirectory
+)
+
+# Cleanup directory
+# ==============================================================================
+if [[ $CLEAN -eq 1 ]]; then
+ echo 1>&2 -e "${COLORED_ERROR} '--clean' is not implemented!"
+ exit 1
+ echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_NOCOLOR}"
+ rm *.o 2> /dev/null
+ rm *.cf 2> /dev/null
+fi
+
+# Library unisim
+# ==============================================================================
+test $VERBOSE -eq 1 && echo -e " ${ANSI_GRAY}Reading compile order files...${ANSI_NOCOLOR}"
+
+# Reading unisim files
+StructName="UNISIM"
+Library="unisim"
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Reading compile order from '$SourceDirectory/${Library}s/primitive/vhdl_analyze_order'${ANSI_NOCOLOR}"
+Files=(
+ unisim_VPKG.vhd
+ unisim_VCOMP.vhd
+)
+while IFS= read -r File; do
+ Files+=("primitive/$File")
+done < <(grep --no-filename -R '^[a-zA-Z]' "$SourceDirectory/${Library}s/primitive/vhdl_analyze_order")
+
+CreateLibraryStruct $StructName $Library "${Library}s" $VHDLVersion "${Files[@]}"
+test $COMPILE_UNISIM -eq 1 && Libraries+=("$StructName")
+
+# Reading unisim secureip files
+StructName="UNISIM_SECUREIP"
+Library="unisim"
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Reading compile order from '$SourceDirectory/${Library}s/secureip/vhdl_analyze_order'${ANSI_NOCOLOR}"
+Files=()
+while IFS= read -r File; do
+ Files+=("secureip/$File")
+done < <(grep --no-filename -R '^[a-zA-Z]' "$SourceDirectory/${Library}s/secureip/vhdl_analyze_order")
+
+CreateLibraryStruct $StructName "secureip" "${Library}s" $VHDLVersion "${Files[@]}"
+test $COMPILE_UNISIM -eq 1 && test $COMPILE_SECUREIP -eq 1 && Libraries+=("$StructName")
+
+
+# Library unimacro
+# ==============================================================================
+# Reading unimacro files
+StructName="UNIMACRO"
+Library="unimacro"
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Scanning directory '$SourceDirectory/$Library/' for '*_MACRO.vhd'${ANSI_NOCOLOR}"
+Files=(
+ $Library/unimacro_VCOMP.vhd
+)
+Files=( $(cd $SourceDirectory/$Library; LC_COLLATE=C ls *_MACRO.vhd) )
+
+CreateLibraryStruct $StructName $Library $Library $VHDLVersion "${Files[@]}"
+test $COMPILE_UNIMACRO -eq 1 && Libraries+=("$StructName")
+
+
+# Library simprim
+# ==============================================================================
+# Reading simprim files
+StructName="SIMPRIM"
+Library="simprim"
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Reading compile order from '$SourceDirectory/${Library}s/primitive/other/vhdl_analyze_order'${ANSI_NOCOLOR}"
+Files=(
+ simprim_Vpackage.vhd
+ simprim_Vcomponents.vhd
+)
+# while IFS= read -r File; do
+ # Files+=("primitive/other/$File")
+# done < <(grep --no-filename -R '^[a-zA-Z]' "$SourceDirectory/${Library}s/primitive/other/vhdl_analyze_order")
+
+CreateLibraryStruct $StructName $Library "${Library}s" $VHDLVersion "${Files[@]}"
+test $COMPILE_SIMPRIM -eq 1 && Libraries+=("$StructName")
+
+
+# Reading simprim secureip files
+StructName="SIMPRIM_SECUREIP"
+Library="simprim"
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Reading compile order from '$SourceDirectory/${Library}s/secureip/other/vhdl_analyze_order'${ANSI_NOCOLOR}"
+Files=()
+while IFS= read -r File; do
+ Files+=("secureip/other/$File")
+done < <(grep --no-filename -R '^[a-zA-Z]' "$SourceDirectory/${Library}s/secureip/other/vhdl_analyze_order")
+
+CreateLibraryStruct $StructName "secureip" "${Library}s" $VHDLVersion "${Files[@]}"
+test $COMPILE_SIMPRIM -eq 1 && test $COMPILE_SECUREIP -eq 1 && Libraries+=("$StructName")
+
+
+# Library xilinxcorelib
+# ==============================================================================
+# Reading corelib files
+StructName="CORELIB"
+Library="xilinxcorelib"
+Files=()
+while IFS= read -r File; do
+ Files+=("$File")
+done < <(grep --no-filename -R '^[a-zA-Z]' "$SourceDirectory/XilinxCoreLib/vhdl_analyze_order")
+
+CreateLibraryStruct $StructName $Library "XilinxCoreLib" $VHDLVersion "${Files[@]}"
+test $COMPILE_CORELIB -eq 1 && Libraries+=("$StructName")
+
+if [[ $DEBUG -eq 1 ]]; then
+ for StructName in ${Libraries[*]}; do
+ PrintLibraryStruct $StructName " "
+ done
+fi
+
+# Compile libraries
+if [[ ${#Libraries[@]} -ne 0 ]]; then
+ Compile "$SourceDirectory" "${Libraries[*]}"
+
+ echo "--------------------------------------------------------------------------------"
+ echo -e "Compiling Xilinx ISE libraries $(test $ERRORCOUNT -eq 0 && echo $COLORED_SUCCESSFUL || echo $COLORED_FAILED)"
+else
+ echo -e "${ANSI_RED}No Xilinx ISE libraries selected.${ANSI_NOCOLOR}"
+fi
diff --git a/scripts/vendors/compile-xilinx-vivado.ps1 b/scripts/vendors/compile-xilinx-vivado.ps1
new file mode 100644
index 000000000..d0fb0698a
--- /dev/null
+++ b/scripts/vendors/compile-xilinx-vivado.ps1
@@ -0,0 +1,258 @@
+# ==============================================================================
+# Authors:
+# Patrick Lehmann
+#
+# ==============================================================================
+# Copyright (C) 2017-2021 Patrick Lehmann - Boetzingen, Germany
+# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany
+#
+# This program 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 Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <gnu.org/licenses>.
+# ==============================================================================
+
+# .SYNOPSIS
+# Script to compile the simulation libraries from Xilinx Vivado for GHDL on Windows.
+#
+# .DESCRIPTION
+# This CmdLet:
+# (1) creates a subdirectory in the current working directory
+# (2) compiles all Xilinx Vivado simulation libraries and packages
+# - unisim (incl. secureip)
+# - unimacro
+#
+[CmdletBinding()]
+param(
+ # Show the embedded help page(s)
+ [switch]$Help = $false,
+
+ # Compile all libraries and packages.
+ [switch]$All = $false,
+
+ # Compile the Xilinx simulation library.
+ [switch]$Unisim = $false,
+
+ # Compile the Xilinx macro library.
+ [switch]$Unimacro = $false,
+
+ # Compile the Xilinx secureip library.
+ [switch]$SecureIP = $false,
+
+ # Clean up directory before analyzing.
+ [switch]$Clean = $false,
+
+ # Set VHDL Standard to '93.
+ [switch]$VHDL93 = $false,
+ # Set VHDL Standard to '08.
+ [switch]$VHDL2008 = $false,
+
+ # Skip warning messages. (Show errors only.)
+ [switch]$SuppressWarnings = $false,
+ # Halt on errors.
+ [switch]$HaltOnError = $false,
+
+ # Set vendor library source directory.
+ [string]$Source = "",
+ # Set output directory name.
+ [string]$Output = "",
+ # Set GHDL binary directory.
+ [string]$GHDL = ""
+)
+
+# ---------------------------------------------
+# save working directory
+$WorkingDir = Get-Location
+
+# set default values
+$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"]
+$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug
+
+# load modules from GHDL's 'vendors' library directory
+$EnableVerbose -and (Write-Host "Loading modules..." -ForegroundColor Gray ) | Out-Null
+$EnableDebug -and (Write-Host " Import-Module $PSScriptRoot\config.psm1 -Verbose:`$$false -Debug:`$$false -ArgumentList `"XilinxVivado`"" -ForegroundColor DarkGray ) | Out-Null
+Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -ArgumentList "XilinxVivado"
+$EnableDebug -and (Write-Host " Import-Module $PSScriptRoot\shared.psm1 -Verbose:`$$false -Debug:`$$false -ArgumentList @(`"Xilinx Vivado`", `"$WorkingDir`")" -ForegroundColor DarkGray ) | Out-Null
+Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -ArgumentList @("Xilinx Vivado", "$WorkingDir")
+
+# Display help if no command was selected
+$Help = $Help -or (-not ($All -or $Unisim -or $Simprim -or $Unimacro))
+
+if ($Help)
+{ Get-Help $MYINVOCATION.MyCommand.Path -Detailed
+ Exit-CompileScript
+}
+if ($All)
+{ $Unisim = $true
+ $Simprim = $true
+ $Unimacro = $true
+ $SecureIP = $true
+}
+
+function Get-XilinxVivadoDirectory
+{ if (Test-Path env:XILINX_VIVADO)
+ { return $XILINX_VIVADO + "\" + (Get-VendorToolSourceDirectory) }
+ else
+ { $EnvSourceDir = ""
+ foreach ($Drive in Get-PSDrive -PSProvider 'FileSystem')
+ { $Path = $Drive.Name + ":\" + "Xilinx\Vivado"
+ if (Test-Path $Path -PathType Container)
+ { foreach ($Major in 2021..2014)
+ { foreach ($Minor in 4..1)
+ { $Dir = $Path + "\" + $Major + "." + $Minor
+ if (Test-Path $Dir -PathType Container)
+ { $EnvSourceDir = $Dir + "\" + (Get-VendorToolSourceDirectory)
+ return $EnvSourceDir
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+$SourceDirectory = Get-SourceDirectory $Source (Get-XilinxVivadoDirectory)
+$DestinationDirectory = Get-DestinationDirectory $Output
+$GHDLBinary = Get-GHDLBinary $GHDL
+
+# create "Altera" directory and change to it
+New-DestinationDirectory $DestinationDirectory
+cd $DestinationDirectory
+
+if ($VHDL2008)
+{ Write-Host "Not all Xilinx primitives are VHDL-2008 compatible! Setting HaltOnError to FALSE." -ForegroundColor Red
+ $HaltOnError = $false
+}
+$VHDLVersion,$VHDLStandard,$VHDLFlavor = Get-VHDLVariables $VHDL93 $VHDL2008
+
+# define global GHDL Options
+$Analyze_Parameters = @(
+ "-fexplicit",
+ "-frelaxed-rules",
+ "--mb-comments",
+ "-Wbinding"
+)
+if (-not $EnableDebug)
+{ $Analyze_Parameters += @(
+ "-Wno-hide"
+ )
+}
+if (-not ($EnableVerbose -or $EnableDebug))
+{ $Analyze_Parameters += @(
+ "-Wno-library",
+ "-Wno-others",
+ "-Wno-static"
+ )
+}
+$Analyze_Parameters += @(
+ "--ieee=$VHDLFlavor",
+ "--no-vital-checks",
+ "--std=$VHDLStandard",
+ "-P$DestinationDirectory"
+)
+
+# extract data from configuration
+# $SourceDir = $InstallationDirectory["AlteraQuartus"] + "\quartus\eda\sim_lib"
+
+$StopCompiling = $false
+$ErrorCount = 0
+
+
+# Cleanup directories
+# ==============================================================================
+if ($Clean)
+{ Write-Host "[ERROR]: '-Clean' is not implemented!" -ForegroundColor Red
+ Exit-CompileScript -1
+
+ Write-Host "Cleaning up vendor directory ..." -ForegroundColor Yellow
+ rm *.cf
+}
+
+
+# Library UNISIM
+# ==============================================================================
+# compile unisim packages
+if ((-not $StopCompiling) -and $Unisim)
+{ $Library = "unisim"
+ $Files = @(
+ "unisims\unisim_VPKG.vhd",
+ "unisims\unisim_VCOMP.vhd",
+ "unisims\retarget_VCOMP.vhd",
+ "unisims\unisim_retarget_VCOMP.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# compile unisim primitives
+if ((-not $StopCompiling) -and $Unisim)
+{ $Library = "unisim"
+ $SourceFiles = dir "$SourceDirectory\unisims\primitive\*.vhd*"
+
+ $ErrorCount += Start-PrimitiveCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# compile unisim retarget primitives
+if ((-not $StopCompiling) -and $Unisim)
+{ $Library = "unisim"
+ $SourceFiles = dir "$SourceDirectory\unisims\retarget\*.vhd*"
+
+ $ErrorCount += Start-PrimitiveCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# compile unisim secureip primitives
+if ((-not $StopCompiling) -and $Unisim -and $SecureIP)
+{ $Library = "secureip"
+ $SourceFiles = dir "$SourceDirectory\unisims\secureip\*.vhd*"
+
+ $ErrorCount += Start-PrimitiveCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Library UNIMACRO
+# ==============================================================================
+# compile unimacro packages
+if ((-not $StopCompiling) -and $Unimacro)
+{ $Library = "unimacro"
+ $Files = @(
+ "unimacro\unimacro_VCOMP.vhd"
+ )
+ $SourceFiles = $Files | % { "$SourceDirectory\$_" }
+
+ $ErrorCount += Start-PackageCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# compile unimacro macros
+if ((-not $StopCompiling) -and $Unimacro)
+{ $Library = "unimacro"
+ $SourceFiles = dir "$SourceDirectory\unimacro\*_MACRO.vhd*"
+
+ $ErrorCount += Start-PrimitiveCompilation $GHDLBinary $Analyze_Parameters $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+}
+
+# Library UNIFAST
+# ==============================================================================
+# TODO:
+
+Write-Host "--------------------------------------------------------------------------------"
+Write-Host "Compiling Xilinx Vivado libraries " -NoNewline
+if ($ErrorCount -gt 0)
+{ Write-Host "[FAILED]" -ForegroundColor Red }
+else
+{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green }
+
+Exit-CompileScript
diff --git a/scripts/vendors/compile-xilinx-vivado.sh b/scripts/vendors/compile-xilinx-vivado.sh
new file mode 100755
index 000000000..203a5c35f
--- /dev/null
+++ b/scripts/vendors/compile-xilinx-vivado.sh
@@ -0,0 +1,359 @@
+#! /usr/bin/env bash
+# ==============================================================================
+# Authors:
+# Patrick Lehmann
+#
+# Bash Script (executable):
+# Script to compile the simulation libraries from Xilinx Vivado for GHDL on
+# Linux
+#
+# Description:
+# - Creates a subdirectory in the current working directory
+# - Compiles all Xilinx Vivado simulation libraries and packages
+#
+# ==============================================================================
+# Copyright (C) 2017-2021 Patrick Lehmann - Boetzingen, Germany
+# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany
+#
+# This program 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 Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <gnu.org/licenses>.
+# ==============================================================================
+
+# Work around for Darwin (Mac OS)
+test greadlink --version > /dev/null 2>&1 && READLINK=greadlink || READLINK=readlink
+
+# Save working directory
+WorkingDir=$(pwd)
+ScriptDir="$(dirname $0)"
+ScriptDir="$($READLINK -f $ScriptDir)"
+
+# 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
+COMMAND=1
+CLEAN=0
+COMPILE_UNISIM=0
+COMPILE_UNIMACRO=0
+COMPILE_UNIFAST=0
+COMPILE_SECUREIP=0
+VERBOSE=0
+DEBUG=0
+FILTERING=1
+SKIP_LARGE_FILES=0
+SUPPRESS_WARNINGS=0
+CONTINUE_ON_ERROR=0
+VHDLStandard=93
+GHDLBinDir=""
+DestDir=""
+SrcDir=""
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ -c|--clean)
+ COMMAND=3
+ CLEAN=1
+ ;;
+ -a|--all)
+ COMMAND=2
+ ;;
+ --unisim)
+ COMMAND=3
+ COMPILE_UNISIM=1
+ ;;
+ --unimacro)
+ COMMAND=3
+ COMPILE_UNIMACRO=1
+ ;;
+ --unifast)
+ COMMAND=3
+ COMPILE_UNIFAST=1
+ ;;
+ --with-secureip)
+ COMPILE_SECUREIP=1
+ ;;
+ -S|--skip-largefiles)
+ SKIP_LARGE_FILES=1
+ ;;
+ --vhdl93)
+ VHDLStandard=93
+ ;;
+ --vhdl2008)
+ VHDLStandard=2008
+ ;;
+ -v|--verbose)
+ VERBOSE=1
+ ;;
+ -d|--debug)
+ VERBOSE=1
+ DEBUG=1
+ ;;
+ -h|--help)
+ COMMAND=0
+ break
+ ;;
+ -n|--no-filter)
+ FILTERING=0
+ ;;
+ -N|--no-warnings)
+ SUPPRESS_WARNINGS=1
+ ;;
+ -H|--halt-on-error)
+ CONTINUE_ON_ERROR=1
+ ;;
+ --ghdl)
+ 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 "\n${COLORED_ERROR} Unknown command line option '$1'.${ANSI_NOCOLOR}"
+ COMMAND=0
+ break
+ ;;
+ esac
+ shift # parsed argument or value
+done
+
+ERRORCOUNT=0
+Libraries=()
+
+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 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 " Use the adv. options or edit 'config.sh' to supply paths and default params."
+ echo ""
+ echo "Usage:"
+ echo " compile-xilinx-vivado.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 Xilinx simulation libraries."
+ echo " --unisim Compile the unisim library."
+ echo " --unimacro Compile the unimacro library."
+ echo " --unifast Compile the unifast library."
+ echo " --with-secureip Compile the secureip 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-largefiles Don't compile large files."
+ echo " -H --halt-on-error Halt on error(s)."
+ echo ""
+ echo "Advanced options:"
+ 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. vivado"
+ echo " --source <Path to Vivado> Path to the sources."
+ echo ""
+ echo "Verbosity:"
+ 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 $COMMAND
+fi
+
+if [[ $COMMAND -eq 2 ]]; then
+ COMPILE_UNISIM=1
+ COMPILE_UNIMACRO=1
+ COMPILE_UNIFAST=1
+ COMPILE_SECUREIP=1
+fi
+
+
+# Source configuration file from GHDL's 'vendors' library directory
+echo -e "${ANSI_MAGENTA}Loading environment...${ANSI_NOCOLOR}"
+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
+
+# Warn that some files might not be VHDL-2008 ready. Thus enabled continue on error.
+if [[ $VHDLStandard -eq 2008 ]]; then
+ echo -e "${ANSI_RED}Not all Xilinx primitives are VHDL-2008 compatible! Setting CONTINUE_ON_ERROR to TRUE.${ANSI_NOCOLOR}"
+ CONTINUE_ON_ERROR=1
+fi
+
+# Search Xilinx Vivado in default installation locations
+DefaultDirectories=("/opt/Xilinx/Vivado" "/opt/xilinx/Vivado" "/c/Xilinx/Vivado")
+if [ ! -z $XILINX_VIVADO ]; then
+ EnvSourceDir="$XILINX_VIVADO/${Xilinx_Vivado_Settings[SourceDirectory]}"
+else
+ for DefaultDir in "${DefaultDirectories[@]}"; do
+ for Major in 2021 2020 2019 2018 2017 2016 2015 2014; do
+ for Minor in 4 3 2 1; do
+ Dir=$DefaultDir/${Major}.${Minor}
+ if [ -d $Dir ]; then
+ EnvSourceDir="$Dir/${Xilinx_Vivado_Settings[SourceDirectory]}"
+ break 3
+ fi
+ done
+ done
+ done
+fi
+
+
+# <= $VHDLVersion
+# <= $VHDLStandard
+# <= $VHDLFlavor
+GHDLSetup $VHDLStandard
+
+# -> $SourceDirectories
+# -> $DestinationDirectories
+# -> $SrcDir
+# -> $EnvSourceDir
+# -> $DestDir
+# <= $SourceDirectory
+# <= $DestinationDirectory
+SetupDirectories Xilinx_Vivado "Xilinx Vivado"
+
+# create "xilinx-vivado" directory and change to it
+# => $DestinationDirectory
+CreateDestinationDirectory
+cd $DestinationDirectory
+
+
+# Extend global GHDL Options TODO: move to GHDLSetup
+Analyze_Parameters+=(
+ -fexplicit
+ -Wbinding
+)
+if [[ $DEBUG -eq 0 ]]; then
+ Analyze_Parameters+=(
+ -Wno-hide
+ )
+fi
+if [[ ! (VERBOSE -eq 1) && ($DEBUG -eq 1) ]]; then
+ Analyze_Parameters+=(
+ -Wno-others
+ -Wno-static
+ )
+fi
+Analyze_Parameters+=(
+ --ieee=$VHDLFlavor
+ --no-vital-checks
+ --std=$VHDLStandard
+ -frelaxed
+ -P$DestinationDirectory
+)
+
+# Cleanup directory
+# ==============================================================================
+if [[ $CLEAN -eq 1 ]]; then
+ echo 1>&2 -e "${COLORED_ERROR} '--clean' is not implemented!"
+ exit 1
+ echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_NOCOLOR}"
+ rm *.o 2> /dev/null
+ rm *.cf 2> /dev/null
+fi
+
+# Library unisim
+# ==============================================================================
+test $VERBOSE -eq 1 && echo -e " ${ANSI_GRAY}Reading compile order files...${ANSI_NOCOLOR}"
+
+# Reading unisim files
+StructName="UNISIM"
+Library="unisim"
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Reading compile order from '$SourceDirectory/${Library}s/primitive/vhdl_analyze_order'${ANSI_NOCOLOR}"
+Files=(
+ unisim_VPKG.vhd
+ unisim_retarget_VCOMP.vhd
+)
+while IFS= read -r File; do
+ Files+=("primitive/$File")
+done < <(grep --no-filename -R '^[a-zA-Z]' "$SourceDirectory/${Library}s/primitive/vhdl_analyze_order")
+
+# Reading unisim retarget files
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Reading compile order from '$SourceDirectory/${Library}s/retarget/vhdl_analyze_order'${ANSI_NOCOLOR}"
+while IFS= read -r File; do
+ Files+=("retarget/$File")
+done < <(grep --no-filename -R '^[a-zA-Z]' "$SourceDirectory/${Library}s/retarget/vhdl_analyze_order")
+
+CreateLibraryStruct $StructName $Library "${Library}s" $VHDLVersion "${Files[@]}"
+test $COMPILE_UNISIM -eq 1 && Libraries+=("$StructName")
+
+# Reading unisim secureip files
+StructName="UNISIM_SECUREIP"
+Library="unisim"
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Scanning directory '$SourceDirectory/${Library}s/secureip' for '*.vhd'${ANSI_NOCOLOR}"
+Files=( $(cd $SourceDirectory/${Library}s/secureip; LC_COLLATE=C ls *.vhd) )
+
+CreateLibraryStruct $StructName "secureip" "${Library}s/secureip" $VHDLVersion "${Files[@]}"
+test $COMPILE_UNISIM -eq 1 && test $COMPILE_SECUREIP -eq 1 && Libraries+=("$StructName")
+
+
+# Library unimacro
+# ==============================================================================
+# Reading unimacro files
+StructName="UNIMACRO"
+Library="unimacro"
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Scanning directory '$SourceDirectory/$Library/' for '*_MACRO.vhd'${ANSI_NOCOLOR}"
+Files=(
+ unimacro_VCOMP.vhd
+)
+while IFS= read -r File; do
+ Files+=("$File")
+done < <(grep --no-filename -R '^[a-zA-Z]' "$SourceDirectory/$Library/vhdl_analyze_order")
+
+CreateLibraryStruct $StructName $Library $Library $VHDLVersion "${Files[@]}"
+test $COMPILE_UNIMACRO -eq 1 && Libraries+=("$StructName")
+
+# Library unifast
+# ==============================================================================
+StructName="UNIFAST"
+Library="unifast"
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Reading compile order from '$SourceDirectory/$Library/primitive/vhdl_analyze_order'${ANSI_NOCOLOR}"
+Files=()
+while IFS= read -r File; do
+ Files+=("$File")
+done < <(grep --no-filename -R '^[a-zA-Z]' "$SourceDirectory/$Library/primitive/vhdl_analyze_order")
+
+CreateLibraryStruct $StructName $Library "$Library/primitive" $VHDLVersion "${Files[@]}"
+test $COMPILE_UNIFAST -eq 1 && Libraries+=("$StructName")
+
+# Reading unifast secureip files
+StructName="UNIFAST_SECUREIP"
+Library="unifast"
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Scanning directory '$SourceDirectory/$Library/secureip' for '*.vhd'${ANSI_NOCOLOR}"
+Files=( $(cd $SourceDirectory/$Library/secureip; LC_COLLATE=C ls *.vhd) )
+
+CreateLibraryStruct $StructName "secureip" "$Library/secureip" $VHDLVersion "${Files[@]}"
+test $COMPILE_UNIFAST -eq 1 && test $COMPILE_SECUREIP -eq 1 && Libraries+=("$StructName")
+
+
+# Compile libraries
+if [[ ${#Libraries[@]} -ne 0 ]]; then
+ Compile "$SourceDirectory" "${Libraries[*]}"
+
+ echo "--------------------------------------------------------------------------------"
+ echo -e "Compiling Xilinx Vivado libraries $(test $ERRORCOUNT -eq 0 && echo $COLORED_SUCCESSFUL || echo $COLORED_FAILED)"
+else
+ echo -e "${ANSI_RED}No Xilinx Vivado libraries selected.${ANSI_NOCOLOR}"
+fi
diff --git a/scripts/vendors/config.psm1 b/scripts/vendors/config.psm1
new file mode 100644
index 000000000..a58b2c4a1
--- /dev/null
+++ b/scripts/vendors/config.psm1
@@ -0,0 +1,113 @@
+# ==============================================================================
+# Authors:
+# Patrick Lehmann
+#
+# ==============================================================================
+# Copyright (C) 2017-2021 Patrick Lehmann - Boetzingen, Germany
+# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany
+#
+# This program 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 Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <gnu.org/licenses>.
+# ==============================================================================
+
+# .SYNOPSIS
+# Configuration files to store settings and installation directories for 3rd party tools..
+#
+# .DESCRIPTION
+# This configuaration file stores settings for pre-compile scripts, so scripts
+# can be called with less command line arguments.
+#
+[CmdletBinding()]
+param(
+ [Parameter(Mandatory=$true)][string]$VendorToolName
+)
+
+$Module_VendorToolName = $VendorToolName
+
+# Configure your tools here. Use absolute paths, without trailing directory
+# delimiter. Empty strings indicate not installed tools
+$Settings = @{
+ "AlteraQuartus" = @{
+ "InstallationDirectory" = ""; # "C:\Altera\16.0\quartus";
+ "SourceDirectory" = "eda\sim_lib";
+ "DestinationDirectory" = "altera"
+ };
+ "IntelQuartus" = @{
+ "InstallationDirectory" = ""; # "C:\IntelFPGA\20.1\quartus";
+ "SourceDirectory" = "eda\sim_lib";
+ "DestinationDirectory" = "intel"
+ };
+ "LatticeDiamond" = @{
+ "InstallationDirectory" = ""; # "C:\Lattice\Diamond\3.10_x64";
+ "SourceDirectory" = "cae_library\simulation\vhdl";
+ "DestinationDirectory" = "lattice"
+ };
+ "OSVVM" = @{
+ "InstallationDirectory" = ""; # "C:\git\GitHub\OSVVM";
+ "SourceDirectory" = ".";
+ "DestinationDirectory" = "."
+ };
+ "UVVM" = @{
+ "InstallationDirectory" = ""; # "C:\git\GitHub\UVVM";
+ "SourceDirectory" = ".";
+ "DestinationDirectory" = "."
+ };
+ "XilinxISE" = @{
+ "InstallationDirectory" = ""; # "C:\Xilinx\14.7\ISE_DS";
+ "SourceDirectory" = "ISE\vhdl\src";
+ "DestinationDirectory" = "xilinx-ise"
+ };
+ "XilinxVivado" = @{
+ "InstallationDirectory" = ""; # "C:\Xilinx\Vivado\2020.2";
+ "SourceDirectory" = "data\vhdl\src";
+ "DestinationDirectory" = "xilinx-vivado"
+ }
+}
+
+
+function Get-VendorToolInstallationDirectory
+{ <#
+ .SYNOPSIS
+ Undocumented
+
+ .DESCRIPTION
+ Undocumented
+ #>
+ return $Settings[$Module_VendorToolName]["InstallationDirectory"]
+}
+
+function Get-VendorToolSourceDirectory
+{ <#
+ .SYNOPSIS
+ Undocumented
+
+ .DESCRIPTION
+ Undocumented
+ #>
+ return $Settings[$Module_VendorToolName]["SourceDirectory"]
+}
+
+function Get-VendorToolDestinationDirectory
+{ <#
+ .SYNOPSIS
+ Undocumented
+
+ .DESCRIPTION
+ Undocumented
+ #>
+ return $Settings[$Module_VendorToolName]["DestinationDirectory"]
+}
+
+Export-ModuleMember -Function 'Get-VendorToolInstallationDirectory'
+Export-ModuleMember -Function 'Get-VendorToolSourceDirectory'
+Export-ModuleMember -Function 'Get-VendorToolDestinationDirectory'
diff --git a/scripts/vendors/config.sh b/scripts/vendors/config.sh
new file mode 100755
index 000000000..0331e0cc7
--- /dev/null
+++ b/scripts/vendors/config.sh
@@ -0,0 +1,84 @@
+# ==============================================================================
+# Authors:
+# Patrick Lehmann
+#
+# Bash Script: Configurable directories to local installed tools
+#
+# Description:
+# ------------------------------------
+# This Bash file exports variables containing the users local tool environment.
+#
+# ==============================================================================
+# Copyright (C) 2017-2021 Patrick Lehmann - Boetzingen, Germany
+# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany
+#
+# This program 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 Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <gnu.org/licenses>.
+# ==============================================================================
+
+# Configure
+# - Vendor tool chain installation paths or
+# - Library root directories
+# in the following dictionaries.
+#
+# These values are used if no command line argument (--source, --output) is
+# passed to a compile script. An empty 'InstallationDirectory' string means not
+# configured. Declare source directories depending on the installation paths of
+# the 3rd party tools. Configure preferred output directories for each library
+# set.
+#
+declare -A Altera_Quartus_Settings=(
+ ["InstallationDirectory"]="" # "/opt/altera/16.0/quartus"
+ ["SourceDirectory"]="eda/sim_lib"
+ ["DestinationDirectory"]="altera"
+)
+
+declare -A Intel_Quartus_Settings=(
+ ["InstallationDirectory"]="" # "/opt/intelFPGA/20.1/quartus"
+ ["SourceDirectory"]="eda/sim_lib"
+ ["DestinationDirectory"]="intel"
+)
+
+declare -A Lattice_Diamond_Settings=(
+ ["InstallationDirectory"]="" # "/usr/local/diamond/3.10_x64"
+ ["SourceDirectory"]="cae_library/simulation/vhdl"
+ ["DestinationDirectory"]="lattice"
+)
+
+declare -A OSVVM_Settings=(
+ ["InstallationDirectory"]="" # "~/git/github/OSVVM"
+ ["SourceDirectory"]="."
+ ["DestinationDirectory"]="."
+)
+
+declare -A UVVM_Settings=(
+ ["InstallationDirectory"]="" # "~/git/github/UVVM"
+ ["SourceDirectory"]="."
+ ["DestinationDirectory"]="."
+)
+
+declare -A Xilinx_ISE_Settings=(
+ ["InstallationDirectory"]="" # "/opt/Xilinx/14.7/ISE_DS"
+ ["SourceDirectory"]="ISE/vhdl/src"
+ ["DestinationDirectory"]="xilinx-ise"
+)
+
+declare -A Xilinx_Vivado_Settings=(
+ ["InstallationDirectory"]="" # "/opt/Xilinx/Vivado/2020.2"
+ ["SourceDirectory"]="data/vhdl/src"
+ ["DestinationDirectory"]="xilinx-vivado"
+)
+
+
+# input files greater than $LARGE_FILESIZE are skipped if '--skip-largefiles' is set
+LARGE_FILESIZE=125000
diff --git a/scripts/vendors/filter.analyze.sh b/scripts/vendors/filter.analyze.sh
new file mode 100644
index 000000000..dfb99eaa9
--- /dev/null
+++ b/scripts/vendors/filter.analyze.sh
@@ -0,0 +1,143 @@
+#! /usr/bin/env bash
+# ==============================================================================
+# Authors:
+# Patrick Lehmann
+#
+# Bash Script: STDOUT Post-Processor for GHDL analyze (-a)
+#
+# Description:
+# ------------------------------------
+# This is a Bash script (executable) which:
+# - creates a subdirectory in the current working directory
+# - compiles all OSVVM packages
+#
+# ==============================================================================
+# Copyright (C) 2017-2021 Patrick Lehmann - Boetzingen, Germany
+# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany
+#
+# This program 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 Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <gnu.org/licenses>.
+# ==============================================================================
+
+# work around for Darwin (Mac OS)
+test greadlink --version > /dev/null 2>&1 && READLINK=greadlink || READLINK=readlink
+
+# Save working directory
+WorkingDir=$(pwd)
+ScriptDir="$($READLINK -f $(dirname $0))"
+RootDir="$($READLINK -f $ScriptDir/..)"
+
+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
+COMMAND=2
+INDENT=""
+VERBOSE=0
+DEBUG=0
+while [[ $# > 0 ]]; do
+ key="$1"
+ case $key in
+ -i|--indent)
+ shift
+ INDENT=$1
+ ;;
+ -v|--verbose)
+ VERBOSE=1
+ ;;
+ -d|--debug)
+ VERBOSE=1
+ DEBUG=1
+ ;;
+ -h|--help)
+ COMMAND=0
+ ;;
+ *) # unknown option
+ echo 1>&2 -e "${COLORED_ERROR} Unknown command line option '$key'.${ANSI_NOCOLOR}"
+ COMMAND=1
+ ;;
+ esac
+ shift # past argument or value
+done
+
+if [ $COMMAND -le 1 ]; then
+ echo ""
+ echo "Synopsis:"
+ echo " Script to filter GHDL analyze (-a) outputs."
+ echo ""
+ echo "Usage:"
+ echo " filter.analyze.sh [-v][-d] [--help] [--indent <pattern>]"
+ echo ""
+ echo "Common commands:"
+ echo " -h --help Print this help page."
+ echo ""
+ echo "Common options:"
+ echo " -v --verbose Print verbose messages."
+ echo " -d --debug Print debug messages."
+ echo " -i --indent <pattern> Indent all lines by this pattern."
+ echo ""
+ exit $COMMAND
+fi
+
+
+# States
+ST_Common=1
+ST_Exception=2
+
+# Current state
+State=0
+
+# Counters
+Counter_Warning=0
+Counter_Error=0
+Counter_Fatal=0
+
+while read -r line
+do
+ line=${line//\\//}
+ case $State in
+ 0|$ST_Common)
+ if [[ $line = *"ghdl1-llvm"* ]]; then
+ echo -e "$INDENT${ANSI_DARK_GRAY}$line${ANSI_NOCOLOR}"
+ elif [[ $line = *":"*":"*":warning: "* ]]; then
+ let Counter_Warning++
+ echo -e "$INDENT${ANSI_YELLOW}WARNING:${ANSI_NOCOLOR} $line"
+ elif [[ $line = *":"*":"*":note: "* ]]; then
+ echo -e "$INDENT${ANSI_CYAN}NOTE:${ANSI_NOCOLOR} $line"
+ elif [[ $line = *":"*":"*": "* ]]; then
+ let Counter_Error++
+ echo -e "$INDENT${ANSI_RED}ERROR:${ANSI_NOCOLOR} $line"
+ elif [[ $line = *"compilation error"* ]]; then
+ echo -e "$INDENT${ANSI_RED}FATAL:${ANSI_NOCOLOR} $line"
+ elif [[ ${line:0:66} == "******************** GHDL Bug occurred ***************************" ]]; then
+ State=$ST_Exception
+ Counter_Fatal=1
+ echo -e "$INDENT${ANSI_MAGENTA}$line${ANSI_NOCOLOR}"
+ else
+ if [[ $(printf '%d\n' "'$line") == "13" ]]; then
+ echo ""
+ else
+ echo -e "${ANSI_RED}SCRIPT ERROR: Unfiltered line${ANSI_NOCOLOR}\n$line"
+ fi
+ fi
+ ;;
+ $ST_Exception)
+ echo -e "$INDENT${ANSI_MAGENTA}$line${ANSI_NOCOLOR}"
+ if [[ ${line:0:66} == "******************************************************************" ]]; then
+ State=$ST_Common
+ fi
+ ;;
+ esac
+done < "/dev/stdin"
+
+exit $(( ( $Counter_Fatal != 0 ? $Counter_Fatal*4+3 : ( $Counter_Error != 0 ? $Counter_Error*4+2 : ( $Counter_Warning != 0 ? $Counter_Warning*4+1 : 0 ))) ))
diff --git a/scripts/vendors/shared.psm1 b/scripts/vendors/shared.psm1
new file mode 100644
index 000000000..eb3c4c037
--- /dev/null
+++ b/scripts/vendors/shared.psm1
@@ -0,0 +1,510 @@
+# ==============================================================================
+# Authors: Patrick Lehmann
+#
+# ==============================================================================
+# Copyright (C) 2017-2021 Patrick Lehmann - Boetzingen, Germany
+# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany
+#
+# This program 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 Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <gnu.org/licenses>.
+# ==============================================================================
+
+# .SYNOPSIS
+# This module provides common CmdLets for the library pre-compilation process.
+#
+# .DESCRIPTION
+# This PowerShell module provides CommandLets (CmdLets) to handle the 'ghdl.exe'
+# output streams (stdout and stderr).
+#
+[CmdletBinding()]
+param(
+ [Parameter(Mandatory=$true)][string]$VendorToolName,
+ [Parameter(Mandatory=$true)][string]$WorkingDir
+)
+
+$Module_VendorToolName = $VendorToolName
+$Module_WorkingDir = $WorkingDir
+
+function Exit-CompileScript
+{ <#
+ .SYNOPSIS
+ Undocumented
+
+ .DESCRIPTION
+ Undocumented
+
+ .PARAMETER ExitCode
+ ExitCode of this script run
+ #>
+ [CmdletBinding()]
+ param(
+ [int]$ExitCode = 0
+ )
+
+ cd $Module_WorkingDir
+
+ # unload modules
+ Remove-Module config -Verbose:$false
+ Remove-Module shared -Verbose:$false
+
+ exit $ExitCode
+}
+
+function Get-SourceDirectory
+{ <#
+ .SYNOPSIS
+ Undocumented
+
+ .DESCRIPTION
+ Undocumented
+
+ .PARAMETER Source
+ Undocumented
+ .PARAMETER EnvSource
+ Undocumented
+ #>
+ [CmdletBinding()]
+ param(
+ [string]$Source,
+ [string]$EnvSource
+ )
+
+ $VendorToolInstallationDirectory = Get-VendorToolInstallationDirectory
+ $VendorToolSourceDirectory = Get-VendorToolSourceDirectory
+
+ if ($Source -ne "")
+ { $SourceDirectory = $Source.TrimEnd("\") }
+ elseif ($EnvSource -ne "")
+ { $SourceDirectory = $EnvSource }
+ elseif ($VendorToolInstallationDirectory -ne "")
+ { $SourceDirectory = $VendorToolInstallationDirectory + "\" + $VendorToolSourceDirectory }
+ else
+ { Write-Host "[ERROR]: $Module_VendorToolName is not configured in '$ScriptDir\config.psm1'." -ForegroundColor Red
+ Write-Host " Use adv. options '-Source' and '-Output' or configure 'config.psm1'." -ForegroundColor Red
+ Exit-CompileScript -1
+ }
+
+ if (-not (Test-Path $SourceDirectory -PathType Container))
+ { Write-Host "[ERROR]: Path '$SourceDirectory' does not exist." -ForegroundColor Red
+ Exit-CompileScript -1
+ }
+
+ return Convert-Path (Resolve-Path $SourceDirectory)
+}
+
+function Get-DestinationDirectory
+{ <#
+ .SYNOPSIS
+ Undocumented
+
+ .DESCRIPTION
+ Undocumented
+
+ .PARAMETER Output
+ Undocumented
+ #>
+ [CmdletBinding()]
+ param(
+ [string]$Output
+ )
+ if ($Output -ne "")
+ { $DestinationDirectory = $Output.TrimEnd("\") }
+ else
+ { $DestinationDirectory = Get-VendorToolDestinationDirectory }
+
+ if ($DestinationDirectory -eq "")
+ { Write-Host "[ERROR]: $Module_VendorToolName is not configured in '$ScriptDir\config.psm1'." -ForegroundColor Red
+ Write-Host " Use adv. options '-Source' and '-Output' or configure 'config.psm1'." -ForegroundColor Red
+ Exit-CompileScript -1
+ }
+
+ if (-not [System.IO.Path]::IsPathRooted($DestinationDirectory))
+ { $DestinationDirectory = "$Module_WorkingDir\$DestinationDirectory" }
+
+ return $DestinationDirectory
+}
+
+function Get-GHDLBinary
+{ <#
+ .SYNOPSIS
+ Undocumented
+
+ .DESCRIPTION
+ Undocumented
+
+ .PARAMETER GHDL
+ Undocumented
+ #>
+ [CmdletBinding()]
+ param(
+ [string]$GHDL
+ )
+
+ if ($GHDL -ne "")
+ { $GHDLBinary = $GHDL }
+ elseif (Test-Path env:GHDL)
+ { $GHDLBinary = $env:GHDL }
+ else
+ { try
+ { write-host "calling which ..."
+ $GHDLBinary = (Get-Command "ghdl.exe").Source }
+ catch
+ { Write-Host "Use adv. options '-GHDL' to set the GHDL executable." -ForegroundColor Red
+ Exit-CompileScript -1
+ }
+ }
+
+ if (-not (Test-Path $GHDLBinary -PathType Leaf))
+ { Write-Host "Use adv. options '-GHDL' to set the GHDL executable." -ForegroundColor Red
+ Exit-CompileScript -1
+ }
+
+ return $GHDLBinary
+}
+
+
+function Get-VHDLVariables
+{ <#
+ .SYNOPSIS
+ Undocumented
+
+ .DESCRIPTION
+ Undocumented
+
+ .PARAMETER VHDL93
+ Undocumented
+ .PARAMETER VHDL2008
+ Undocumented
+ #>
+ [CmdletBinding()]
+ param(
+ [switch]$VHDL93 = $false,
+ [switch]$VHDL2008 = $true
+ )
+
+ if ($VHDL93)
+ { $VHDLVersion = "v93"
+ $VHDLStandard = "93c"
+ $VHDLFlavor = "synopsys"
+ }
+ elseif ($VHDL2008)
+ { $VHDLVersion = "v08"
+ $VHDLStandard = "08"
+ $VHDLFlavor = "synopsys"
+ }
+ else
+ { $VHDLVersion = "v93"
+ $VHDLStandard = "93c"
+ $VHDLFlavor = "synopsys"
+ }
+ return $VHDLVersion,$VHDLStandard,$VHDLFlavor
+}
+
+function New-DestinationDirectory
+{ <#
+ .SYNOPSIS
+ Undocumented
+
+ .DESCRIPTION
+ Undocumented
+
+ .PARAMETER DestinationDirectory
+ Undocumented
+ #>
+ [CmdletBinding()]
+ param(
+ [Parameter(Mandatory=$true)][string]$DestinationDirectory
+ )
+
+ if (Test-Path $DestinationDirectory -PathType Container)
+ { Write-Host "Vendor directory '$DestinationDirectory' already exists." -ForegroundColor Yellow }
+ elseif (Test-Path $DestinationDirectory -PathType Leaf)
+ { Write-Host "[ERROR]: Vendor directory '$DestinationDirectory' already exists as a file." -ForegroundColor Red
+ Exit-CompileScript -1
+ }
+ else
+ { Write-Host "Creating vendor directory: '$DestinationDirectory'." -ForegroundColor Yellow
+ mkdir "$DestinationDirectory" -ErrorAction SilentlyContinue | Out-Null
+ }
+}
+
+function Start-PackageCompilation
+{ <#
+ .SYNOPSIS
+ Undocumented
+
+ .DESCRIPTION
+ Undocumented
+
+ .PARAMETER GHDLBinary
+ Undocumented
+ .PARAMETER GHDLOptions
+ Undocumented
+ .PARAMETER Library
+ Undocumented
+ .PARAMETER SourceFiles
+ Undocumented
+ .PARAMETER HaltOnError
+ Undocumented
+ #>
+ [CmdletBinding()]
+ param(
+ [Parameter(Mandatory=$true)][string]$GHDLBinary,
+ [Parameter(Mandatory=$true)][string[]]$Analyze_Parameters,
+ [Parameter(Mandatory=$true)][string]$DestinationDirectory,
+ [Parameter(Mandatory=$true)][string]$Library,
+ [Parameter(Mandatory=$true)][string]$VHDLVersion,
+ [Parameter(Mandatory=$true)][string[]]$SourceFiles,
+ [Parameter(Mandatory=$true)][bool]$SuppressWarnings,
+ [Parameter(Mandatory=$true)][bool]$HaltOnError
+ )
+ # set default valuesvalues
+ $EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"]
+ $EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug
+
+ $Parameters = $Analyze_Parameters
+
+ if ($EnableDebug)
+ { $Parameters += "-v"
+ $Indent = " "
+ }
+ elseif ($EnableVerbose)
+ { $Indent = " " }
+ else
+ { $Indent = " " }
+
+ Write-Host "Compiling library '$Library' ..." -ForegroundColor Yellow
+ $LibraryDirectory= "$DestinationDirectory/$Library/$VHDLVersion"
+ $EnableVerbose -and (Write-Host " Creating library $Library ..." -ForegroundColor Gray ) | Out-Null
+ $EnableDebug -and (Write-Host " mkdir $LibraryDirectory" -ForegroundColor DarkGray ) | Out-Null
+ mkdir $LibraryDirectory -ErrorAction SilentlyContinue | Out-Null
+ $EnableDebug -and (Write-Host " cd $LibraryDirectory" -ForegroundColor DarkGray ) | Out-Null
+ cd $LibraryDirectory
+ $ErrorCount = 0
+ foreach ($File in $SourceFiles)
+ { Write-Host " Analyzing package file '$File'" -ForegroundColor DarkCyan
+ $InvokeExpr = "& '$GHDLBinary' -a " + ($Parameters -join " ") + " --work=$Library " + $File + " 2>&1"
+ $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null
+ $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings -Indent:"$Indent"
+ if (($LastExitCode -ne 0) -or $ErrorRecordFound)
+ { $ErrorCount += 1
+ if ($HaltOnError)
+ { break }
+ }
+ }
+
+ cd $DestinationDirectory
+ return $ErrorCount
+}
+
+function Start-PrimitiveCompilation
+{ <#
+ .SYNOPSIS
+ Undocumented
+
+ .DESCRIPTION
+ Undocumented
+
+ .PARAMETER GHDLBinary
+ Undocumented
+ .PARAMETER GHDLOptions
+ Undocumented
+ .PARAMETER Library
+ Undocumented
+ .PARAMETER SourceFiles
+ Undocumented
+ .PARAMETER HaltOnError
+ Undocumented
+ #>
+ [CmdletBinding()]
+ param(
+ [Parameter(Mandatory=$true)][string]$GHDLBinary,
+ [Parameter(Mandatory=$true)][string[]]$Analyze_Parameters,
+ [Parameter(Mandatory=$true)][string]$DestinationDirectory,
+ [Parameter(Mandatory=$true)][string]$Library,
+ [Parameter(Mandatory=$true)][string]$VHDLVersion,
+ [Parameter(Mandatory=$true)][string[]]$SourceFiles,
+ [Parameter(Mandatory=$true)][bool]$SuppressWarnings,
+ [Parameter(Mandatory=$true)][bool]$HaltOnError
+ )
+ # set default values
+ $EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"]
+ $EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug
+
+ $Parameters = $Analyze_Parameters
+
+ if ($EnableDebug)
+ { $Parameters += "-v"
+ $Indent = " "
+ }
+ elseif ($EnableVerbose)
+ { $Indent = " " }
+ else
+ { $Indent = " " }
+
+ Write-Host "Compiling library '$Library' ..." -ForegroundColor Cyan
+ $LibraryDirectory="$DestinationDirectory/$Library/$VHDLVersion"
+ $EnableVerbose -and (Write-Host " Creating library $Library ..." -ForegroundColor Gray ) | Out-Null
+ $EnableDebug -and (Write-Host " mkdir $LibraryDirectory" -ForegroundColor DarkGray ) | Out-Null
+ mkdir $LibraryDirectory -ErrorAction SilentlyContinue | Out-Null
+ $EnableDebug -and (Write-Host " cd $LibraryDirectory" -ForegroundColor DarkGray ) | Out-Null
+
+ cd $LibraryDirectory
+
+ $ErrorCount = 0
+ foreach ($File in $SourceFiles)
+ { $EnableVerbose -and (Write-Host " Analyzing primitive file '$File'" -ForegroundColor DarkCyan ) | Out-Null
+ $InvokeExpr = "& '$GHDLBinary' -a " + ($Parameters -join " ") + " --work=$Library " + $File + " 2>&1"
+ $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null
+ $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings -Indent:"$Indent"
+ if (($LastExitCode -ne 0) -or $ErrorRecordFound)
+ { $ErrorCount += 1
+ if ($HaltOnError)
+ { break }
+ }
+ }
+
+ cd $DestinationDirectory
+ return $ErrorCount
+}
+
+
+function Restore-NativeCommandStream
+{ <#
+ .SYNOPSIS
+ This CmdLet gathers multiple ErrorRecord objects and reconstructs outputs
+ as a single line.
+
+ .DESCRIPTION
+ This CmdLet collects multiple ErrorRecord objects and emits one String
+ object per line.
+
+ .PARAMETER InputObject
+ A object stream is required as an input.
+ #>
+ [CmdletBinding()]
+ param(
+ [Parameter(ValueFromPipeline=$true)]
+ $InputObject
+ )
+
+ process
+ { if (-not $InputObject)
+ { Write-Host "Empty pipeline!" }
+ elseif ($InputObject -is [System.Management.Automation.ErrorRecord])
+ { if ($InputObject.FullyQualifiedErrorId -eq "NativeCommandError")
+ { Write-Output $InputObject.ToString() }
+ elseif ($InputObject.FullyQualifiedErrorId -eq "NativeCommandErrorMessage")
+ { Write-Output $InputObject.ToString() }
+ }
+ elseif ($InputObject -is [String])
+ { Write-Output $InputObject }
+ else
+ { Write-Host "Unsupported object in pipeline stream" }
+ }
+}
+
+function Write-ColoredGHDLLine
+{ <#
+ .SYNOPSIS
+ This CmdLet colors GHDL output lines.
+
+ .DESCRIPTION
+ This CmdLet colors GHDL output lines. Warnings are prefixed with 'WARNING: '
+ in yellow and errors are prefixed with 'ERROR: ' in red.
+
+ .PARAMETER InputObject
+ A object stream is required as an input.
+ .PARAMETER SuppressWarnings
+ Skip warning messages. (Show errors only.)
+ .PARAMETER Indent
+ Indentation string.
+ #>
+ [CmdletBinding()]
+ param(
+ [Parameter(ValueFromPipeline=$true)]
+ $InputObject,
+
+ [Parameter(Position=1)]
+ [switch]$SuppressWarnings = $false,
+ [Parameter(Position=2)]
+ [string]$Indent = ""
+ )
+
+ begin
+ { $ErrorRecordFound = $false }
+
+ process
+ { if ($InputObject -is [String])
+ { if ($InputObject -match ":\d+:\d+:warning:\s")
+ { if (-not $SuppressWarnings)
+ { Write-Host "${Indent}WARNING: " -NoNewline -ForegroundColor Yellow
+ Write-Host $InputObject
+ }
+ }
+ elseif ($InputObject -match ":\d+:\d+:note:\s")
+ { if (-not $SuppressWarnings)
+ { Write-Host "${Indent}NOTE: " -NoNewline -ForegroundColor DarkCyan
+ Write-Host $InputObject
+ }
+ }
+ elseif ($InputObject -match ":\d+:\d+:\s")
+ { $ErrorRecordFound = $true
+ Write-Host "${Indent}ERROR: " -NoNewline -ForegroundColor Red
+ Write-Host $InputObject
+ }
+ elseif ($InputObject -match ":warning:\s")
+ { Write-Host "${Indent}WARNING: " -NoNewline -ForegroundColor Yellow
+ Write-Host $InputObject
+ }
+ elseif ($InputObject -match ":error:\s")
+ { $ErrorRecordFound = $true
+ Write-Host "${Indent}ERROR: " -NoNewline -ForegroundColor Red
+ Write-Host $InputObject
+ }
+ elseif ($InputObject -match ": unknown option\s")
+ { $ErrorRecordFound = $true
+ Write-Host "${Indent}ERROR: " -NoNewline -ForegroundColor Red
+ Write-Host $InputObject
+ }
+ elseif ($InputObject -match ": cannot open\s")
+ { $ErrorRecordFound = $true
+ Write-Host "${Indent}ERROR: " -NoNewline -ForegroundColor Red
+ Write-Host $InputObject
+ }
+ else
+ { Write-Host "${Indent}$InputObject" }
+ }
+ else
+ { Write-Host "Unsupported object in pipeline stream" }
+ }
+
+ end
+ { $ErrorRecordFound }
+}
+
+Export-ModuleMember -Function 'Exit-CompileScript'
+
+Export-ModuleMember -Function 'Get-SourceDirectory'
+Export-ModuleMember -Function 'Get-DestinationDirectory'
+Export-ModuleMember -Function 'Get-GHDLBinary'
+
+Export-ModuleMember -Function 'Get-VHDLVariables'
+
+Export-ModuleMember -Function 'New-DestinationDirectory'
+Export-ModuleMember -Function 'Start-PackageCompilation'
+Export-ModuleMember -Function 'Start-PrimitiveCompilation'
+
+
+Export-ModuleMember -Function 'Restore-NativeCommandStream'
+Export-ModuleMember -Function 'Write-ColoredGHDLLine'
diff --git a/scripts/vendors/shared.sh b/scripts/vendors/shared.sh
new file mode 100755
index 000000000..64d0e2e1b
--- /dev/null
+++ b/scripts/vendors/shared.sh
@@ -0,0 +1,323 @@
+# ==============================================================================
+# Authors:
+# Patrick Lehmann
+#
+# Bash Script:
+# This is a Bash resource file for sourcing.
+#
+# Description:
+# Provide Bash procedures to easily use GHDL in Bash scripts.
+#
+# ==============================================================================
+# Copyright (C) 2017-2021 Patrick Lehmann - Boetzingen, Germany
+# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany
+#
+# This program 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 Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <gnu.org/licenses>.
+# ==============================================================================
+
+
+# set bash options
+set -o pipefail
+
+if [[ -n "$GHDL" ]]; then
+ if [[ ! -f "$GHDL" ]]; then
+ echo 1>&2 -e "${COLORED_ERROR} Found GHDL environment variable, but '$GHDL' is not a file.${ANSI_NOCOLOR}"
+ exit 1
+ elif [[ ! -x "$GHDL" ]]; then
+ echo 1>&2 -e "${COLORED_ERROR} Found GHDL environment variable, but '$GHDL' is not executable.${ANSI_NOCOLOR}"
+ exit 1
+ fi
+else # fall back to GHDL found via PATH
+ GHDL=$(which ghdl 2>/dev/null)
+ if [[ $? -ne 0 ]]; then
+ echo 1>&2 -e "${COLORED_ERROR} GHDL not found in PATH.${ANSI_NOCOLOR}"
+ echo 1>&2 -e " Use adv. options '--ghdl' to set the GHDL binary directory."
+ exit 1
+ fi
+fi
+
+Analyze_Filter=filter.analyze.sh
+Analyze_Parameters=(
+ --mb-comments
+)
+
+VERBOSE=${VERBOSE:-0}
+DEBUG=${DEBUG:-0}
+CONTINUE_ON_ERROR=${CONTINUE_ON_ERROR:-0}
+
+test $VERBOSE -eq 1 && echo -e " Declaring Bash procedures for GHDL..."
+
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}procedure SetupDirectories( <Index> <Name> )${ANSI_NOCOLOR}"
+# SetupDirectories
+# -> $Index
+# -> $Name
+# <= $SourceDirectory
+# <= $DestinationDirectory
+SetupDirectories() {
+ local Index=$1
+ local Name=$2
+
+ declare -n Settings="${Index}_Settings"
+
+ # source directory
+ # ----------------------
+ # If a command line argument ('--source') was passed in, use it, else use the default value
+ # from config.sh
+ if [[ ! -z "$SrcDir" ]]; then
+ SourceDirectory=${SrcDir%/} # remove trailing slashes
+ elif [[ ! -z "$EnvSourceDir" ]]; then
+ SourceDirectory=$EnvSourceDir # fall back to environment variable
+ elif [[ ! -z "${Settings[InstallationDirectory]}" ]]; then
+ SourceDirectory=${Settings[InstallationDirectory]}/${Settings[SourceDirectory]} # fall back to value from config.sh
+ fi
+ # output directory
+ # ----------------------
+ # If a command line argument ('--output') was passed in, use it, else use the default value
+ # from config.sh
+ if [[ ! -z "$DestDir" ]]; then
+ DestinationDirectory=${DestDir%/} # remove trailing slashes
+ else
+ DestinationDirectory=${Settings[DestinationDirectory]} # fall back to value from config.sh
+ fi
+
+ if [[ -z $SourceDirectory || -z $DestinationDirectory ]]; then
+ echo 1>&2 -e "${COLORED_ERROR} $Name is not configured in '$ScriptDir/config.sh'.${ANSI_NOCOLOR}"
+ echo 1>&2 -e " Use adv. options '--source' and '--output' or configure 'config.sh'."
+ exit 1
+ elif [[ ! -d $SourceDirectory ]]; then
+ echo 1>&2 -e "${COLORED_ERROR} Path '$SourceDirectory' does not exist.${ANSI_NOCOLOR}"
+ exit 1
+ fi
+
+ # Resolve paths to an absolute paths
+ test greadlink --version > /dev/null 2>&1 && READLINK=greadlink || READLINK=readlink
+ SourceDirectory=$($READLINK -f $SourceDirectory)
+ if [[ ! "$DestinationDirectory" = /* ]]; then
+ DestinationDirectory="$WorkingDir/$DestinationDirectory"
+ fi
+}
+
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}procedure CreateDestinationDirectory( undocumented )${ANSI_NOCOLOR}"
+# CreateDestinationDirectory
+# -> undocumented
+CreateDestinationDirectory() {
+ if [ -d "$DestinationDirectory" ]; then
+ echo -e "${COLORED_WARNING} Vendor directory '$DestinationDirectory' already exists.${ANSI_NOCOLOR}"
+ elif [ -f "$DestinationDirectory" ]; then
+ echo 1>&2 -e "${COLORED_ERROR} Vendor directory '$DestinationDirectory' already exists as a file.${ANSI_NOCOLOR}"
+ exit 1
+ else
+ echo -e "Creating vendor directory: '$DestinationDirectory'.${ANSI_NOCOLOR}"
+ mkdir -p "$DestinationDirectory"
+ fi
+}
+
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}procedure GHDLSetup( <VHDLStandard> )${ANSI_NOCOLOR}"
+# GHDLSetup
+# -> $VHDLStandard
+# <= $VHDLVersion
+# <= $VHDLStandard
+# <= $VHDLFlavor
+GHDLSetup() {
+ if [ $1 -eq 93 ]; then
+ VHDLVersion="v93"
+ VHDLStandard="93c"
+ VHDLFlavor="synopsys"
+ elif [ $1 -eq 2008 ]; then
+ VHDLVersion="v08"
+ VHDLStandard="08"
+ VHDLFlavor="synopsys"
+ fi
+}
+
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}procedure CreateVHDLLibrary( <StructName> <LibraryName> <LibraryPath> <VHDLVersion> <Files[*]> )${ANSI_NOCOLOR}"
+# CreateLibraryStruct
+# -> $StructName
+# -> $LibraryName
+# -> $LibraryPath
+# -> $VHDLVersion
+# -> $Files[*]
+CreateLibraryStruct() {
+ local StructName=$1; shift
+
+ declare -g "${StructName}_LibraryName"=$1; shift
+ declare -g "${StructName}_LibraryPath"=$1; shift
+ declare -g "${StructName}_VHDLVersion"=$1; shift
+
+ declare -n FilesRef="${StructName}_Files"
+ FilesRef=( "$*" )
+}
+
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}procedure DeleteLibraryStruct( <StructName> )${ANSI_NOCOLOR}"
+# DeleteLibraryStruct
+# -> $StructName
+DeleteLibraryStruct() {
+ local StructName=$1
+
+ unset "${StructName}_VHDLVersion"
+ unset "${StructName}_LibraryName"
+ unset "${StructName}_LibraryPath"
+ unset "${StructName}_Files"
+}
+
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}procedure PrintLibraryStruct( <StructName> )${ANSI_NOCOLOR}"
+# PrintLibraryStruct
+# -> $StructName
+PrintLibraryStruct() {
+ local StructName=$1
+ local Indentation=${2:-" "}
+
+ local LibraryName="${StructName}_LibraryName"; local LibraryName=${!LibraryName}
+ local Files="${StructName}_Files[*]"; local Files=${!Files}
+
+ echo -e "$Indentation${ANSI_DARK_GRAY}VHDL Library name: $LibraryName${ANSI_NOCOLOR}"
+ for File in ${Files[*]}; do
+ echo -e "$Indentation ${ANSI_DARK_GRAY}$File${ANSI_NOCOLOR}"
+ done
+}
+
+
+declare -A GHDLLibraryMapping
+
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}procedure CreateVHDLLibrary( <LibraryName> <DirectoryName> <VHDLVersion> )${ANSI_NOCOLOR}"
+# CreateVHDLLibrary
+# -> $LibraryName
+# -> $DirectoryName
+# -> $VHDLVersion
+CreateVHDLLibrary() {
+ local LibraryName=$1
+ local DirectoryName=$2
+ local VHDLVersion=${3:-"v08"}
+
+ echo -e "${ANSI_YELLOW}Creating VHDL Library '$LibraryName'...${ANSI_NOCOLOR}"
+
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}mkdir -p \"$DirectoryName/$VHDLVersion\"${ANSI_NOCOLOR}"
+ mkdir -p "$DirectoryName/$VHDLVersion"
+
+ LibraryDir="$(pwd)/$DirectoryName/$VHDLVersion"
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}Mapping library $LibraryName to '$LibraryDir'.${ANSI_NOCOLOR}"
+ GHDLLibraryMapping[$LibraryName]=$LibraryDir
+}
+
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}procedure AnalyzeVHDL( <LibraryName> <SourceDirectory> <LibraryPath> <File> )${ANSI_NOCOLOR}"
+# AnalyzeVHDL
+# -> $LibraryName
+# -> $SourceDirectory
+# -> $LibraryPath
+# -> $File
+AnalyzeVHDL() {
+ local LibraryName=$1
+ local SourceDirectory=$2
+ local LibraryPath=$3
+ local File=$4
+
+ local DestinationDirectory=${GHDLLibraryMapping[$LibraryName]}
+
+ if [[ $DEBUG -eq 1 ]]; then
+ local Parameters=(
+ -v
+ )
+ local Filter_Parameters=(
+ -d
+ )
+ local Filter_Indent=" "
+ elif [[ $VERBOSE -eq 1 ]]; then
+ local Parameters=()
+ local Filter_Parameters=(
+ -v
+ )
+ local Filter_Indent=" "
+ else
+ local Parameters=()
+ local Filter_Parameters=()
+ local Filter_Indent=" "
+ fi
+
+ local SourceFile="$SourceDirectory/$LibraryPath/$File"
+
+ if [[ ! -f "$SourceFile" ]]; then
+ echo 1>&2 -e "${COLORED_ERROR} Source file '$SourceFile' not found.${ANSI_NOCOLOR}"
+ test $CONTINUE_ON_ERROR -eq 0 && exit 1
+ fi
+
+ if [[ $FILTERING -eq 0 ]]; then
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}$GHDL -a ${Analyze_Parameters[*]} ${Parameters[*]} --work=$LibraryName \"$SourceFile\"${ANSI_NOCOLOR}"
+ $GHDL -a "${Analyze_Parameters[@]}" "${Parameters[@]}" --work=$LibraryName --workdir=$DestinationDirectory "$SourceFile"
+ ExitCode=$?
+ if [[ $ExitCode -ne 0 ]]; then
+ echo 1>&2 -e "$Filter_Indent${COLORED_ERROR} While analyzing '$File'. ExitCode: $ExitCode${ANSI_NOCOLOR}"
+ test $CONTINUE_ON_ERROR -eq 0 && exit 1
+ fi
+ else
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}$GHDL -a ${Analyze_Parameters[*]} ${Parameters[*]} --work=$LibraryName \"$SourceFile\" 2>&1 | \\\\${ANSI_NOCOLOR}"
+ test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}$ScriptDir/$Analyze_Filter ${Filter_Parameters[*]} -i \"$Filter_Indent\"${ANSI_NOCOLOR}"
+ $GHDL -a "${Analyze_Parameters[@]}" "${Parameters[@]}" --work=$LibraryName "$SourceFile" 2>&1 | $ScriptDir/$Analyze_Filter "${Filter_Parameters[@]}" -i "$Filter_Indent"
+ local PiplineStatus=("${PIPESTATUS[@]}")
+ if [[ ${PiplineStatus[0]} -ne 0 ]]; then
+ echo 1>&2 -e "$Filter_Indent${COLORED_ERROR} While analyzing '$File'. ExitCode: ${PiplineStatus[0]}${ANSI_NOCOLOR}"
+ test $CONTINUE_ON_ERROR -eq 0 && exit 1
+ elif [[ ${PiplineStatus[1]} -ne 0 ]]; then
+ case $(( ${PiplineStatus[1]} % 4 )) in
+ # TODO: implement CONTINUE_ON_ERROR in cases ...
+ 3) echo 1>&2 -e "$Filter_Indent${ANSI_RED}Fatal errors detected by filtering script. ExitCode: ${PiplineStatus[1]}${ANSI_NOCOLOR}"; exit 1 ;;
+ 2) echo 1>&2 -e "$Filter_Indent${ANSI_RED}Errors detected by filtering script. ExitCode: ${PiplineStatus[1]}${ANSI_NOCOLOR}"; exit 1 ;;
+ 1) echo 1>&2 -e "$Filter_Indent${ANSI_YELLOW}Warnings detected by filtering script.${ANSI_NOCOLOR}" ;;
+ 0) test $DEBUG -eq 1 && echo 1>&2 -e "$Filter_Indent${ANSI_YELLOW}Warnings detected by filtering script.${ANSI_NOCOLOR}" ;;
+ esac
+ fi
+ fi
+}
+
+
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}procedure AnalyzeLibrary( <LibraryName> <SourceDirectory> <LibraryPath> <Files[*]> )${ANSI_NOCOLOR}"
+# AnalyzeLibrary
+# -> LibraryName
+# -> SourceDirectory
+# -> LibraryPath
+# -> Files[*]
+AnalyzeLibrary() {
+ local LibraryName=$1; shift
+ local SourceDirectory=$1; shift
+ local LibraryPath=$1; shift
+ local Files=$@
+
+ echo -e "${ANSI_YELLOW}Analyzing files into library '$LibraryName'...${ANSI_NOCOLOR}"
+
+ for File in $Files; do
+ test $VERBOSE -eq 1 && echo -e "${ANSI_CYAN} Analyzing '$File'${ANSI_NOCOLOR}"
+
+ AnalyzeVHDL $LibraryName "$SourceDirectory" "$LibraryPath" "$File"
+ done
+}
+
+test $DEBUG -eq 1 && echo -e " ${ANSI_DARK_GRAY}procedure Compile( <SourceDirectory> <Libraries> )${ANSI_NOCOLOR}"
+# Compile
+# -> SourceDirectory
+# -> VHDLLibraries
+Compile() {
+ local SourceDirectory=$1
+ local VHDLLibraries=$2
+
+ for VHDLLibrary in $VHDLLibraries; do
+ local LibraryName="${VHDLLibrary}_LibraryName"; local LibraryName=${!LibraryName}
+ local LibraryPath="${VHDLLibrary}_LibraryPath"; local LibraryPath=${!LibraryPath}
+ local VHDLVersion="${VHDLLibrary}_VHDLVersion"; local VHDLVersion=${!VHDLVersion}
+ local Files="${VHDLLibrary}_Files[*]"; local Files=${!Files}
+
+ echo -e "${ANSI_LIGHT_CYAN}Analyzing library '$LibraryName'...${ANSI_NOCOLOR}"
+
+ CreateVHDLLibrary $LibraryName $LibraryName $VHDLVersion
+ AnalyzeLibrary $LibraryName "$SourceDirectory" "$LibraryPath" "$Files"
+ done
+}