aboutsummaryrefslogtreecommitdiffstats
path: root/libraries/vendors/compile-xilinx-ise.ps1
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2015-11-25 04:16:47 +0100
committerTristan Gingold <gingold@adacore.com>2015-11-25 04:16:47 +0100
commitf7cfcfe15528a1619927aa61d138bbc87b2a2b5b (patch)
tree59cb32f67befbc431450b000bbf440336804e377 /libraries/vendors/compile-xilinx-ise.ps1
parentbd320d6260009f7d625bb70954d84bdec32b7917 (diff)
downloadghdl-f7cfcfe15528a1619927aa61d138bbc87b2a2b5b.tar.gz
ghdl-f7cfcfe15528a1619927aa61d138bbc87b2a2b5b.tar.bz2
ghdl-f7cfcfe15528a1619927aa61d138bbc87b2a2b5b.zip
Add vendor specific compile scripts (from Patrick Lehmann).
for: Altera Quartus-II (tested with 15.0), Xilinx ISE (tested with 14.7) Xilinx Vivado vunit OSVVM.
Diffstat (limited to 'libraries/vendors/compile-xilinx-ise.ps1')
-rw-r--r--libraries/vendors/compile-xilinx-ise.ps1258
1 files changed, 258 insertions, 0 deletions
diff --git a/libraries/vendors/compile-xilinx-ise.ps1 b/libraries/vendors/compile-xilinx-ise.ps1
new file mode 100644
index 000000000..a993f83d9
--- /dev/null
+++ b/libraries/vendors/compile-xilinx-ise.ps1
@@ -0,0 +1,258 @@
+# 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;
+#
+# ==============================================================================
+# PowerShell Script: Script to compile the simulation libraries from Xilinx ISE
+# for GHDL on Windows
+#
+# Authors: Patrick Lehmann
+#
+# Description:
+# ------------------------------------
+# This is a PowerShell script (executable) which:
+# - creates a subdirectory in the current working directory
+# - compiles all Xilinx ISE simulation libraries and packages
+#
+# ==============================================================================
+# Copyright (C) 2015 Patrick Lehmann
+#
+# 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 simulation libraries from Xilinx.
+#
+# .DESCRIPTION
+# This CmdLet:
+# (1) creates a subdirectory in the current working directory
+# (2) compiles all Xilinx ISE simulation libraries and packages
+# - unisim (incl. secureip)
+# - unimacro
+# - simprim (incl. secureip)
+#
+[CmdletBinding()]
+param(
+ # Compile all libraries and packages.
+ [switch]$All = $null,
+
+ # Compile the Xilinx simulation library.
+ [switch]$Unisim = $false,
+
+ # Compile the Xilinx macro library.
+ [switch]$Unimacro = $false,
+
+ # Compile the Xilinx post-map simulation library.
+ [switch]$Simprim = $false,
+
+ # Compile the Xilinx secureip library.
+ [switch]$SecureIP = $false,
+
+ # Clean up directory before analyzing.
+ [switch]$Clean = $false,
+
+ # Skip warning messages. (Show errors only.)
+ [switch]$SuppressWarnings = $false
+)
+
+# ---------------------------------------------
+# save working directory
+$WorkingDir = Get-Location
+
+# load modules from GHDL's 'vendors' library directory
+Import-Module $PSScriptRoot\config.psm1
+Import-Module $PSScriptRoot\shared.psm1
+
+# extract data from configuration
+$SourceDir = $InstallationDirectory["XilinxISE"] + "\ISE_DS\ISE\vhdl\src"
+$DestinationDir = $DestinationDirectory["XilinxISE"]
+
+if (-not $All)
+{ $All = $false }
+elseif ($All -eq $true)
+{ $Unisim = $true
+ $Simprim = $true
+ $Unimacro = $true
+ $SecureIP = $true
+}
+$StopCompiling = $false
+
+
+# define global GHDL Options
+$GlobalOptions = ("-a", "-fexplicit", "-frelaxed-rules", "--no-vital-checks", "--warn-binding", "--mb-comments")
+
+# create "Xilinx" directory and change to it
+Write-Host "Creating vendor directory: '$DestinationDir'" -ForegroundColor Yellow
+mkdir $DestinationDir -ErrorAction SilentlyContinue | Out-Null
+cd $DestinationDir
+
+# Cleanup
+# ==============================================================================
+if ($Clean)
+{ Write-Host "Cleaning up vendor directory ..." -ForegroundColor Yellow
+ rm *.cf
+}
+
+# Library UNISIM
+# ==============================================================================
+# compile unisim packages
+if ((-not $StopCompiling) -and $Unisim)
+{ Write-Host "Compiling library 'unisim' ..." -ForegroundColor Yellow
+ $Options = $GlobalOptions
+ $Options += "--ieee=synopsys"
+ $Options += "--std=93c"
+ $Files = (
+ "$SourceDir\unisims\unisim_VPKG.vhd",
+ "$SourceDir\unisims\unisim_VCOMP.vhd")
+ foreach ($File in $Files)
+ { Write-Host "Analyzing package '$File'" -ForegroundColor Cyan
+ $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=unisim " + $File + " 2>&1"
+ $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings
+ $StopCompiling = ($LastExitCode -ne 0)
+ if ($StopCompiling) { break }
+ }
+}
+
+# compile unisim primitives
+if ((-not $StopCompiling) -and $Unisim)
+{ $Options = $GlobalOptions
+ $Options += "--ieee=synopsys"
+ $Options += "--std=93c"
+ $Files = dir "$SourceDir\unisims\primitive\*.vhd*"
+ foreach ($File in $Files)
+ { Write-Host "Analyzing primitive '$($File.FullName)'" -ForegroundColor Cyan
+ $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=unisim " + $File.FullName + " 2>&1"
+ $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings
+ $StopCompiling = ($LastExitCode -ne 0)
+ if ($StopCompiling) { break }
+ }
+}
+
+# compile unisim secureip primitives
+if ((-not $StopCompiling) -and $Unisim -and $SecureIP)
+{ Write-Host "Compiling library secureip primitives ..." -ForegroundColor Yellow
+ $Options = $GlobalOptions
+ $Options += "--ieee=synopsys"
+ $Options += "--std=93c"
+ $Files = dir "$SourceDir\unisims\secureip\*.vhd*"
+ foreach ($File in $Files)
+ { Write-Host "Analyzing primitive '$($File.FullName)'" -ForegroundColor Cyan
+ $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=secureip " + $File.FullName + " 2>&1"
+ $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings
+ $StopCompiling = ($LastExitCode -ne 0)
+ #if ($StopCompiling) { break }
+ }
+}
+
+# Library UNIMACRO
+# ==============================================================================
+# compile unimacro packages
+if ((-not $StopCompiling) -and $Unimacro)
+{ Write-Host "Compiling library 'unimacro' ..." -ForegroundColor Yellow
+ $Options = $GlobalOptions
+ $Options += "--ieee=synopsys"
+ $Options += "--std=93c"
+ $Files = @(
+ "$SourceDir\unimacro\unimacro_VCOMP.vhd")
+ foreach ($File in $Files)
+ { Write-Host "Analyzing package '$File'" -ForegroundColor Cyan
+ $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=unimacro " + $File + " 2>&1"
+ $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings
+ $StopCompiling = ($LastExitCode -ne 0)
+ if ($StopCompiling) { break }
+ }
+}
+
+# compile unimacro macros
+if ((-not $StopCompiling) -and $Unimacro)
+{ $Options = $GlobalOptions
+ $Options += "--ieee=synopsys"
+ $Options += "--std=93c"
+ $Files = dir "$SourceDir\unimacro\*_MACRO.vhd*"
+ foreach ($File in $Files)
+ { Write-Host "Analyzing primitive '$($File.FullName)'" -ForegroundColor Cyan
+ $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=unimacro " + $File.FullName + " 2>&1"
+ $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings
+ $StopCompiling = ($LastExitCode -ne 0)
+ if ($StopCompiling) { break }
+ }
+}
+
+# Library SIMPRIM
+# ==============================================================================
+# compile simprim packages
+if ((-not $StopCompiling) -and $Simprim)
+{ Write-Host "Compiling library 'simprim' ..." -ForegroundColor Yellow
+ $Options = $GlobalOptions
+ $Options += "--ieee=synopsys"
+ $Options += "--std=93c"
+ $Files = (
+ "$SourceDir\simprims\simprim_Vpackage.vhd",
+ "$SourceDir\simprims\simprim_Vcomponents.vhd")
+ foreach ($File in $Files)
+ { Write-Host "Analyzing package '$File'" -ForegroundColor Cyan
+ $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=simprim " + $File + " 2>&1"
+ $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings
+ $StopCompiling = ($LastExitCode -ne 0)
+ if ($StopCompiling) { break }
+ }
+}
+
+# compile simprim primitives
+if ((-not $StopCompiling) -and $Simprim)
+{ Write-Host "Compiling library 'simprim' ..." -ForegroundColor Yellow
+ $Options = $GlobalOptions
+ $Options += "--ieee=synopsys"
+ $Options += "--std=93c"
+ $Files = dir "$SourceDir\simprims\primitive\other\*.vhd*"
+ foreach ($File in $Files)
+ { Write-Host "Analyzing primitive '$($File.FullName)'" -ForegroundColor Cyan
+ $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=simprim " + $File.FullName + " 2>&1"
+ $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings
+ $StopCompiling = ($LastExitCode -ne 0)
+ #if ($StopCompiling) { break }
+ }
+}
+
+# compile simprim secureip primitives
+if ((-not $StopCompiling) -and $Simprim -and $SecureIP)
+{ Write-Host "Compiling secureip primitives ..." -ForegroundColor Yellow
+ $Options = $GlobalOptions
+ $Options += "--ieee=synopsys"
+ $Options += "--std=93c"
+ $Files = dir "$SourceDir\simprims\secureip\other\*.vhd*"
+ foreach ($File in $Files)
+ { Write-Host "Analyzing primitive '$($File.FullName)'" -ForegroundColor Cyan
+ $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=simprim " + $File.FullName + " 2>&1"
+ $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings
+ $StopCompiling = ($LastExitCode -ne 0)
+ #if ($StopCompiling) { break }
+ }
+}
+
+Write-Host "--------------------------------------------------------------------------------"
+Write-Host "Compiling Xilinx ISE libraries " -NoNewline
+if ($StopCompiling)
+{ Write-Host "[FAILED]" -ForegroundColor Red }
+else
+{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green }
+
+# unload PowerShell modules
+Remove-Module shared
+Remove-Module config
+
+# restore working directory
+cd $WorkingDir