diff options
Diffstat (limited to 'libraries/vendors/compile-xilinx-ise.ps1')
-rw-r--r-- | libraries/vendors/compile-xilinx-ise.ps1 | 229 |
1 files changed, 114 insertions, 115 deletions
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 |