diff options
author | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2021-01-15 07:31:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-15 07:31:59 +0100 |
commit | d890f27e480cdb37428f1b7c4bb37475ed38348d (patch) | |
tree | ef94e9ac91446f661ede0db86cb295e9ec903477 /libraries | |
parent | 4868294436574660552ccef50a5b0849559393de (diff) | |
download | ghdl-d890f27e480cdb37428f1b7c4bb37475ed38348d.tar.gz ghdl-d890f27e480cdb37428f1b7c4bb37475ed38348d.tar.bz2 ghdl-d890f27e480cdb37428f1b7c4bb37475ed38348d.zip |
Reworking pre-compile scripts for Windows (#1594)
* Updated pre-compile scripts for OSVVM.
* Reworked script for Vivado.
* Reworked script for ISE.
* Reworked UVVM compile script. Cannot be tested due to missing feature in GHDL see #1593.
* Reworked scripts for Altera, Intel and Lattice.
* Updated module imports.
* Adjusted warnings.
* Read OSVVM package files from compile-order file 'osvvm.pro'.
* Support OSVVM and OSVVMLibraries as source directory.
* Added support for OSVVM models to precompile script.
* First update to the pre-compile scripts documentation.
* Minimized file headers and redundant documentation. Using PowerShell's feature to document files, functions and modules.
* Updated README in precompile scripts directory.
* license: update headers of pyGHDL, scripts/windows, libraries/vendors
* Fixed ForegroundColor and InvocationName.
Co-authored-by: umarcor <unai.martinezcorral@ehu.eus>
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/vendors/README.md | 290 | ||||
-rw-r--r-- | libraries/vendors/compile-altera.ps1 | 377 | ||||
-rwxr-xr-x | libraries/vendors/compile-altera.sh | 46 | ||||
-rw-r--r-- | libraries/vendors/compile-intel.ps1 | 380 | ||||
-rwxr-xr-x | libraries/vendors/compile-intel.sh | 44 | ||||
-rw-r--r-- | libraries/vendors/compile-lattice.ps1 | 330 | ||||
-rwxr-xr-x | libraries/vendors/compile-lattice.sh | 48 | ||||
-rw-r--r-- | libraries/vendors/compile-osvvm.ps1 | 368 | ||||
-rwxr-xr-x | libraries/vendors/compile-osvvm.sh | 43 | ||||
-rw-r--r-- | libraries/vendors/compile-uvvm.ps1 | 279 | ||||
-rwxr-xr-x | libraries/vendors/compile-uvvm.sh | 43 | ||||
-rw-r--r-- | libraries/vendors/compile-vunit.ps1 | 184 | ||||
-rw-r--r-- | libraries/vendors/compile-xilinx-ise.ps1 | 229 | ||||
-rwxr-xr-x | libraries/vendors/compile-xilinx-ise.sh | 44 | ||||
-rw-r--r-- | libraries/vendors/compile-xilinx-vivado.ps1 | 195 | ||||
-rwxr-xr-x | libraries/vendors/compile-xilinx-vivado.sh | 44 | ||||
-rw-r--r-- | libraries/vendors/config.psm1 | 71 | ||||
-rwxr-xr-x | libraries/vendors/config.sh | 54 | ||||
-rw-r--r-- | libraries/vendors/shared.psm1 | 311 | ||||
-rwxr-xr-x | libraries/vendors/shared.sh | 26 |
20 files changed, 1638 insertions, 1768 deletions
diff --git a/libraries/vendors/README.md b/libraries/vendors/README.md index a5d154283..72fbaee65 100644 --- a/libraries/vendors/README.md +++ b/libraries/vendors/README.md @@ -1,111 +1,42 @@ -## Compile Scripts for Vendor VHDL Libraries +# 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 can not be -shipped with GHDL, but we offer prepared compile scripts to pre-compile the +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. The compile scripts can colorize the GHDL warning and error -lines with the help of grc/grcat ([generic colourizer][grc]). +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 -##### Supported Vendors Libraries - - - Altera Quartus (≥13.0): - - lpm, sgate - - altera, altera_mf, altera_lnsim - - 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 - - Lattice (≥3.6): - - ec - - ecp, ecp2, ecp3, ecp5u - - lptm, lptm2 - - machxo, machxo2, machxo3l - - sc, scm - - xp, xp2 - - Xilinx ISE (≥14.0): - - unisim (incl. secureip) - - unimacro - - simprim (incl. secureip) - - xilinxcorelib - - Xilinx Vivado (≥2014.1): - - unisim (incl. secureip) - - unimacro - -##### Supported Simulation and Verification Libraries - - - OSVVM (for VHDL-2008) - - osvvm - - UVVM (for VHDL-2008) - - uvvm-utilities - - uvvm-vvc-framework - - uvvm-vip-avalon_mm - - uvvm-vip-axi_lite - - uvvm-vip-axi_stream - - uvvm-vip-gpio - - uvvm-vip-i2c - - uvvm-vip-sbi - - uvvm-vip-spi - - uvvm-vip-uart +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) --------------------------------------------------------------------- -### Script Configuration - -The vendor library compile scripts need to know where the used / latest vendor -tool chain is installed. Therefore, the script implement a default installation -directory search as well as environment variable checks. If a vendor tool could -not be detected or the script choses the wrong vendor library source directory, -then it's possible to provide the path via `--source` or `-Source`. -The generated output is stored relative to the current working directory. The -scripts create a sub-directory for each vendor. The default output directory can -be overwritten by the parameter `--output` or `-Output`. - -To compile all source files with GHDL, the simulator executable is searched in -`PATH`. The found default GHDL executable can be overwritten by setting the -environment variable `GHDL` or by passing the parameter `--ghdl` or `-GHDL` to -the scripts. - -If the vendor library compilation is used very often, we recommend to configure -these parameters in `config.sh` or `config.psm1`, so the command line can be -shortened to the essential parts. - ---------------------------------------------------------------------- -### Compiling on Linux - - - **Step 0 - Configure the scripts (optional)** - See next section for how to configure `config.sh`. +## 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)** + - **Step 2 - Start the compilation script(s)** + Choose one of the provided pre-compilation scripts and run: ```Bash - $ /usr/local/lib/ghdl/vendors/compile-altera.sh --all - $ /usr/local/lib/ghdl/vendors/compile-lattice.sh --all - $ /usr/local/lib/ghdl/vendors/compile-xilinx-ise.sh --all - $ /usr/local/lib/ghdl/vendors/compile-xilinx-vivado.sh --all - $ /usr/local/lib/ghdl/vendors/compile-osvvm.sh --all - $ /usr/local/lib/ghdl/vendors/compile-uvvm.sh --all + $ /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` directory. + installed into the `lib/ghdl/vendors` directory. - **Step 3 - Viewing the result** This creates vendor directories in your current working directory and @@ -114,34 +45,25 @@ shortened to the essential parts. ```Bash $ ls -ahl ... - drwxr-xr-x 2 <user> <group> 56K Nov 30 17:41 altera - drwxr-xr-x 2 <user> <group> 56K Nov 30 17:42 lattice drwxr-xr-x 2 <user> <group> 56K Nov 30 17:48 osvvm - drwxr-xr-x 2 <user> <group> 56K Nov 30 17:58 uvvm - drwxr-xr-x 2 <user> <group> 56K Nov 30 17:58 xilinx-ise - drwxr-xr-x 2 <user> <group> 56K Nov 30 17:48 xilinx-vivado + 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 on Windows - - - **Step 0 - Configure the scripts (optional)** - See next section for how to configure `config.psm1`. +### 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)** + - **Step 2 - Start the compilation script(s)** + Choose one of the provided pre-compilation scripts and run: ```PowerShell - PS> <GHDL>\libraries\vendors\compile-altera.ps1 -All - PS> <GHDL>\libraries\vendors\compile-lattice.ps1 -All - PS> <GHDL>\libraries\vendors\compile-xilinx-ise.ps1 -All - PS> <GHDL>\libraries\vendors\compile-xilinx-vivado.ps1 -All - PS> <GHDL>\libraries\vendors\compile-osvvm.ps1 -All - PS> <GHDL>\libraries\vendors\compile-uvvm.ps1 -All + PS> <GHDL>\libraries\vendors\compile-osvvm.ps1 -All -Source ..\path\to\osvvm ``` - **Step 3 - Viewing the result** @@ -154,167 +76,45 @@ shortened to the essential parts. Mode LastWriteTime Length Name ---- ------------- ------ ---- - d---- 20.11.2015 19:33 <DIR> altera - d---- 20.11.2015 19:38 <DIR> lattice - d---- 20.11.2015 19:38 <DIR> osvvm - d---- 20.11.2015 19:45 <DIR> uvvm - d---- 20.11.2015 19:06 <DIR> xilinx-ise - d---- 20.11.2015 19:40 <DIR> xilinx-vivado + 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 ``` --------------------------------------------------------------------- -### Configuration Files - -#### For Linux: `config.sh` - -Please open the `config.sh` file and set the dictionary entries for the -installed vendor tools to the appropriate directory to your tool's installation -directories. Use an empty string `""` for not installed tools. - -`config.sh`: -```Bash -declare -A InstallationDirectory -InstallationDirectory[AlteraQuartus]="/opt/Altera/17.1" -InstallationDirectory[LatticeDiamond]="/opt/Diamond/3.8_x64" -InstallationDirectory[OSVVM]="/home/<user>/git/GitHub/osvvm" -InstallationDirectory[UVVM]="/home/<user>/git/GitHub/uvvm_all" -InstallationDirectory[XilinxISE]="/opt/Xilinx/14.7" -InstallationDirectory[XilinxVivado]="/opt/Xilinx/Vivado/2017.4" -``` - -#### For Windows: `config.psm1` - -Please open the `config.psm1` file and set the dictionary entries for the -installed vendor tools to the appropriate directory to your tool's installation -folder. Use an empty string `""` for not installed tools. -`config.psm1`: -```PowerShell -$InstallationDirectory = @{ - "AlteraQuartus" = "C:\Altera\17.1"; - "LatticeDiamond" = "C:\Lattice\Diamond\3.8_x64"; - "XilinxISE" = "C:\Xilinx\14.7\ISE_DS"; - "XilinxVivado" = "C:\Xilinx\Vivado\2017.4"; - "OSVVM" = "D:\git\GitHub\osvvm"; - "UVVM" = "D:\git\GitHub\uvvm_all" -} -``` +## Options -### Selectable Options for the Bash Scripts: +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. -*First I should translate the scripts before writing the docu...* +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). - - Common parameters to most scripts: +For a detailed documentation and all command line options see +[Precompile Scripts](https://ghdl.github.io/ghdl/getting/PrecompileVendorPrimitives.html) - -h --help Print the embedded help page(s). - -c --clean Cleanup directory before analyzing. - -n --no-warnings Don't show warnings. Report errors only. - -s --skip-existing Skip already compiled files (an *.o file exists). - -S --skip-largefiles Don't compile large entities like DSP and PCIe primitives. - -H --halt-on-error Stop compiling if an error occurred. - - `compile-altera.sh` - Selectable libraries: - -a --all Compile all libraries, including common libraries, packages and device libraries. - --altera Compile base libraries like 'altera' and 'altera_mf' - --max Compile device libraries for Max CPLDs - --arria Compile device libraries for Arria FPGAs - --cyclone Compile device libraries for Cyclone FPGAs - --stratix Compile device libraries for Stratix FPGAs - Compile options: - - --vhdl93 Compile selected libraries with VHDL-93 (default). - --vhdl2008 Compile selected libraries with VHDL-2008. - - `compile-xilinx-ise.sh` - Selectable libraries: - - -a --all Compile all libraries, including common libraries, packages and device libraries. - --unisim Compile the unisim primitives - --unimacro Compile the unimacro macros - --simprim Compile the simprim primitives - --corelib Compile the xilinxcorelib macros - --secureip Compile the secureip primitives - Compile options: - - --vhdl93 Compile selected libraries with VHDL-93 (default). - --vhdl2008 Compile selected libraries with VHDL-2008. - - `compile-xilinx-vivado.sh` - Selectable libraries: - - -a --all Compile all libraries, including common libraries, packages and device libraries. - --unisim Compile the unisim primitives - --unimacro Compile the unimacro macros - --secureip Compile the secureip primitives - Compile options: - - --vhdl93 Compile selected libraries with VHDL-93 (default). - --vhdl2008 Compile selected libraries with VHDL-2008. - - `compile-osvvm.sh` - Selectable libraries: - - -a --all Compile all. - --osvvm Compile the OSVVM library. - - `compile-uvvm.sh` - Selectable libraries: - - -a --all Compile all. - --uvvm Compile the UVVM library. - -### Selectable Options for the PowerShell Scripts: - - - Common parameters to all scripts: - - -Help Print the embedded help page(s). - -Clean Cleanup directory before analyzing. - -SuppressWarnings Don't show warnings. Report errors only. - - `compile-altera.ps1` - Selectable libraries: - - -All Compile all libraries, including common libraries, packages and device libraries. - -Altera Compile base libraries like 'altera' and 'altera_mf' - -Max Compile device libraries for Max CPLDs - -Arria Compile device libraries for Arria FPGAs - -Cyclone Compile device libraries for Cyclone FPGAs - -Stratix Compile device libraries for Stratix FPGAs - Compile options: - - -VHDL93 Compile selected libraries with VHDL-93 (default). - -VHDL2008 Compile selected libraries with VHDL-2008. - - `compile-xilinx-ise.ps1` - Selectable libraries: - - -All Compile all libraries, including common libraries, packages and device libraries. - -Unisim Compile the unisim primitives - -Unimacro Compile the unimacro macros - -Simprim Compile the simprim primitives - -CoreLib Compile the xilinxcorelib macros - -Secureip Compile the secureip primitives - Compile options: +--------------------------------------------------------------------- - -VHDL93 Compile selected libraries with VHDL-93 (default). - -VHDL2008 Compile selected libraries with VHDL-2008. - - `compile-xilinx-vivado.ps1` - Selectable libraries: +## TODOs - -All Compile all libraries, including common libraries, packages and device libraries. - -Unisim Compile the unisim primitives - -Unimacro Compile the unimacro macros - -Secureip Compile the secureip primitives - Compile options: +- OSVVM + - switch / search directories if normal OSVVM or OsvvmLibraries is specified as source - -VHDL93 Compile selected libraries with VHDL-93 (default). - -VHDL2008 Compile selected libraries with VHDL-2008. - - `compile-osvvm.ps1` - Selectable libraries: +- Bash scripts + - Verify `--source` is used instead of `--src` - -All Compile all. - -OSVVM Compile the OSVVM library. - - `compile-uvvm.ps1` - Selectable libraries: +- Missing features + - Implement `--clean` commands - -All Compile all. - -UVVM Compile the UVVM library. ------------------------ Author: Patrick Lehmann -Last update: 11.03.2018 +Last update: 14.01.2020 diff --git a/libraries/vendors/compile-altera.ps1 b/libraries/vendors/compile-altera.ps1 index e3de6e6eb..e301038f5 100644 --- a/libraries/vendors/compile-altera.ps1 +++ b/libraries/vendors/compile-altera.ps1 @@ -1,42 +1,28 @@ -# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*- -# vim: tabstop=2:shiftwidth=2:noexpandtab -# kate: tab-width 2; replace-tabs off; indent-width 2; -# # ============================================================================== -# Authors: Patrick Lehmann -# -# PowerShell Script: Script to compile the simulation libraries from Altera -# Quartus for GHDL on Windows -# -# Description: -# ------------------------------------ -# This is a PowerShell script (executable) which: -# - creates a subdirectory in the current working directory -# - compiles all Altera Quartus simulation libraries and packages +# Authors: +# Patrick Lehmann # # ============================================================================== -# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany -# Copyright (C) 2017 Patrick Lehmann - Freiburg, Germany -# -# GHDL is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2, or (at your option) any later -# version. -# -# GHDL 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 GHDL; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# 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 CmdLet compiles the simulation libraries from Altera. -# +# 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 @@ -51,85 +37,88 @@ # - stratixiv, stratixiv_pcie_hip # - stratixv, stratixv_pcie_hip # - fiftyfivenm, twentynm -# +# [CmdletBinding()] param( # Show the embedded help page(s) - [switch]$Help = $false, - + [switch]$Help = $false, + # Compile all libraries and packages. - [switch]$All = $false, - + [switch]$All = $false, + # Compile the Altera standard libraries: lpm, sgate, altera, altera_mf, altera_lnsim - [switch]$Altera = $false, - + [switch]$Altera = $false, + # Compile the Altera Max device libraries - [switch]$Max = $false, - + [switch]$Max = $false, + # Compile the Altera Cyclone device libraries - [switch]$Cyclone = $false, - + [switch]$Cyclone = $false, + # Compile the Altera Arria device libraries - [switch]$Arria = $false, - + [switch]$Arria = $false, + # Compile the Altera Stratix device libraries - [switch]$Stratix = $false, - + [switch]$Stratix = $false, + # Unknown device library - [switch]$Nanometer = $false, - + [switch]$Nanometer = $false, + # Clean up directory before analyzing. - [switch]$Clean = $false, - + [switch]$Clean = $false, + # Set VHDL Standard to '93. - [switch]$VHDL93 = $false, + [switch]$VHDL93 = $false, # Set VHDL Standard to '08. - [switch]$VHDL2008 = $false, - + [switch]$VHDL2008 = $false, + # Skip warning messages. (Show errors only.) [switch]$SuppressWarnings = $false, # Halt on errors. - [switch]$HaltOnError = $false, - + [switch]$HaltOnError = $false, + # Set vendor library source directory. - [string]$Source = "", + [string]$Source = "", # Set output directory name. - [string]$Output = "", + [string]$Output = "", # Set GHDL binary directory. - [string]$GHDL = "" + [string]$GHDL = "" ) # --------------------------------------------- # save working directory -$WorkingDir = Get-Location +$WorkingDir = Get-Location # set default values -$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] -$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug +$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] +$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug # load modules from GHDL's 'vendors' library directory -Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -Debug:$false -ArgumentList "AlteraQuartus" -Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -Debug:$false -ArgumentList @("Altera Quartus", "$WorkingDir") +$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.InvocationName -Detailed +{ Get-Help $MYINVOCATION.MyCommand.Path -Detailed Exit-CompileScript } if ($All) -{ $Altera = $true - $Max = $true - $Cyclone = $true - $Arria = $true - $Stratix = $true - $Nanometer = $true +{ $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) } + { return $QUARTUS_ROOTDIR + "\" + (Get-VendorToolSourceDirectory) } else { $EnvSourceDir = "" foreach ($Drive in Get-PSDrive -PSProvider 'FileSystem') @@ -148,10 +137,10 @@ function Get-AlteraQuartusDirectory } } } - -$SourceDirectory = Get-SourceDirectory $Source (Get-AlteraQuartusDirectory) -$DestinationDirectory = Get-DestinationDirectory $Output -$GHDLBinary = Get-GHDLBinary $GHDL + +$SourceDirectory = Get-SourceDirectory $Source (Get-AlteraQuartusDirectory) +$DestinationDirectory = Get-DestinationDirectory $Output +$GHDLBinary = Get-GHDLBinary $GHDL # create "Altera" directory and change to it New-DestinationDirectory $DestinationDirectory @@ -161,20 +150,44 @@ cd $DestinationDirectory $VHDLVersion,$VHDLStandard,$VHDLFlavor = Get-VHDLVariables $VHDL93 $VHDL2008 # define global GHDL Options -$GHDLOptions = @("-a", "--std=$VHDLStandard", "-fexplicit", "-frelaxed-rules", "--mb-comments", "--warn-binding", "--ieee=$VHDLFlavor", "--no-vital-checks", "-P$DestinationDirectory") +$GHDLOptions = @( + "-a", + "-fexplicit", + "-frelaxed-rules", + "--mb-comments", + "-Wbinding" +) +if (-not $EnableDebug) +{ $GHDLOptions += @( + "-Wno-hide" + ) +} +if (-not ($EnableVerbose -or $EnableDebug)) +{ $GHDLOptions += @( + "-Wno-library", + "-Wno-others", + "-Wno-static" + ) +} +$GHDLOptions += @( + "--ieee=$VHDLFlavor", + "--no-vital-checks", + "--std=$VHDLStandard", + "-P$DestinationDirectory" +) # extract data from configuration -# $SourceDir = $InstallationDirectory["AlteraQuartus"] + "\quartus\eda\sim_lib" +# $SourceDir = $InstallationDirectory["AlteraQuartus"] + "\quartus\eda\sim_lib" -$StopCompiling = $false -$ErrorCount = 0 +$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 } @@ -190,9 +203,8 @@ if ((-not $StopCompiling) -and $Altera) "220model.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -204,9 +216,8 @@ if ((-not $StopCompiling) -and $Altera) "sgate.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -222,9 +233,8 @@ if ((-not $StopCompiling) -and $Altera) "alt_dspbuilder_package.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -236,9 +246,8 @@ if ((-not $StopCompiling) -and $Altera) "altera_mf.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -249,9 +258,8 @@ if ((-not $StopCompiling) -and $Altera) "altera_lnsim_components.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -265,10 +273,11 @@ if ((-not $StopCompiling) -and $Max) "max_components.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 maxii library @@ -279,10 +288,11 @@ if ((-not $StopCompiling) -and $Max) "maxii_components.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 maxv library @@ -293,10 +303,11 @@ if ((-not $StopCompiling) -and $Max) "maxv_components.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 arriaii library @@ -309,10 +320,11 @@ if ((-not $StopCompiling) -and $Arria) "arriaii_hssi_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 arriaii_pcie_hip library @@ -323,10 +335,11 @@ if ((-not $StopCompiling) -and $Arria) "arriaii_pcie_hip_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 arriaiigz library @@ -338,10 +351,11 @@ if ((-not $StopCompiling) -and $Arria) "arriaiigz_hssi_components.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 arriav library @@ -354,10 +368,11 @@ if ((-not $StopCompiling) -and $Arria) "arriav_hssi_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 arriavgz library @@ -370,10 +385,11 @@ if ((-not $StopCompiling) -and $Arria) "arriavgz_hssi_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 arriavgz_pcie_hip library @@ -384,10 +400,11 @@ if ((-not $StopCompiling) -and $Arria) "arriavgz_pcie_hip_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 cycloneiv library @@ -400,10 +417,11 @@ if ((-not $StopCompiling) -and $Cyclone) "cycloneiv_hssi_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 cycloneiv_pcie_hip library @@ -414,10 +432,11 @@ if ((-not $StopCompiling) -and $Cyclone) "cycloneiv_pcie_hip_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 @@ -428,10 +447,11 @@ if ((-not $StopCompiling) -and $Cyclone) "cycloneive_components.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 @@ -444,10 +464,11 @@ if ((-not $StopCompiling) -and $Cyclone) "cyclonev_hssi_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 @@ -460,10 +481,11 @@ if ((-not $StopCompiling) -and $Stratix) "stratixiv_hssi_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 @@ -474,10 +496,11 @@ if ((-not $StopCompiling) -and $Stratix) "stratixiv_pcie_hip_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 @@ -490,10 +513,11 @@ if ((-not $StopCompiling) -and $Stratix) "stratixv_hssi_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 @@ -504,10 +528,11 @@ if ((-not $StopCompiling) -and $Stratix) "stratixv_pcie_hip_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 @@ -518,10 +543,11 @@ if ((-not $StopCompiling) -and $Nanometer) "fiftyfivenm_components.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 @@ -536,17 +562,18 @@ if ((-not $StopCompiling) -and $Nanometer) "twentynm_hssi_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 } +{ Write-Host "[FAILED]" -ForegroundColor Red } else -{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green } +{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green } Exit-CompileScript diff --git a/libraries/vendors/compile-altera.sh b/libraries/vendors/compile-altera.sh index 81788e3de..b51f077a2 100755 --- a/libraries/vendors/compile-altera.sh +++ b/libraries/vendors/compile-altera.sh @@ -4,34 +4,34 @@ # kate: tab-width 2; replace-tabs off; indent-width 2; # # ============================================================================== -# Authors: Patrick Lehmann -# -# Bash Script: Script to compile the simulation libraries from Altera -# Quartus for GHDL on Linux +# Authors: +# Patrick Lehmann +# +# Bash Script: +# Script to compile the simulation libraries from Altera +# Quartus for GHDL on Linux # # Description: # ------------------------------------ -# This is a Bash script (executable) which: -# - creates a subdirectory in the current working directory -# - compiles all Altera Quartus-II simulation libraries and packages +# This is a Bash script (executable) which: +# - creates a subdirectory in the current working directory +# - compiles all Altera Quartus-II simulation libraries and packages # # ============================================================================== -# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany -# -# GHDL is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2, or (at your option) any later -# version. -# -# GHDL 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 GHDL; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# 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>. # ============================================================================== # --------------------------------------------- diff --git a/libraries/vendors/compile-intel.ps1 b/libraries/vendors/compile-intel.ps1 index 8c1bfbf08..77d69a940 100644 --- a/libraries/vendors/compile-intel.ps1 +++ b/libraries/vendors/compile-intel.ps1 @@ -1,42 +1,28 @@ -# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*- -# vim: tabstop=2:shiftwidth=2:noexpandtab -# kate: tab-width 2; replace-tabs off; indent-width 2; -# # ============================================================================== -# Authors: Patrick Lehmann -# -# PowerShell Script: Script to compile the simulation libraries from Altera -# Quartus for GHDL on Windows -# -# Description: -# ------------------------------------ -# This is a PowerShell script (executable) which: -# - creates a subdirectory in the current working directory -# - compiles all Altera Quartus simulation libraries and packages +# Authors: +# Patrick Lehmann # # ============================================================================== -# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany -# Copyright (C) 2017 Patrick Lehmann - Freiburg, Germany -# -# GHDL is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2, or (at your option) any later -# version. -# -# GHDL 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 GHDL; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# 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 CmdLet compiles the simulation libraries from Altera. -# +# 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 @@ -51,95 +37,95 @@ # - stratixiv, stratixiv_pcie_hip # - stratixv, stratixv_pcie_hip # - fiftyfivenm, twentynm -# +# [CmdletBinding()] param( # Show the embedded help page(s) - [switch]$Help = $false, - + [switch]$Help = $false, + # Compile all libraries and packages. - [switch]$All = $false, - + [switch]$All = $false, + # Compile the Altera standard libraries: lpm, sgate, altera, altera_mf, altera_lnsim - [switch]$Altera = $false, - + [switch]$Altera = $false, + # Compile the Altera Max device libraries - [switch]$Max = $false, - + [switch]$Max = $false, + # Compile the Altera Cyclone device libraries - [switch]$Cyclone = $false, - + [switch]$Cyclone = $false, + # Compile the Altera Arria device libraries - [switch]$Arria = $false, - + [switch]$Arria = $false, + # Compile the Altera Stratix device libraries - [switch]$Stratix = $false, - + [switch]$Stratix = $false, + # Unknown device library - [switch]$Nanometer = $false, - + [switch]$Nanometer = $false, + # Clean up directory before analyzing. - [switch]$Clean = $false, - + [switch]$Clean = $false, + # Set VHDL Standard to '93. - [switch]$VHDL93 = $false, + [switch]$VHDL93 = $false, # Set VHDL Standard to '08. - [switch]$VHDL2008 = $false, - + [switch]$VHDL2008 = $false, + # Skip warning messages. (Show errors only.) [switch]$SuppressWarnings = $false, # Halt on errors. - [switch]$HaltOnError = $false, - + [switch]$HaltOnError = $false, + # Set vendor library source directory. - [string]$Source = "", + [string]$Source = "", # Set output directory name. - [string]$Output = "", + [string]$Output = "", # Set GHDL binary directory. - [string]$GHDL = "" + [string]$GHDL = "" ) # --------------------------------------------- # save working directory -$WorkingDir = Get-Location +$WorkingDir = Get-Location # set default values -$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] -$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug +$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 +$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 +$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.InvocationName -Detailed +{ Get-Help $MYINVOCATION.MyCommand.Path -Detailed Exit-CompileScript } if ($All) -{ $Altera = $true - $Max = $true - $Cyclone = $true - $Arria = $true - $Stratix = $true - $Nanometer = $true +{ $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) } + { 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) + { 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) @@ -151,10 +137,10 @@ function Get-AlteraQuartusDirectory } } } - -$SourceDirectory = Get-SourceDirectory $Source (Get-AlteraQuartusDirectory) -$DestinationDirectory = Get-DestinationDirectory $Output -$GHDLBinary = Get-GHDLBinary $GHDL + +$SourceDirectory = Get-SourceDirectory $Source (Get-AlteraQuartusDirectory) +$DestinationDirectory = Get-DestinationDirectory $Output +$GHDLBinary = Get-GHDLBinary $GHDL # create "Altera" directory and change to it New-DestinationDirectory $DestinationDirectory @@ -164,20 +150,44 @@ cd $DestinationDirectory $VHDLVersion,$VHDLStandard,$VHDLFlavor = Get-VHDLVariables $VHDL93 $VHDL2008 # define global GHDL Options -$GHDLOptions = @("-a", "--std=$VHDLStandard", "-fexplicit", "-frelaxed-rules", "--mb-comments", "--warn-binding", "--ieee=$VHDLFlavor", "--no-vital-checks", "-P$DestinationDirectory") +$GHDLOptions = @( + "-a", + "-fexplicit", + "-frelaxed-rules", + "--mb-comments", + "-Wbinding" +) +if (-not $EnableDebug) +{ $GHDLOptions += @( + "-Wno-hide" + ) +} +if (-not ($EnableVerbose -or $EnableDebug)) +{ $GHDLOptions += @( + "-Wno-library", + "-Wno-others", + "-Wno-static" + ) +} +$GHDLOptions += @( + "--ieee=$VHDLFlavor", + "--no-vital-checks", + "--std=$VHDLStandard", + "-P$DestinationDirectory" +) # extract data from configuration -# $SourceDir = $InstallationDirectory["AlteraQuartus"] + "\quartus\eda\sim_lib" +# $SourceDir = $InstallationDirectory["AlteraQuartus"] + "\quartus\eda\sim_lib" -$StopCompiling = $false -$ErrorCount = 0 +$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 } @@ -193,9 +203,8 @@ if ((-not $StopCompiling) -and $Altera) "220model.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -207,9 +216,8 @@ if ((-not $StopCompiling) -and $Altera) "sgate.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -225,9 +233,8 @@ if ((-not $StopCompiling) -and $Altera) "alt_dspbuilder_package.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -239,9 +246,8 @@ if ((-not $StopCompiling) -and $Altera) "altera_mf.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -252,9 +258,8 @@ if ((-not $StopCompiling) -and $Altera) "altera_lnsim_components.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -268,10 +273,11 @@ if ((-not $StopCompiling) -and $Max) "max_components.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 maxii library @@ -282,10 +288,11 @@ if ((-not $StopCompiling) -and $Max) "maxii_components.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 maxv library @@ -296,10 +303,11 @@ if ((-not $StopCompiling) -and $Max) "maxv_components.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 arriaii library @@ -312,10 +320,11 @@ if ((-not $StopCompiling) -and $Arria) "arriaii_hssi_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 arriaii_pcie_hip library @@ -326,10 +335,11 @@ if ((-not $StopCompiling) -and $Arria) "arriaii_pcie_hip_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 arriaiigz library @@ -341,10 +351,11 @@ if ((-not $StopCompiling) -and $Arria) "arriaiigz_hssi_components.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 arriav library @@ -357,10 +368,11 @@ if ((-not $StopCompiling) -and $Arria) "arriav_hssi_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 arriavgz library @@ -373,10 +385,11 @@ if ((-not $StopCompiling) -and $Arria) "arriavgz_hssi_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 arriavgz_pcie_hip library @@ -387,10 +400,11 @@ if ((-not $StopCompiling) -and $Arria) "arriavgz_pcie_hip_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 cycloneiv library @@ -403,10 +417,11 @@ if ((-not $StopCompiling) -and $Cyclone) "cycloneiv_hssi_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 cycloneiv_pcie_hip library @@ -417,10 +432,11 @@ if ((-not $StopCompiling) -and $Cyclone) "cycloneiv_pcie_hip_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 @@ -431,10 +447,11 @@ if ((-not $StopCompiling) -and $Cyclone) "cycloneive_components.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 @@ -447,10 +464,11 @@ if ((-not $StopCompiling) -and $Cyclone) "cyclonev_hssi_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 @@ -463,10 +481,11 @@ if ((-not $StopCompiling) -and $Stratix) "stratixiv_hssi_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 @@ -477,10 +496,11 @@ if ((-not $StopCompiling) -and $Stratix) "stratixiv_pcie_hip_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 @@ -493,10 +513,11 @@ if ((-not $StopCompiling) -and $Stratix) "stratixv_hssi_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 @@ -507,10 +528,11 @@ if ((-not $StopCompiling) -and $Stratix) "stratixv_pcie_hip_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 @@ -521,10 +543,11 @@ if ((-not $StopCompiling) -and $Nanometer) "fiftyfivenm_components.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 @@ -539,17 +562,18 @@ if ((-not $StopCompiling) -and $Nanometer) "twentynm_hssi_atoms.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) + + 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 } +{ Write-Host "[FAILED]" -ForegroundColor Red } else -{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green } +{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green } Exit-CompileScript diff --git a/libraries/vendors/compile-intel.sh b/libraries/vendors/compile-intel.sh index 9883cea3e..250292ce1 100755 --- a/libraries/vendors/compile-intel.sh +++ b/libraries/vendors/compile-intel.sh @@ -4,34 +4,34 @@ # kate: tab-width 2; replace-tabs off; indent-width 2; # # ============================================================================== -# Authors: Patrick Lehmann +# Authors: +# Patrick Lehmann # -# Bash Script: Script to compile the simulation libraries from Altera -# Quartus for GHDL on Linux +# Bash Script: +# Script to compile the simulation libraries from Altera +# Quartus for GHDL on Linux # # Description: # ------------------------------------ -# This is a Bash script (executable) which: -# - creates a subdirectory in the current working directory -# - compiles all Altera Quartus-II simulation libraries and packages +# This is a Bash script (executable) which: +# - creates a subdirectory in the current working directory +# - compiles all Altera Quartus-II simulation libraries and packages # # ============================================================================== -# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany -# -# GHDL is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2, or (at your option) any later -# version. -# -# GHDL 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 GHDL; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# 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>. # ============================================================================== # --------------------------------------------- diff --git a/libraries/vendors/compile-lattice.ps1 b/libraries/vendors/compile-lattice.ps1 index bcb7e1546..a1b91abe6 100644 --- a/libraries/vendors/compile-lattice.ps1 +++ b/libraries/vendors/compile-lattice.ps1 @@ -1,42 +1,28 @@ -# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*- -# vim: tabstop=2:shiftwidth=2:noexpandtab -# kate: tab-width 2; replace-tabs off; indent-width 2; -# # ============================================================================== -# Authors: Patrick Lehmann -# -# PowerShell Script: Script to compile the simulation libraries from Lattice -# Diamond for GHDL on Windows -# -# Description: -# ------------------------------------ -# This is a PowerShell script (executable) which: -# - creates a subdirectory in the current working directory -# - compiles all Lattice Diamond simulation libraries and packages +# Authors: +# Patrick Lehmann # # ============================================================================== -# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany -# Copyright (C) 2017 Patrick Lehmann - Freiburg, Germany -# -# GHDL is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2, or (at your option) any later -# version. -# -# GHDL 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 GHDL; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# 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 CmdLet compiles the simulation libraries from Lattice. -# +# 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 @@ -47,117 +33,120 @@ # - MachXO, MachXO2, MachXO3L, MachXO3D # - SC, SCM # - XP, XP2 -# +# [CmdletBinding()] param( # Show the embedded help page(s) - [switch]$Help = $false, - + [switch]$Help = $false, + # Compile all libraries and packages. - [switch]$All = $false, - + [switch]$All = $false, + # Compile the Lattice EC device libraries - [switch]$ec = $false, + [switch]$ec = $false, # Compile the Lattice ECP device libraries - [switch]$ecp = $false, + [switch]$ecp = $false, # Compile the Lattice ECP2 device libraries - [switch]$ecp2 = $false, + [switch]$ecp2 = $false, # Compile the Lattice ECP3 device libraries - [switch]$ecp3 = $false, + [switch]$ecp3 = $false, # Compile the Lattice ECP5U device libraries - [switch]$ecp5u = $false, - + [switch]$ecp5u = $false, + # Compile the Lattice LPTM device libraries - [switch]$lptm = $false, + [switch]$lptm = $false, # Compile the Lattice LPTM2 device libraries - [switch]$lptm2 = $false, - + [switch]$lptm2 = $false, + # Compile the Lattice MachXO device libraries - [switch]$MachXO = $false, + [switch]$MachXO = $false, # Compile the Lattice MachXO2 device libraries - [switch]$MachXO2 = $false, + [switch]$MachXO2 = $false, # Compile the Lattice MachXO3L device libraries - [switch]$MachXO3L = $false, + [switch]$MachXO3L = $false, # Compile the Lattice MachXO3D device libraries - [switch]$MachXO3D = $false, - + [switch]$MachXO3D = $false, + # Compile the Lattice SC device libraries - [switch]$sc = $false, + [switch]$sc = $false, # Compile the Lattice SCM device libraries - [switch]$scm = $false, - + [switch]$scm = $false, + # Compile the Lattice XP device libraries - [switch]$xp = $false, + [switch]$xp = $false, # Compile the Lattice XP2 device libraries - [switch]$xp2 = $false, - + [switch]$xp2 = $false, + # Clean up directory before analyzing. - [switch]$Clean = $false, - + [switch]$Clean = $false, + # Set VHDL Standard to '93 - [switch]$VHDL93 = $false, + [switch]$VHDL93 = $false, # Set VHDL Standard to '08 - [switch]$VHDL2008 = $false, - + [switch]$VHDL2008 = $false, + # Skip warning messages. (Show errors only.) [switch]$SuppressWarnings = $false, # Halt on errors. - [switch]$HaltOnError = $false, - + [switch]$HaltOnError = $false, + # Set vendor library source directory. - [string]$Source = "", + [string]$Source = "", # Set output directory name. - [string]$Output = "", + [string]$Output = "", # Set GHDL binary directory. - [string]$GHDL = "" + [string]$GHDL = "" ) # --------------------------------------------- # save working directory -$WorkingDir = Get-Location +$WorkingDir = Get-Location # set default values -$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] -$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug +$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] +$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug # load modules from GHDL's 'vendors' library directory -Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -Debug:$false -ArgumentList "LatticeDiamond" -Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -Debug:$false -ArgumentList @("Lattice Diamond", "$WorkingDir") +$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)) +$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.InvocationName -Detailed +{ 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 +{ $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 + $sc = $true + $scm = $true + $xp = $true + $xp2 = $true } function Get-LatticeDiamondDirectory { if (Test-Path env:FOUNDRY) - { return $FOUNDRY + "\..\" + (Get-VendorToolSourceDirectory) } + { return $FOUNDRY + "\..\" + (Get-VendorToolSourceDirectory) } else { $EnvSourceDir = "" foreach ($Drive in Get-PSDrive -PSProvider 'FileSystem') @@ -176,10 +165,10 @@ function Get-LatticeDiamondDirectory } } } - -$SourceDirectory = Get-SourceDirectory $Source (Get-LatticeDiamondDirectory) -$DestinationDirectory = Get-DestinationDirectory $Output -$GHDLBinary = Get-GHDLBinary $GHDL + +$SourceDirectory = Get-SourceDirectory $Source (Get-LatticeDiamondDirectory) +$DestinationDirectory = Get-DestinationDirectory $Output +$GHDLBinary = Get-GHDLBinary $GHDL # create "Lattice" directory and change to it New-DestinationDirectory $DestinationDirectory @@ -188,27 +177,51 @@ cd $DestinationDirectory $VHDLVersion,$VHDLStandard,$VHDLFlavor = Get-VHDLVariables $VHDL93 $VHDL2008 # define global GHDL Options -$GHDLOptions = @("-a", "--std=$VHDLStandard", "-fexplicit", "-frelaxed-rules", "--mb-comments", "--warn-binding", "--ieee=$VHDLFlavor", "--no-vital-checks", "-P$DestinationDirectory") +$GHDLOptions = @( + "-a", + "-fexplicit", + "-frelaxed-rules", + "--mb-comments", + "-Wbinding" +) +if (-not $EnableDebug) +{ $GHDLOptions += @( + "-Wno-hide" + ) +} +if (-not ($EnableVerbose -or $EnableDebug)) +{ $GHDLOptions += @( + "-Wno-library", + "-Wno-others", + "-Wno-static" + ) +} +$GHDLOptions += @( + "--ieee=$VHDLFlavor", + "--no-vital-checks", + "--std=$VHDLStandard", + "-P$DestinationDirectory" +) -$StopCompiling = $false -$ErrorCount = 0 +$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") + "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 @@ -216,7 +229,7 @@ $FileLists = @{ if ($Clean) { Write-Host "[ERROR]: '-Clean' is not implemented!" -ForegroundColor Red Exit-CompileScript -1 - + Write-Host "Cleaning up vendor directory ..." -ForegroundColor Yellow rm *.cf } @@ -227,9 +240,8 @@ if ($Clean) if ((-not $StopCompiling) -and $ec) { $Library = "ec" $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -238,9 +250,8 @@ if ((-not $StopCompiling) -and $ec) if ((-not $StopCompiling) -and $ecp) { $Library = "ecp" $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -249,9 +260,8 @@ if ((-not $StopCompiling) -and $ecp) if ((-not $StopCompiling) -and $ecp2) { $Library = "ecp2" $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -260,9 +270,8 @@ if ((-not $StopCompiling) -and $ecp2) if ((-not $StopCompiling) -and $ecp3) { $Library = "ecp3" $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -271,9 +280,8 @@ if ((-not $StopCompiling) -and $ecp3) if ((-not $StopCompiling) -and $ecp5u) { $Library = "ecp5u" $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -282,9 +290,8 @@ if ((-not $StopCompiling) -and $ecp5u) if ((-not $StopCompiling) -and $lptm) { $Library = "lptm" $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -293,9 +300,8 @@ if ((-not $StopCompiling) -and $lptm) if ((-not $StopCompiling) -and $lptm2) { $Library = "lptm2" $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -304,9 +310,8 @@ if ((-not $StopCompiling) -and $lptm2) if ((-not $StopCompiling) -and $MachXO) { $Library = "MachXO" $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -315,9 +320,8 @@ if ((-not $StopCompiling) -and $MachXO) if ((-not $StopCompiling) -and $MachXO2) { $Library = "MachXO2" $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -326,9 +330,8 @@ if ((-not $StopCompiling) -and $MachXO2) if ((-not $StopCompiling) -and $machxo3l) { $Library = "machxo3l" $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -337,9 +340,8 @@ if ((-not $StopCompiling) -and $machxo3l) if ((-not $StopCompiling) -and $machxo3d) { $Library = "machxo3d" $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -348,9 +350,8 @@ if ((-not $StopCompiling) -and $machxo3d) if ((-not $StopCompiling) -and $sc) { $Library = "sc" $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -359,9 +360,8 @@ if ((-not $StopCompiling) -and $sc) if ((-not $StopCompiling) -and $scm) { $Library = "scm" $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -370,9 +370,8 @@ if ((-not $StopCompiling) -and $scm) if ((-not $StopCompiling) -and $xp) { $Library = "xp" $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -381,17 +380,16 @@ if ((-not $StopCompiling) -and $xp) if ((-not $StopCompiling) -and $xp2) { $Library = "xp2" $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $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 } +{ Write-Host "[FAILED]" -ForegroundColor Red } else -{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green } +{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green } Exit-CompileScript diff --git a/libraries/vendors/compile-lattice.sh b/libraries/vendors/compile-lattice.sh index 988f2df69..60d71a348 100755 --- a/libraries/vendors/compile-lattice.sh +++ b/libraries/vendors/compile-lattice.sh @@ -4,36 +4,36 @@ # kate: tab-width 2; replace-tabs off; indent-width 2; # # ============================================================================== -# Authors: Markus Koch -# Patrick Lehmann +# Authors: +# Markus Koch +# Patrick Lehmann # -# Bash Script: Script to compile the simulation libraries from Lattice -# Diamond for GHDL on Linux +# Bash Script: +# Script to compile the simulation libraries from Lattice +# Diamond for GHDL on Linux # # Description: # ------------------------------------ -# This is a Bash script (executable) which: -# - creates a subdirectory in the current working directory -# - compiles all Lattice Diamond simulation libraries and packages +# This is a Bash script (executable) which: +# - creates a subdirectory in the current working directory +# - compiles all Lattice Diamond simulation libraries and packages # # ============================================================================== -# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany -# Copyright (C) 2015-2016 Markus Koch -# -# GHDL is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2, or (at your option) any later -# version. -# -# GHDL 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 GHDL; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# 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>. # ============================================================================== # --------------------------------------------- diff --git a/libraries/vendors/compile-osvvm.ps1 b/libraries/vendors/compile-osvvm.ps1 index cdaf9f059..476c102b3 100644 --- a/libraries/vendors/compile-osvvm.ps1 +++ b/libraries/vendors/compile-osvvm.ps1 @@ -1,163 +1,337 @@ -# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*-
-# vim: tabstop=2:shiftwidth=2:noexpandtab
-# kate: tab-width 2; replace-tabs off; indent-width 2;
-#
# ==============================================================================
-# Authors: Patrick Lehmann
-#
-# PowerShell Script: Script to compile the OSVVM library for GHDL on Windows
-#
-# Description:
-# ------------------------------------
-# This is a PowerShell script (executable) which:
-# - creates a subdirectory in the current working directory
-# - compiles all OSVVM packages
+# Authors:
+# Patrick Lehmann
#
# ==============================================================================
-# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany
-# Copyright (C) 2017 Patrick Lehmann - Freiburg, Germany
-#
-# GHDL is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free
-# Software Foundation; either version 2, or (at your option) any later
-# version.
-#
-# GHDL 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 GHDL; see the file COPYING. If not, write to the Free
-# Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# 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 CmdLet compiles the OSVVM library.
-#
+# 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,
-
+ [switch]$Help = $false,
+
# Compile all libraries and packages.
- [switch]$All = $false,
-
- # Compile all OSVVM packages.
- [switch]$OSVVM = $false,
-
+ [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,
-
+ [switch]$Clean = $false,
+
# Skip warning messages. (Show errors only.)
[switch]$SuppressWarnings = $false,
# Halt on errors
- [switch]$HaltOnError = $false,
-
+ [switch]$HaltOnError = $false,
+
# Set vendor library source directory.
- [string]$Source = "",
+ [string]$Source = "",
# Set output directory name.
- [string]$Output = "",
+ [string]$Output = "",
# Set GHDL binary directory.
- [string]$GHDL = ""
+ [string]$GHDL = ""
)
# ---------------------------------------------
# save working directory
-$WorkingDir = Get-Location
+$WorkingDir = Get-Location
# set default values
-$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"]
-$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug
+$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"]
+$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug
# load modules from GHDL's 'vendors' library directory
-Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -Debug:$false -ArgumentList "OSVVM"
-Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -Debug:$false -ArgumentList @("OSVVM", "$WorkingDir")
+$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 $OSVVM -or $Clean)))
-{ Get-Help $MYINVOCATION.InvocationName -Detailed
+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 = $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
+$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
# define global GHDL Options
-$GHDLOptions = @("-a", "--std=$VHDLStandard", "-fexplicit", "-frelaxed-rules", "--mb-comments", "--warn-binding", "--ieee=$VHDLFlavor", "--no-vital-checks", "-P$DestinationDirectory")
+$GHDLOptions = @(
+ "-a",
+ "-fexplicit",
+ "-frelaxed-rules",
+ "--mb-comments",
+ "-Wbinding"
+)
+if (-not $EnableDebug)
+{ $GHDLOptions += @(
+ "-Wno-hide"
+ )
+}
+if (-not ($EnableVerbose -or $EnableDebug))
+{ $GHDLOptions += @(
+ "-Wno-others",
+ "-Wno-static"
+ )
+}
+$GHDLOptions += @(
+ "--ieee=$VHDLFlavor",
+ "--no-vital-checks",
+ "--std=$VHDLStandard",
+ "-P$DestinationDirectory"
+)
-# extract data from configuration
-# $SourceDir = $InstallationDirectory["AlteraQuartus"] + "\quartus\eda\sim_lib"
-$ErrorCount = 0
+$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
}
-# OSVVM packages
-# ==============================================================================
-# compile osvvm library
-if ((-not $StopCompiling) -and $OSVVM)
-{ $Library = "osvvm"
- $Files = @(
- "NamePkg.vhd",
- "OsvvmGlobalPkg.vhd",
- "VendorCovApiPkg.vhd",
- "TranscriptPkg.vhd",
- "TextUtilPkg.vhd",
- "AlertLogPkg.vhd",
- "MessagePkg.vhd",
- "SortListPkg_int.vhd",
- "RandomBasePkg.vhd",
- "RandomPkg.vhd",
- "CoveragePkg.vhd",
- "MemoryPkg.vhd",
- "ScoreboardGenericPkg.vhd",
- "ScoreboardPkg_slv.vhd",
- "ScoreboardPkg_int.vhd",
- "ResolutionPkg.vhd",
- "TbUtilPkg.vhd",
- "OsvvmContext.vhd"
+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
)
- $SourceFiles = $Files | % { "$SourceDirectory\$_" }
-
- $ErrorCount += 0
- Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
- $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+
+# 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 $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
+ $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
+ }
+ }
}
Write-Host "--------------------------------------------------------------------------------"
-Write-Host "Compiling OSVVM packages " -NoNewline
+Write-Host "Compiling OSVVM " -NoNewline
if ($ErrorCount -gt 0)
-{ Write-Host "[FAILED]" -ForegroundColor Red }
+{ Write-Host "[FAILED]" -ForegroundColor Red }
else
-{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green }
+{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green }
Exit-CompileScript
diff --git a/libraries/vendors/compile-osvvm.sh b/libraries/vendors/compile-osvvm.sh index 1cc7262ac..45c1db580 100755 --- a/libraries/vendors/compile-osvvm.sh +++ b/libraries/vendors/compile-osvvm.sh @@ -1,36 +1,35 @@ #! /usr/bin/env bash -# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*- +# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*- # vim: tabstop=2:shiftwidth=2:noexpandtab # kate: tab-width 2; replace-tabs off; indent-width 2; # # ============================================================================== -# Authors: Patrick Lehmann +# Authors: +# Patrick Lehmann # -# Bash Script: Script to compile the OSVVM library for GHDL on Linux +# Bash Script: Script to compile the OSVVM library for GHDL on Linux # # Description: # ------------------------------------ -# This is a Bash script (executable) which: -# - creates a subdirectory in the current working directory -# - compiles all OSVVM packages +# This is a Bash script (executable) which: +# - creates a subdirectory in the current working directory +# - compiles all OSVVM packages # # ============================================================================== -# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany -# -# GHDL is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2, or (at your option) any later -# version. -# -# GHDL 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 GHDL; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# 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>. # ============================================================================== # --------------------------------------------- diff --git a/libraries/vendors/compile-uvvm.ps1 b/libraries/vendors/compile-uvvm.ps1 index 774285bb6..e548ba8cf 100644 --- a/libraries/vendors/compile-uvvm.ps1 +++ b/libraries/vendors/compile-uvvm.ps1 @@ -1,41 +1,28 @@ -# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*- -# vim: tabstop=2:shiftwidth=2:noexpandtab -# kate: tab-width 2; replace-tabs off; indent-width 2; -# # ============================================================================== -# Authors: Patrick Lehmann -# -# PowerShell Script: Script to compile the UVVM library for GHDL on Windows -# -# Description: -# ------------------------------------ -# This is a PowerShell script (executable) which: -# - creates a subdirectory in the current working directory -# - compiles all UVVM packages +# Authors: +# Patrick Lehmann # # ============================================================================== -# Copyright (C) 2015-2017 Patrick Lehmann - Dresden, Germany -# Copyright (C) 2017 Patrick Lehmann - Freiburg, Germany -# -# GHDL is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2, or (at your option) any later -# version. -# -# GHDL 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 GHDL; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# 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 CmdLet compiles the UVVM library. -# +# 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 @@ -44,103 +31,107 @@ [CmdletBinding()] param( # Show the embedded help page(s). - [switch]$Help = $false, - + [switch]$Help = $false, + # Compile all packages. - [switch]$All = $true, - + [switch]$All = $false, + # Compile all UVVM packages. - [switch]$UVVM = $true, - # Compile all UVVM Utility packages. - [switch]$UVVM_Utilities = $true, - # Compile all UVVM VCC Framework packages. - [switch]$UVVM_VCC_Framework = $true, + [switch]$UVVM = $false, + # Compile all UVVM Utility packages. + [switch]$UVVM_Utilities = $false, + # Compile all UVVM VCC Framework packages. + [switch]$UVVM_VCC_Framework = $false, # Compile all UVVM Verification IPs (VIPs). - [switch]$UVVM_VIP = $true, - # Compile VIP: Avalon_MM - [switch]$UVVM_VIP_Avalon_MM = $true, - # Compile VIP: AXI-Lite - [switch]$UVVM_VIP_AXI_Lite = $true, - # Compile VIP: AXI-Stream - [switch]$UVVM_VIP_AXI_Stream = $true, - # Compile VIP: GPIO - [switch]$UVVM_VIP_GPIO = $true, - # Compile VIP: I2C - [switch]$UVVM_VIP_I2C = $true, - # Compile VIP: SBI (Simple Byte Interface) - [switch]$UVVM_VIP_SBI = $true, - # Compile VIP: SPI - [switch]$UVVM_VIP_SPI = $true, - # Compile VIP: UART - [switch]$UVVM_VIP_UART = $true, - # Compile VIP: CLOCK_GENERATOR - [switch]$UVVM_VIP_CLOCK_GENERATOR = $true, - # Compile VIP: SCOREBOARD - [switch]$UVVM_VIP_SCOREBOARD = $true, - + [switch]$UVVM_VIP = $false, + # Compile VIP: Avalon_MM + [switch]$UVVM_VIP_Avalon_MM = $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: GPIO + [switch]$UVVM_VIP_GPIO = $false, + # Compile VIP: I2C + [switch]$UVVM_VIP_I2C = $false, + # Compile VIP: Scoreboard + [switch]$UVVM_VIP_Scoreboard = $false, + # Compile VIP: SBI (Simple Byte Interface) + [switch]$UVVM_VIP_SBI = $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, - + [switch]$Clean = $false, + #Skip warning messages. (Show errors only.) - [switch]$SuppressWarnings = $false, + [switch]$SuppressWarnings = $false, # Halt on errors. - [switch]$HaltOnError = $false, - + [switch]$HaltOnError = $false, + # Set vendor library source directory. - [string]$Source = "", + [string]$Source = "", # Set output directory name. - [string]$Output = "", + [string]$Output = "", # Set GHDL binary directory. - [string]$GHDL = "" + [string]$GHDL = "" ) # --------------------------------------------- # save working directory -$WorkingDir = Get-Location +$WorkingDir = Get-Location # set default values -$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] -$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug +$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] +$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug # load modules from GHDL's 'vendors' library directory -Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -Debug:$false -ArgumentList "UVVM" -Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -Debug:$false -ArgumentList @("UVVM", "$WorkingDir") +$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_AXI_Lite -or $UVVM_VIP_AXI_Stream -or $UVVM_VIP_GPIO -or $UVVM_VIP_I2C -or - $UVVM_VIP_SBI -or $UVVM_VIP_SPI -or $UVVM_VIP_UART -or - $UVVM_VIP_CLOCK_GENERATOR -or $UVVM_VIP_SCOREBOARD)) ))) -{ Get-Help $MYINVOCATION.InvocationName -Detailed + ($UVVM -or ($UVVM_Utilities -or $UVVM_VVC_Framework)) -or + ($UVVM_VIP -or ($UVVM_VIP_Avalon_MM -or $UVVM_VIP_AXI_Lite -or $UVVM_VIP_AXI_Stream -or + $UVVM_VIP_Clock_Generator -or $UVVM_VIP_GPIO -or $UVVM_VIP_I2C -or $UVVM_VIP_SBI -or + $UVVM_VIP_Scoreboard -or $UVVM_VIP_SPI -or $UVVM_VIP_UART)) + ))) +{ Get-Help $MYINVOCATION.MyCommand.Path -Detailed Exit-CompileScript } if ($All) -{ $UVVM = $true - $UVVM_VIP = $true +{ $UVVM = $true + $UVVM_VIP = $true } if ($UVVM) -{ $UVVM_Utilities = $true - $UVVM_VCC_Framework = $true +{ $UVVM_Utilities = $true + $UVVM_VCC_Framework = $true } if ($UVVM_VIP) -{ $UVVM_VIP_Avalon_MM = $true - $UVVM_VIP_AXI_Lite = $true - $UVVM_VIP_AXI_Stream = $true - $UVVM_VIP_GPIO = $true - $UVVM_VIP_I2C = $true - $UVVM_VIP_SBI = $true - $UVVM_VIP_SPI = $true - $UVVM_VIP_UART = $true - $UVVM_VIP_CLOCK_GENERATOR = $true - $UVVM_VIP_SCOREBOARD = $true +{ $UVVM_VIP_Avalon_MM = $true + $UVVM_VIP_AXI_Lite = $true + $UVVM_VIP_AXI_Stream = $true + $UVVM_VIP_Clock_Generator = $true + $UVVM_VIP_GPIO = $true + $UVVM_VIP_I2C = $true + $UVVM_VIP_Scoreboard = $true + $UVVM_VIP_SBI = $true + $UVVM_VIP_SPI = $true + $UVVM_VIP_UART = $true } -$SourceDirectory = Get-SourceDirectory $Source "" -$DestinationDirectory = Get-DestinationDirectory $Output -$GHDLBinary = Get-GHDLBinary $GHDL +$SourceDirectory = Get-SourceDirectory $Source "" +$DestinationDirectory = Get-DestinationDirectory $Output +$GHDLBinary = Get-GHDLBinary $GHDL # create "uvvm" directory and change to it New-DestinationDirectory $DestinationDirectory @@ -150,19 +141,42 @@ cd $DestinationDirectory $VHDLVersion,$VHDLStandard,$VHDLFlavor = Get-VHDLVariables # define global GHDL Options -$GHDLOptions = @("-a", "--std=$VHDLStandard", "-fexplicit", "-frelaxed-rules", "--mb-comments", "--warn-binding", "--ieee=$VHDLFlavor", "--no-vital-checks", "-P$DestinationDirectory") +$GHDLOptions = @( + "-a", + "-fexplicit", + "-frelaxed-rules", + "--mb-comments", + "-Wbinding" +) +if (-not $EnableDebug) +{ $GHDLOptions += @( + "-Wno-hide" + ) +} +if (-not ($EnableVerbose -or $EnableDebug)) +{ $GHDLOptions += @( + "-Wno-others", + "-Wno-static", + "-Wno-shared" # UVVM specific + ) +} +$GHDLOptions += @( + "--ieee=$VHDLFlavor", + "--no-vital-checks", + "--std=$VHDLStandard", + "-P$DestinationDirectory" +) -# extract data from configuration -# $SourceDir = $InstallationDirectory["AlteraQuartus"] + "\quartus\eda\sim_lib" -$ErrorCount = 0 +$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 } @@ -190,25 +204,41 @@ $UVVM_VVC_Files = @( ) -Write-Host "Reading VIP compile order files..." -ForegroundColor Yellow +Write-Host "Reading VIP compile order files..." -ForegroundColor Cyan $VIP_Files = @{} foreach ($VIPDirectory in (Get-ChildItem -Path $SourceDirectory -Directory "*VIP*")) { $VIPName = $VIPDirectory.Name $VIPVariable = $VIPName.Substring(7).ToUpper().Replace("AXI", "AXI_") - - $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 = Get-Content "$SourceDirectory\$VIPName\script\compile_order.txt" | %{ Resolve-Path "$SourceDirectory\$VIPName\script\$_" } + $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) + { if ($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) - { foreach ($File in $VIPFiles) - { Write-Host " $File" -ForegroundColor DarkGray } + { Write-Host " VHDL Library name: $VIPName" -ForegroundColor DarkGray + foreach ($File in $VIPFiles) + { Write-Host " $File" -ForegroundColor DarkGray } } + $VIP_Files[$VIPName] = @{ - "Variable" = "UVVM_$VIPVariable"; - "Library" = $VIPName; - "Files" = $VIPFiles - }; + "Variable" = "UVVM_$VIPVariable"; + "Library" = $VIPName; + "Files" = $VIPFiles + } } @@ -218,9 +248,8 @@ foreach ($VIPDirectory in (Get-ChildItem -Path $SourceDirectory -Directory "*VIP if ((-not $StopCompiling) -and $UVVM_Utilities) { $Library = "uvvm_util" $SourceFiles = $UVVM_Util_Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -228,20 +257,18 @@ if ((-not $StopCompiling) -and $UVVM_Utilities) if ((-not $StopCompiling) -and $UVVM_VCC_Framework) { $Library = "uvvm_vvc_framework" $SourceFiles = $UVVM_VVC_Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } foreach ($vip in $VIP_Files.Keys) { if ((-not $StopCompiling) -and (Get-Variable $VIP_Files[$vip]["Variable"] -ValueOnly)) - { $Library = $VIP_Files[$vip]["Library"] - $SourceFiles = $VIP_Files[$vip]["Files"] #| % { "$SourceDirectory\$_" } + { $Library = $VIP_Files[$vip]["Library"] + $SourceFiles = $VIP_Files[$vip]["Files"] #| % { "$SourceDirectory\$_" } - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } } @@ -249,8 +276,8 @@ foreach ($vip in $VIP_Files.Keys) Write-Host "--------------------------------------------------------------------------------" Write-Host "Compiling UVVM packages " -NoNewline if ($ErrorCount -gt 0) -{ Write-Host "[FAILED]" -ForegroundColor Red } +{ Write-Host "[FAILED]" -ForegroundColor Red } else -{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green } +{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green } Exit-CompileScript diff --git a/libraries/vendors/compile-uvvm.sh b/libraries/vendors/compile-uvvm.sh index 6fb152401..5ff3e30f3 100755 --- a/libraries/vendors/compile-uvvm.sh +++ b/libraries/vendors/compile-uvvm.sh @@ -4,34 +4,33 @@ # kate: tab-width 2; replace-tabs off; indent-width 2; # # ============================================================================== -# Authors: Patrick Lehmann +# Authors: +# Patrick Lehmann # -# Bash Script: Script to compile the UVVM library for GHDL on Linux +# Bash Script: Script to compile the UVVM library for GHDL on Linux # # Description: # ------------------------------------ -# This is a Bash script (executable) which: -# - creates a subdirectory in the current working directory -# - compiles all UVVM packages +# This is a Bash script (executable) which: +# - creates a subdirectory in the current working directory +# - compiles all UVVM packages # # ============================================================================== -# Copyright (C) 2015-2017 Patrick Lehmann - Dresden, Germany -# Copyright (C) 2017 Patrick Lehmann - Freiburg, Germany -# -# GHDL is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2, or (at your option) any later -# version. -# -# GHDL 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 GHDL; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 2015-2017 Patrick Lehmann - Dresden, Germany +# Copyright (C) 2017 Patrick Lehmann - Freiburg, 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>. # ============================================================================== # --------------------------------------------- diff --git a/libraries/vendors/compile-vunit.ps1 b/libraries/vendors/compile-vunit.ps1 deleted file mode 100644 index 2ba5b9362..000000000 --- a/libraries/vendors/compile-vunit.ps1 +++ /dev/null @@ -1,184 +0,0 @@ -# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*- -# vim: tabstop=2:shiftwidth=2:noexpandtab -# kate: tab-width 2; replace-tabs off; indent-width 2; -# -# ============================================================================== -# Authors: Patrick Lehmann -# -# PowerShell Script: Script to compile the VUnit library for GHDL on Windows -# -# Description: -# ------------------------------------ -# This is a PowerShell script (executable) which: -# - creates a subdirectory in the current working directory -# - compiles all VUnit packages -# -# ============================================================================== -# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany -# Copyright (C) 2017 Patrick Lehmann - Freiburg, Germany -# -# GHDL is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2, or (at your option) any later -# version. -# -# GHDL 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 GHDL; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. -# ============================================================================== - -# .SYNOPSIS -# This CmdLet compiles the VUnit library. -# -# .DESCRIPTION -# This CmdLet: -# (1) creates a subdirectory in the current working directory -# (2) compiles all VUnit packages -# -[CmdletBinding()] -param( - # Show the embedded help page(s) - [switch]$Help = $false, - - # Compile all packages. - [switch]$All = $true, - - # Compile all VUnit packages. - [switch]$VUnit = $true, - - # 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 -Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -Debug:$false -ArgumentList "VUnit" -Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -Debug:$false -ArgumentList @("VUnit", "$WorkingDir") - -# Display help if no command was selected -$Help = $Help -or (-not ($All -or $VUnit -or $Clean)) - -if ($Help) -{ Get-Help $MYINVOCATION.InvocationName -Detailed - Exit-CompileScript -} -if ($All) -{ $VUnit = $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 - -# define global GHDL Options -$GHDLOptions = @("-a", "-fexplicit", "-frelaxed-rules", "--mb-comments", "--warn-binding", "--ieee=$VHDLFlavor", "--no-vital-checks", "--std=$VHDLStandard", "-P$DestinationDirectory") - -# extract data from configuration -# $SourceDir = $InstallationDirectory["AlteraQuartus"] + "\quartus\eda\sim_lib" - -$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 -} - - -# VUnit packages -# ============================================================================== -# compile vunit_lib library -if ((-not $StopCompiling) -and $VUnit) -{ $Library = "vunit_lib" - $Files = @( - "run\src\stop_api.vhd", - "vhdl\src\lib\std\textio.vhd", - "vhdl\src\lang\lang.vhd", - "com\src\com_types.vhd", - "run\src\stop_body_2008.vhd", - "com\src\com_api.vhd", - "string_ops\src\string_ops.vhd", - "path\src\path.vhd", - "logging\src\log_types.vhd", - "logging\src\log_formatting.vhd", - "logging\src\log_special_types200x.vhd", - "array\src\array_pkg.vhd", - "logging\src\log_base_api.vhd", - "logging\src\log_base.vhd", - "logging\src\log_api.vhd", - "logging\src\log.vhd", - "check\src\check_types.vhd", - "check\src\check_special_types200x.vhd", - "check\src\check_base_api.vhd", - "check\src\check_base.vhd", - "check\src\check_api.vhd", - "check\src\check.vhd", - "dictionary\src\dictionary.vhd", - "run\src\run_types.vhd", - "run\src\run_special_types200x.vhd", - "run\src\run_base_api.vhd", - "run\src\run_base.vhd", - "run\src\run_api.vhd", - "run\src\run.vhd", - "vunit_run_context.vhd", - "vunit_context.vhd", - "com\src\com_std_codec_builder.vhd", - "com\src\com_debug_codec_builder.vhd", - "com\src\com_string.vhd", - "com\src\com_codec_api.vhd", - "com\src\com_codec.vhd", - "com\src\com.vhd", - "com\src\com_context.vhd" - ) - $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug - $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) -} - -Write-Host "--------------------------------------------------------------------------------" -Write-Host "Compiling VUnit packages " -NoNewline -if ($ErrorCount -gt 0) -{ Write-Host "[FAILED]" -ForegroundColor Red } -else -{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green } - -Exit-CompileScript diff --git a/libraries/vendors/compile-xilinx-ise.ps1 b/libraries/vendors/compile-xilinx-ise.ps1 index f01d92b0c..cc4884a06 100644 --- a/libraries/vendors/compile-xilinx-ise.ps1 +++ b/libraries/vendors/compile-xilinx-ise.ps1 @@ -1,42 +1,28 @@ -# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*- -# vim: tabstop=2:shiftwidth=2:noexpandtab -# kate: tab-width 2; replace-tabs off; indent-width 2; -# # ============================================================================== -# Authors: Patrick Lehmann -# -# PowerShell Script: Script to compile the simulation libraries from Xilinx ISE -# for GHDL on Windows -# -# Description: -# ------------------------------------ -# This is a PowerShell script (executable) which: -# - creates a subdirectory in the current working directory -# - compiles all Xilinx ISE simulation libraries and packages +# Authors: +# Patrick Lehmann # # ============================================================================== -# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany -# Copyright (C) 2017 Patrick Lehmann - Freiburg, Germany -# -# GHDL is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2, or (at your option) any later -# version. -# -# GHDL 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 GHDL; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# 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 CmdLet compiles the simulation libraries from Xilinx. -# +# 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 @@ -49,82 +35,80 @@ [CmdletBinding()] param( # Show the embedded help page(s) - [switch]$Help = $false, - + [switch]$Help = $false, + # Compile all libraries and packages. - [switch]$All = $false, - + [switch]$All = $false, + # Compile the Xilinx simulation library. - [switch]$Unisim = $false, - + [switch]$Unisim = $false, + # Compile the Xilinx macro library. - [switch]$Unimacro = $false, - + [switch]$Unimacro = $false, + # Compile the Xilinx post-map simulation library. - [switch]$Simprim = $false, - + [switch]$Simprim = $false, + # Compile the Xilinx CoreLib simulation library. - [switch]$CoreLib = $false, - + [switch]$CoreLib = $false, + # Compile the Xilinx secureip library. - [switch]$SecureIP = $false, - + [switch]$SecureIP = $false, + # Clean up directory before analyzing. - [switch]$Clean = $false, - + [switch]$Clean = $false, + # Set VHDL Standard to '93 - [switch]$VHDL93 = $false, + [switch]$VHDL93 = $false, # Set VHDL Standard to '08 - [switch]$VHDL2008 = $false, - + [switch]$VHDL2008 = $false, + # Skip warning messages. (Show errors only.) [switch]$SuppressWarnings = $false, # Halt on errors. - [switch]$HaltOnError = $false, - + [switch]$HaltOnError = $false, + # Set vendor library source directory. - [string]$Source = "", + [string]$Source = "", # Set output directory name. - [string]$Output = "", + [string]$Output = "", # Set GHDL binary directory. - [string]$GHDL = "" + [string]$GHDL = "" ) -if ($Help) -{ Get-Help $MYINVOCATION.InvocationName -Detailed - return -} - # --------------------------------------------- # save working directory -$WorkingDir = Get-Location +$WorkingDir = Get-Location # set default values -$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] -$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug +$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] +$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug # load modules from GHDL's 'vendors' library directory -Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -Debug:$false -ArgumentList "XilinxISE" -Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -Debug:$false -ArgumentList @("Xilinx ISE", "$WorkingDir") +$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.InvocationName -Detailed +{ Get-Help $MYINVOCATION.MyCommand.Path -Detailed Exit-CompileScript } if ($All) -{ $Unisim = $true - $Simprim = $true - $Unimacro = $true - $CoreLib = $true - $SecureIP = $true +{ $Unisim = $true + $Simprim = $true + $Unimacro = $true + $CoreLib = $true + $SecureIP = $true } function Get-XilinxISEDirectory { if (Test-Path env:XILINX) - { return $XILINX + "\" + (Get-VendorToolSourceDirectory) } + { return $XILINX + "\" + (Get-VendorToolSourceDirectory) } else { $EnvSourceDir = "" foreach ($Drive in Get-PSDrive -PSProvider 'FileSystem') @@ -143,10 +127,10 @@ function Get-XilinxISEDirectory } } } - -$SourceDirectory = Get-SourceDirectory $Source (Get-XilinxISEDirectory) -$DestinationDirectory = Get-DestinationDirectory $Output -$GHDLBinary = Get-GHDLBinary $GHDL + +$SourceDirectory = Get-SourceDirectory $Source (Get-XilinxISEDirectory) +$DestinationDirectory = Get-DestinationDirectory $Output +$GHDLBinary = Get-GHDLBinary $GHDL # create "Altera" directory and change to it New-DestinationDirectory $DestinationDirectory @@ -154,18 +138,42 @@ cd $DestinationDirectory if ($VHDL2008) { Write-Host "Not all Xilinx primitives are VHDL-2008 compatible! Setting HaltOnError to FALSE." -ForegroundColor Red - $HaltOnError = $false + $HaltOnError = $false } $VHDLVersion,$VHDLStandard,$VHDLFlavor = Get-VHDLVariables $VHDL93 $VHDL2008 # define global GHDL Options -$GHDLOptions = @("-a", "--std=$VHDLStandard", "-fexplicit", "-frelaxed-rules", "--mb-comments", "--warn-binding", "--ieee=$VHDLFlavor", "--no-vital-checks", "-P$DestinationDirectory") +$GHDLOptions = @( + "-a", + "-fexplicit", + "-frelaxed-rules", + "--mb-comments", + "-Wbinding" +) +if (-not $EnableDebug) +{ $GHDLOptions += @( + "-Wno-hide" + ) +} +if (-not ($EnableVerbose -or $EnableDebug)) +{ $GHDLOptions += @( + "-Wno-library", + "-Wno-others", + "-Wno-static" + ) +} +$GHDLOptions += @( + "--ieee=$VHDLFlavor", + "--no-vital-checks", + "--std=$VHDLStandard", + "-P$DestinationDirectory" +) # extract data from configuration -# $SourceDir = $InstallationDirectory["AlteraQuartus"] + "\quartus\eda\sim_lib" +# $SourceDir = $InstallationDirectory["AlteraQuartus"] + "\quartus\eda\sim_lib" -$StopCompiling = $false -$ErrorCount = 0 +$StopCompiling = $false +$ErrorCount = 0 # Cleanup directories @@ -173,7 +181,7 @@ $ErrorCount = 0 if ($Clean) { Write-Host "[ERROR]: '-Clean' is not implemented!" -ForegroundColor Red Exit-CompileScript -1 - + Write-Host "Cleaning up vendor directory ..." -ForegroundColor Yellow rm *.cf } @@ -189,9 +197,8 @@ if ((-not $StopCompiling) -and $Unisim) "unisims\unisim_VCOMP.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -199,9 +206,8 @@ if ((-not $StopCompiling) -and $Unisim) if ((-not $StopCompiling) -and $Unisim) { $Library = "unisim" $SourceFiles = dir "$SourceDirectory\unisims\primitive\*.vhd*" - - $ErrorCount += 0 - Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -209,9 +215,8 @@ if ((-not $StopCompiling) -and $Unisim) if ((-not $StopCompiling) -and $Unisim -and $SecureIP) { $Library = "secureip" $SourceFiles = dir "$SourceDirectory\unisims\secureip\*.vhd*" - - $ErrorCount += 0 - Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -224,9 +229,8 @@ if ((-not $StopCompiling) -and $Unimacro) "unimacro\unimacro_VCOMP.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -234,9 +238,8 @@ if ((-not $StopCompiling) -and $Unimacro) if ((-not $StopCompiling) -and $Unimacro) { $Library = "unimacro" $SourceFiles = dir "$SourceDirectory\unimacro\*_MACRO.vhd*" - - $ErrorCount += 0 - Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -250,9 +253,8 @@ if ((-not $StopCompiling) -and $Simprim) "simprims\simprim_Vcomponents.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -260,9 +262,8 @@ if ((-not $StopCompiling) -and $Simprim) if ((-not $StopCompiling) -and $Simprim) { $Library = "simprim" $SourceFiles = dir "$SourceDirectory\simprims\primitive\other\*.vhd*" - - $ErrorCount += 0 - Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -270,9 +271,8 @@ if ((-not $StopCompiling) -and $Simprim) if ((-not $StopCompiling) -and $Simprim -and $SecureIP) { $Library = "secureip" $SourceFiles = dir "$SourceDirectory\simprims\secureip\other\*.vhd*" - - $ErrorCount += 0 - Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -287,24 +287,23 @@ if ((-not $StopCompiling) -and $CoreLib) { 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("#")) + { if (-not ($line.StartsWith("#") -or ($line -eq ""))) { $SourceFiles += "$SourceDirectory\XilinxCoreLib\$line" } } - - $ErrorCount += 0 - Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $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 } +{ Write-Host "[FAILED]" -ForegroundColor Red } else -{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green } +{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green } Exit-CompileScript diff --git a/libraries/vendors/compile-xilinx-ise.sh b/libraries/vendors/compile-xilinx-ise.sh index ef7c736a9..623b3f309 100755 --- a/libraries/vendors/compile-xilinx-ise.sh +++ b/libraries/vendors/compile-xilinx-ise.sh @@ -4,34 +4,34 @@ # kate: tab-width 2; replace-tabs off; indent-width 2; # # ============================================================================== -# Authors: Patrick Lehmann +# Authors: +# Patrick Lehmann # -# Bash Script: Script to compile the simulation libraries from Xilinx ISE -# for GHDL on Linux +# Bash Script: +# Script to compile the simulation libraries from Xilinx ISE +# for GHDL on Linux # # Description: # ------------------------------------ -# This is a Bash script (executable) which: -# - creates a subdirectory in the current working directory -# - compiles all Xilinx ISE simulation libraries and packages +# This is a Bash script (executable) which: +# - creates a subdirectory in the current working directory +# - compiles all Xilinx ISE simulation libraries and packages # # ============================================================================== -# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany -# -# GHDL is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2, or (at your option) any later -# version. -# -# GHDL 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 GHDL; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# 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>. # ============================================================================== # --------------------------------------------- diff --git a/libraries/vendors/compile-xilinx-vivado.ps1 b/libraries/vendors/compile-xilinx-vivado.ps1 index 457700475..52bd9bf82 100644 --- a/libraries/vendors/compile-xilinx-vivado.ps1 +++ b/libraries/vendors/compile-xilinx-vivado.ps1 @@ -1,122 +1,111 @@ -# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*- -# vim: tabstop=2:shiftwidth=2:noexpandtab -# kate: tab-width 2; replace-tabs off; indent-width 2; -# # ============================================================================== -# Authors: Patrick Lehmann -# -# PowerShell Script: Script to compile the simulation libraries from Xilinx -# Vivado for GHDL on Windows -# -# Description: -# ------------------------------------ -# This is a PowerShell script (executable) which: -# - creates a subdirectory in the current working directory -# - compiles all Xilinx Vivado simulation libraries and packages +# Authors: +# Patrick Lehmann # # ============================================================================== -# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany -# Copyright (C) 2017 Patrick Lehmann - Freiburg, Germany -# -# GHDL is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2, or (at your option) any later -# version. -# -# GHDL 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 GHDL; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# 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 CmdLet compiles the simulation libraries from Xilinx. -# +# 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, - + [switch]$Help = $false, + # Compile all libraries and packages. - [switch]$All = $false, - + [switch]$All = $false, + # Compile the Xilinx simulation library. - [switch]$Unisim = $false, - + [switch]$Unisim = $false, + # Compile the Xilinx macro library. - [switch]$Unimacro = $false, - + [switch]$Unimacro = $false, + # Compile the Xilinx secureip library. - [switch]$SecureIP = $false, - + [switch]$SecureIP = $false, + # Clean up directory before analyzing. - [switch]$Clean = $false, - + [switch]$Clean = $false, + # Set VHDL Standard to '93. - [switch]$VHDL93 = $false, + [switch]$VHDL93 = $false, # Set VHDL Standard to '08. - [switch]$VHDL2008 = $false, - + [switch]$VHDL2008 = $false, + # Skip warning messages. (Show errors only.) [switch]$SuppressWarnings = $false, # Halt on errors. - [switch]$HaltOnError = $false, - + [switch]$HaltOnError = $false, + # Set vendor library source directory. - [string]$Source = "", + [string]$Source = "", # Set output directory name. - [string]$Output = "", + [string]$Output = "", # Set GHDL binary directory. - [string]$GHDL = "" + [string]$GHDL = "" ) # --------------------------------------------- # save working directory -$WorkingDir = Get-Location +$WorkingDir = Get-Location # set default values -$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] -$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug +$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.InvocationName -Detailed +{ Get-Help $MYINVOCATION.MyCommand.Path -Detailed Exit-CompileScript } if ($All) -{ $Unisim = $true - $Simprim = $true - $Unimacro = $true - $SecureIP = $true +{ $Unisim = $true + $Simprim = $true + $Unimacro = $true + $SecureIP = $true } function Get-XilinxVivadoDirectory { if (Test-Path env:XILINX_VIVADO) - { return $XILINX_VIVADO + "\" + (Get-VendorToolSourceDirectory) } + { 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 2018..2014) + { foreach ($Major in 2021..2014) { foreach ($Minor in 4..1) { $Dir = $Path + "\" + $Major + "." + $Minor if (Test-Path $Dir -PathType Container) @@ -129,10 +118,10 @@ function Get-XilinxVivadoDirectory } } } - -$SourceDirectory = Get-SourceDirectory $Source (Get-XilinxVivadoDirectory) -$DestinationDirectory = Get-DestinationDirectory $Output -$GHDLBinary = Get-GHDLBinary $GHDL + +$SourceDirectory = Get-SourceDirectory $Source (Get-XilinxVivadoDirectory) +$DestinationDirectory = Get-DestinationDirectory $Output +$GHDLBinary = Get-GHDLBinary $GHDL # create "Altera" directory and change to it New-DestinationDirectory $DestinationDirectory @@ -140,18 +129,42 @@ cd $DestinationDirectory if ($VHDL2008) { Write-Host "Not all Xilinx primitives are VHDL-2008 compatible! Setting HaltOnError to FALSE." -ForegroundColor Red - $HaltOnError = $false + $HaltOnError = $false } $VHDLVersion,$VHDLStandard,$VHDLFlavor = Get-VHDLVariables $VHDL93 $VHDL2008 # define global GHDL Options -$GHDLOptions = @("-a", "--std=$VHDLStandard", "-fexplicit", "-frelaxed-rules", "--mb-comments", "--warn-binding", "--ieee=$VHDLFlavor", "--no-vital-checks", "-P$DestinationDirectory") +$GHDLOptions = @( + "-a", + "-fexplicit", + "-frelaxed-rules", + "--mb-comments", + "-Wbinding" +) +if (-not $EnableDebug) +{ $GHDLOptions += @( + "-Wno-hide" + ) +} +if (-not ($EnableVerbose -or $EnableDebug)) +{ $GHDLOptions += @( + "-Wno-library", + "-Wno-others", + "-Wno-static" + ) +} +$GHDLOptions += @( + "--ieee=$VHDLFlavor", + "--no-vital-checks", + "--std=$VHDLStandard", + "-P$DestinationDirectory" +) # extract data from configuration -# $SourceDir = $InstallationDirectory["AlteraQuartus"] + "\quartus\eda\sim_lib" +# $SourceDir = $InstallationDirectory["AlteraQuartus"] + "\quartus\eda\sim_lib" -$StopCompiling = $false -$ErrorCount = 0 +$StopCompiling = $false +$ErrorCount = 0 # Cleanup directories @@ -159,7 +172,7 @@ $ErrorCount = 0 if ($Clean) { Write-Host "[ERROR]: '-Clean' is not implemented!" -ForegroundColor Red Exit-CompileScript -1 - + Write-Host "Cleaning up vendor directory ..." -ForegroundColor Yellow rm *.cf } @@ -177,9 +190,8 @@ if ((-not $StopCompiling) -and $Unisim) "unisims\unisim_retarget_VCOMP.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -187,9 +199,8 @@ if ((-not $StopCompiling) -and $Unisim) if ((-not $StopCompiling) -and $Unisim) { $Library = "unisim" $SourceFiles = dir "$SourceDirectory\unisims\primitive\*.vhd*" - - $ErrorCount += 0 - Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -197,9 +208,8 @@ if ((-not $StopCompiling) -and $Unisim) if ((-not $StopCompiling) -and $Unisim) { $Library = "unisim" $SourceFiles = dir "$SourceDirectory\unisims\retarget\*.vhd*" - - $ErrorCount += 0 - Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -207,9 +217,8 @@ if ((-not $StopCompiling) -and $Unisim) if ((-not $StopCompiling) -and $Unisim -and $SecureIP) { $Library = "secureip" $SourceFiles = dir "$SourceDirectory\unisims\secureip\*.vhd*" - - $ErrorCount += 0 - Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -222,9 +231,8 @@ if ((-not $StopCompiling) -and $Unimacro) "unimacro\unimacro_VCOMP.vhd" ) $SourceFiles = $Files | % { "$SourceDirectory\$_" } - - $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -232,9 +240,8 @@ if ((-not $StopCompiling) -and $Unimacro) if ((-not $StopCompiling) -and $Unimacro) { $Library = "unimacro" $SourceFiles = dir "$SourceDirectory\unimacro\*_MACRO.vhd*" - - $ErrorCount += 0 - Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + + $ErrorCount += Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -245,8 +252,8 @@ if ((-not $StopCompiling) -and $Unimacro) Write-Host "--------------------------------------------------------------------------------" Write-Host "Compiling Xilinx Vivado libraries " -NoNewline if ($ErrorCount -gt 0) -{ Write-Host "[FAILED]" -ForegroundColor Red } +{ Write-Host "[FAILED]" -ForegroundColor Red } else -{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green } +{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green } Exit-CompileScript diff --git a/libraries/vendors/compile-xilinx-vivado.sh b/libraries/vendors/compile-xilinx-vivado.sh index 4c5763a34..19ed9e523 100755 --- a/libraries/vendors/compile-xilinx-vivado.sh +++ b/libraries/vendors/compile-xilinx-vivado.sh @@ -4,34 +4,34 @@ # kate: tab-width 2; replace-tabs off; indent-width 2; # # ============================================================================== -# Authors: Patrick Lehmann +# Authors: +# Patrick Lehmann # -# Bash Script: Script to compile the simulation libraries from Xilinx Vivado -# for GHDL on Linux +# Bash Script: +# Script to compile the simulation libraries from Xilinx Vivado +# for GHDL on Linux # # Description: # ------------------------------------ -# This is a Bash script (executable) which: -# - creates a subdirectory in the current working directory -# - compiles all Xilinx Vivado simulation libraries and packages +# This is a Bash script (executable) which: +# - creates a subdirectory in the current working directory +# - compiles all Xilinx Vivado simulation libraries and packages # # ============================================================================== -# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany -# -# GHDL is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2, or (at your option) any later -# version. -# -# GHDL 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 GHDL; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# 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>. # ============================================================================== # --------------------------------------------- diff --git a/libraries/vendors/config.psm1 b/libraries/vendors/config.psm1 index c04223a90..a58b2c4a1 100644 --- a/libraries/vendors/config.psm1 +++ b/libraries/vendors/config.psm1 @@ -1,36 +1,31 @@ -# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*- -# vim: tabstop=2:shiftwidth=2:noexpandtab -# kate: tab-width 2; replace-tabs off; indent-width 2; -# # ============================================================================== -# Authors: Patrick Lehmann -# -# PowerShell Module: Configurable directories to local installed tools -# -# Description: -# ------------------------------------ -# This PowerShell module exports variables containing the users local tool -# environment. +# Authors: +# Patrick Lehmann # # ============================================================================== -# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany -# Copyright (C) 2017-2018 Patrick Lehmann - Freiburg, Germany -# -# GHDL is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2, or (at your option) any later -# version. -# -# GHDL 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 GHDL; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# 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( @@ -40,7 +35,7 @@ param( $Module_VendorToolName = $VendorToolName # Configure your tools here. Use absolute paths, without trailing directory -# delimiter. Empty strings indicate not installed tools +# delimiter. Empty strings indicate not installed tools $Settings = @{ "AlteraQuartus" = @{ "InstallationDirectory" = ""; # "C:\Altera\16.0\quartus"; @@ -48,22 +43,22 @@ $Settings = @{ "DestinationDirectory" = "altera" }; "IntelQuartus" = @{ - "InstallationDirectory" = ""; # "C:\IntelFPGA\17.1\quartus"; + "InstallationDirectory" = ""; # "C:\IntelFPGA\20.1\quartus"; "SourceDirectory" = "eda\sim_lib"; "DestinationDirectory" = "intel" }; "LatticeDiamond" = @{ - "InstallationDirectory" = ""; # "C:\Lattice\Diamond\3.8_x64"; + "InstallationDirectory" = ""; # "C:\Lattice\Diamond\3.10_x64"; "SourceDirectory" = "cae_library\simulation\vhdl"; "DestinationDirectory" = "lattice" }; "OSVVM" = @{ - "InstallationDirectory" = ""; # "C:\git\GitHub\osvvm"; + "InstallationDirectory" = ""; # "C:\git\GitHub\OSVVM"; "SourceDirectory" = "."; "DestinationDirectory" = "." }; "UVVM" = @{ - "InstallationDirectory" = ""; # "C:\git\GitHub\uvvm_alls"; + "InstallationDirectory" = ""; # "C:\git\GitHub\UVVM"; "SourceDirectory" = "."; "DestinationDirectory" = "." }; @@ -73,7 +68,7 @@ $Settings = @{ "DestinationDirectory" = "xilinx-ise" }; "XilinxVivado" = @{ - "InstallationDirectory" = ""; # "C:\Xilinx\Vivado\2017.4"; + "InstallationDirectory" = ""; # "C:\Xilinx\Vivado\2020.2"; "SourceDirectory" = "data\vhdl\src"; "DestinationDirectory" = "xilinx-vivado" } @@ -84,7 +79,7 @@ function Get-VendorToolInstallationDirectory { <# .SYNOPSIS Undocumented - + .DESCRIPTION Undocumented #> @@ -95,7 +90,7 @@ function Get-VendorToolSourceDirectory { <# .SYNOPSIS Undocumented - + .DESCRIPTION Undocumented #> @@ -106,7 +101,7 @@ function Get-VendorToolDestinationDirectory { <# .SYNOPSIS Undocumented - + .DESCRIPTION Undocumented #> diff --git a/libraries/vendors/config.sh b/libraries/vendors/config.sh index 87dbd770d..f756c00e1 100755 --- a/libraries/vendors/config.sh +++ b/libraries/vendors/config.sh @@ -2,34 +2,32 @@ # EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*- # vim: tabstop=2:shiftwidth=2:noexpandtab # kate: tab-width 2; replace-tabs off; indent-width 2; -# # ============================================================================== -# Authors: Patrick Lehmann -# -# Bash Script: Configurable directories to local installed tools -# +# Authors: +# Patrick Lehmann +# +# Bash Script: Configurable directories to local installed tools +# # Description: # ------------------------------------ -# This Bash file exports variables containing the users local tool environment. +# This Bash file exports variables containing the users local tool environment. # # ============================================================================== -# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany -# Copyright (C) 2017-2018 Patrick Lehmann - Freiburg, Germany -# -# GHDL is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2, or (at your option) any later -# version. -# -# GHDL 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 GHDL; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# 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>. # ============================================================================== @@ -37,17 +35,17 @@ # - vendor tool chain installation paths or # - library root directories # in the following dictionary. -# -# These values are used if no command line argument (--src) is passed to a +# +# These values are used if no command line argument (--source) is passed to a # compile script. Empty strings means not configured. declare -A InstallationDirectories InstallationDirectories[AlteraQuartus]="" # "/opt/altera/16.0/quartus" -InstallationDirectories[IntelQuartus]="" # "/opt/intelFPGA/17.1/quartus" -InstallationDirectories[LatticeDiamond]="" # "/usr/local/diamond/3.7_x64" +InstallationDirectories[IntelQuartus]="" # "/opt/intelFPGA/20.1/quartus" +InstallationDirectories[LatticeDiamond]="" # "/usr/local/diamond/3.10_x64" InstallationDirectories[OSVVM]="" # "~/git/github/osvvm" InstallationDirectories[UVVM]="" # "~/git/github/uvvm_all" InstallationDirectories[XilinxISE]="" # "/opt/Xilinx/14.7/ISE_DS/ISE" -InstallationDirectories[XilinxVivado]="" # "/opt/Xilinx/Vivado/2017.4" +InstallationDirectories[XilinxVivado]="" # "/opt/Xilinx/Vivado/2020.2" # Configure preferred output directories for each library set: declare -A DestinationDirectories diff --git a/libraries/vendors/shared.psm1 b/libraries/vendors/shared.psm1 index 3ff91c2db..8c7c0fb08 100644 --- a/libraries/vendors/shared.psm1 +++ b/libraries/vendors/shared.psm1 @@ -1,55 +1,48 @@ -# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*- -# vim: tabstop=2:shiftwidth=2:noexpandtab -# kate: tab-width 2; replace-tabs off; indent-width 2; -# # ============================================================================== -# Authors: Patrick Lehmann -# -# PowerShell Module: The 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). +# Authors: Patrick Lehmann # # ============================================================================== -# Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany -# Copyright (C) 2017 Patrick Lehmann - Freiburg, Germany -# -# GHDL is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2, or (at your option) any later -# version. -# -# GHDL 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 GHDL; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# 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 +$Module_VendorToolName = $VendorToolName +$Module_WorkingDir = $WorkingDir function Exit-CompileScript { <# .SYNOPSIS Undocumented - + .DESCRIPTION Undocumented - + .PARAMETER ExitCode ExitCode of this script run #> @@ -57,29 +50,24 @@ function Exit-CompileScript param( [int]$ExitCode = 0 ) - + cd $Module_WorkingDir - + # unload modules Remove-Module config -Verbose:$false Remove-Module shared -Verbose:$false - - if ($ExitCode -eq 0) - { exit 0 } - else - { Write-Host "[DEBUG]: HARD EXIT" -ForegroundColor Red - exit $ExitCode - } + + exit $ExitCode } function Get-SourceDirectory { <# .SYNOPSIS Undocumented - + .DESCRIPTION Undocumented - + .PARAMETER Source Undocumented .PARAMETER EnvSource @@ -93,24 +81,24 @@ function Get-SourceDirectory $VendorToolInstallationDirectory = Get-VendorToolInstallationDirectory $VendorToolSourceDirectory = Get-VendorToolSourceDirectory - + if ($Source -ne "") - { $SourceDirectory = $Source.TrimEnd("\") } + { $SourceDirectory = $Source.TrimEnd("\") } elseif ($EnvSource -ne "") - { $SourceDirectory = $EnvSource } + { $SourceDirectory = $EnvSource } elseif ($VendorToolInstallationDirectory -ne "") - { $SourceDirectory = $VendorToolInstallationDirectory + "\" + $VendorToolSourceDirectory } + { $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) } @@ -118,10 +106,10 @@ function Get-DestinationDirectory { <# .SYNOPSIS Undocumented - + .DESCRIPTION Undocumented - + .PARAMETER Output Undocumented #> @@ -130,19 +118,19 @@ function Get-DestinationDirectory [string]$Output ) if ($Output -ne "") - { $DestinationDirectory = $Output.TrimEnd("\") } + { $DestinationDirectory = $Output.TrimEnd("\") } else - { $DestinationDirectory = Get-VendorToolDestinationDirectory } - + { $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" } - + { $DestinationDirectory = "$Module_WorkingDir\$DestinationDirectory" } + return $DestinationDirectory } @@ -150,10 +138,10 @@ function Get-GHDLBinary { <# .SYNOPSIS Undocumented - + .DESCRIPTION Undocumented - + .PARAMETER GHDL Undocumented #> @@ -163,17 +151,24 @@ function Get-GHDLBinary ) if ($GHDL -ne "") - { $GHDLBinary = $GHDL.TrimEnd("\") + "\ghdl.exe" } + { $GHDLBinary = $GHDL } elseif (Test-Path env:GHDL) - { $GHDLBinary = $env:GHDL.TrimEnd("\") + "\ghdl.exe" } + { $GHDLBinary = $env:GHDL } else - { $GHDLBinary = "ghdl.exe" } - + { 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 } @@ -182,10 +177,10 @@ function Get-VHDLVariables { <# .SYNOPSIS Undocumented - + .DESCRIPTION Undocumented - + .PARAMETER VHDL93 Undocumented .PARAMETER VHDL2008 @@ -193,24 +188,24 @@ function Get-VHDLVariables #> [CmdletBinding()] param( - [bool]$VHDL93 = $false, + [bool]$VHDL93 = $false, [bool]$VHDL2008 = $true ) - + if ($VHDL93) - { $VHDLVersion = "v93" - $VHDLStandard = "93c" - $VHDLFlavor = "synopsys" + { $VHDLVersion = "v93" + $VHDLStandard = "93c" + $VHDLFlavor = "synopsys" } elseif ($VHDL2008) - { $VHDLVersion = "v08" + { $VHDLVersion = "v08" $VHDLStandard = "08" - $VHDLFlavor = "synopsys" + $VHDLFlavor = "synopsys" } else - { $VHDLVersion = "v93" + { $VHDLVersion = "v93" $VHDLStandard = "93c" - $VHDLFlavor = "synopsys" + $VHDLFlavor = "synopsys" } return $VHDLVersion,$VHDLStandard,$VHDLFlavor } @@ -219,10 +214,10 @@ function New-DestinationDirectory { <# .SYNOPSIS Undocumented - + .DESCRIPTION Undocumented - + .PARAMETER DestinationDirectory Undocumented #> @@ -232,7 +227,7 @@ function New-DestinationDirectory ) if (Test-Path $DestinationDirectory -PathType Container) - { Write-Host "Vendor directory '$DestinationDirectory' already exists." -ForegroundColor Yellow } + { 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 @@ -247,10 +242,10 @@ function Start-PackageCompilation { <# .SYNOPSIS Undocumented - + .DESCRIPTION Undocumented - + .PARAMETER GHDLBinary Undocumented .PARAMETER GHDLOptions @@ -274,41 +269,48 @@ function Start-PackageCompilation [Parameter(Mandatory=$true)][bool]$HaltOnError ) # set default valuesvalues - $EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] - $EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug - + $EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] + $EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug + + if ($EnableDebug) + { $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 + $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 + $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' " + ($GHDLOptions -join " ") + " --work=$Library " + $File + " 2>&1" - $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null - $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + $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 } - } + { break } + } } - + cd $DestinationDirectory - # return $ErrorCount + return $ErrorCount } function Start-PrimitiveCompilation { <# .SYNOPSIS Undocumented - + .DESCRIPTION Undocumented - + .PARAMETER GHDLBinary Undocumented .PARAMETER GHDLOptions @@ -332,31 +334,38 @@ function Start-PrimitiveCompilation [Parameter(Mandatory=$true)][bool]$HaltOnError ) # set default values - $EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] - $EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug - - Write-Host "Compiling library '$Library' ..." -ForegroundColor Yellow + $EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] + $EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug + + if ($EnableDebug) + { $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 + $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 + $EnableDebug -and (Write-Host " cd $LibraryDirectory" -ForegroundColor DarkGray ) | Out-Null cd $LibraryDirectory $ErrorCount = 0 foreach ($File in $SourceFiles) { Write-Host " Analyzing primitive file '$File'" -ForegroundColor DarkCyan $InvokeExpr = "& '$GHDLBinary' " + ($GHDLOptions -join " ") + " --work=$Library " + $File + " 2>&1" - $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null - $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + $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 } + { break } } } - + cd $DestinationDirectory - # return $ErrorCount + return $ErrorCount } @@ -365,11 +374,11 @@ 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. #> @@ -379,33 +388,19 @@ function Restore-NativeCommandStream $InputObject ) - begin - { $LineRemainer = "" } - 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") - { $NewLine = $LineRemainer + $InputObject.ToString() - while (($NewLinePos = $NewLine.IndexOf("`n")) -ne -1) - { Write-Output $NewLine.Substring(0, $NewLinePos) - $NewLine = $NewLine.Substring($NewLinePos + 1) - } - $LineRemainer = $NewLine - } - } - elseif ($InputObject -is [String]) - { Write-Output $InputObject } - else - { Write-Host "Unsupported object in pipeline stream" } - } - - end - { if ($LineRemainer -ne "") - { Write-Output $LineRemainer } + { 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" } } } @@ -413,11 +408,11 @@ 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 @@ -429,7 +424,7 @@ function Write-ColoredGHDLLine param( [Parameter(ValueFromPipeline=$true)] $InputObject, - + [Parameter(Position=1)] [switch]$SuppressWarnings = $false, [Parameter(Position=2)] @@ -437,35 +432,49 @@ function Write-ColoredGHDLLine ) begin - { $ErrorRecordFound = $false } - + { $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 "${Indent}WARNING: " -NoNewline -ForegroundColor Yellow Write-Host $InputObject } } elseif ($InputObject -match ":\d+:\d+:\s") - { $ErrorRecordFound = $true - Write-Host "${Indent}ERROR: " -NoNewline -ForegroundColor Red + { $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 + { $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" } + { Write-Host "${Indent}$InputObject" } } else - { Write-Host "Unsupported object in pipeline stream" } + { Write-Host "Unsupported object in pipeline stream" } } end - { $ErrorRecordFound } + { $ErrorRecordFound } } Export-ModuleMember -Function 'Exit-CompileScript' diff --git a/libraries/vendors/shared.sh b/libraries/vendors/shared.sh index e1d7f4391..4f6470b6e 100755 --- a/libraries/vendors/shared.sh +++ b/libraries/vendors/shared.sh @@ -14,20 +14,18 @@ # ============================================================================== # Copyright (C) 2015-2016 Patrick Lehmann - Dresden, Germany # -# GHDL is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2, or (at your option) any later -# version. -# -# GHDL 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 GHDL; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# 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>. # ============================================================================== # red texts |