diff options
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/vendors/compile-altera.ps1 | 22 | ||||
-rw-r--r-- | libraries/vendors/compile-intel.ps1 | 555 | ||||
-rw-r--r-- | libraries/vendors/compile-intel.sh | 712 | ||||
-rw-r--r-- | libraries/vendors/compile-lattice.ps1 | 16 | ||||
-rw-r--r-- | libraries/vendors/compile-osvvm.ps1 | 7 | ||||
-rw-r--r-- | libraries/vendors/compile-uvvm.ps1 | 114 | ||||
-rw-r--r-- | libraries/vendors/compile-uvvm.sh | 133 | ||||
-rw-r--r-- | libraries/vendors/compile-vunit.ps1 | 16 | ||||
-rw-r--r-- | libraries/vendors/compile-xilinx-ise.ps1 | 16 | ||||
-rw-r--r-- | libraries/vendors/compile-xilinx-vivado.ps1 | 20 | ||||
-rw-r--r-- | libraries/vendors/config.psm1 | 76 | ||||
-rw-r--r-- | libraries/vendors/config.sh | 4 | ||||
-rw-r--r-- | libraries/vendors/shared.psm1 | 60 |
13 files changed, 1560 insertions, 191 deletions
diff --git a/libraries/vendors/compile-altera.ps1 b/libraries/vendors/compile-altera.ps1 index 030c21926..a6b442926 100644 --- a/libraries/vendors/compile-altera.ps1 +++ b/libraries/vendors/compile-altera.ps1 @@ -16,6 +16,7 @@ # # ============================================================================== # 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 @@ -80,21 +81,21 @@ param( # Clean up directory before analyzing. [switch]$Clean = $false, - # Set VHDL Standard to '93 + # Set VHDL Standard to '93. [switch]$VHDL93 = $false, - # Set VHDL Standard to '08 + # Set VHDL Standard to '08. [switch]$VHDL2008 = $false, # Skip warning messages. (Show errors only.) [switch]$SuppressWarnings = $false, - # Halt on errors + # Halt on errors. [switch]$HaltOnError = $false, - # Set vendor library source directory + # Set vendor library source directory. [string]$Source = "", - # Set output directory name + # Set output directory name. [string]$Output = "", - # Set GHDL executable + # Set GHDL binary directory. [string]$GHDL = "" ) @@ -103,11 +104,8 @@ param( $WorkingDir = Get-Location # set default values -$EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"] -$EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"] -if ($EnableVerbose -eq $null) { $EnableVerbose = $false } -if ($EnableDebug -eq $null) { $EnableDebug = $false } -if ($EnableDebug -eq $true) { $EnableVerbose = $true } +$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] +$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug # load modules from GHDL's 'vendors' library directory Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -Debug:$false -ArgumentList "AlteraQuartus" @@ -137,7 +135,7 @@ function Get-AlteraQuartusDirectory foreach ($Drive in Get-DriveInfo) { $Path = $Drive.Name + "Altera" if (Test-Path $Path -PathType Container) - { foreach ($Major in 17..13) + { foreach ($Major in 16..13) { foreach ($Minor in 3..0) { $Dir = $Path + "\" + $Major + "." + $Minor + "\quartus" if (Test-Path $Dir -PathType Container) diff --git a/libraries/vendors/compile-intel.ps1 b/libraries/vendors/compile-intel.ps1 new file mode 100644 index 000000000..a5dd32302 --- /dev/null +++ b/libraries/vendors/compile-intel.ps1 @@ -0,0 +1,555 @@ +# 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 +# +# ============================================================================== +# 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 simulation libraries from Altera. +# +# .DESCRIPTION +# This CmdLet: +# (1) creates a subdirectory in the current working directory +# (2) compiles all Altera Quartus simulation libraries and packages +# o Altera standard libraries: lpm, sgate, altera, altera_mf, altera_lnsim +# o Altera device libraries: +# - arriaii, arriaii_pcie_hip, arriaiigz +# - arriav, arriavgz, arriavgz_pcie_hip +# - cycloneiv, cycloneiv_pcie_hip, cycloneive +# - cyclonev +# - max, maxii, maxv +# - stratixiv, stratixiv_pcie_hip +# - stratixv, stratixv_pcie_hip +# - fiftyfivenm, twentynm +# +[CmdletBinding()] +param( + # Show the embedded help page(s) + [switch]$Help = $false, + + # Compile all libraries and packages. + [switch]$All = $false, + + # Compile the Altera standard libraries: lpm, sgate, altera, altera_mf, altera_lnsim + [switch]$Altera = $false, + + # Compile the Altera Max device libraries + [switch]$Max = $false, + + # Compile the Altera Cyclone device libraries + [switch]$Cyclone = $false, + + # Compile the Altera Arria device libraries + [switch]$Arria = $false, + + # Compile the Altera Stratix device libraries + [switch]$Stratix = $false, + + # Unknown device library + [switch]$Nanometer = $false, + + # Clean up directory before analyzing. + [switch]$Clean = $false, + + # Set VHDL Standard to '93. + [switch]$VHDL93 = $false, + # Set VHDL Standard to '08. + [switch]$VHDL2008 = $false, + + # Skip warning messages. (Show errors only.) + [switch]$SuppressWarnings = $false, + # Halt on errors. + [switch]$HaltOnError = $false, + + # Set vendor library source directory. + [string]$Source = "", + # Set output directory name. + [string]$Output = "", + # Set GHDL binary directory. + [string]$GHDL = "" +) + +# --------------------------------------------- +# save working directory +$WorkingDir = Get-Location + +# set default values +$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] +$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug + +# load modules from GHDL's 'vendors' library directory +$EnableVerbose -and (Write-Host "Loading modules..." -ForegroundColor Gray ) | Out-Null +$EnableDebug -and (Write-Host " Import-Module $PSScriptRoot\config.psm1 -Verbose:`$$false -Debug:`$$false -ArgumentList `"IntelQuartus`"" -ForegroundColor DarkGray ) | Out-Null +Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -Debug:$false -ArgumentList "IntelQuartus" +$EnableDebug -and (Write-Host " Import-Module $PSScriptRoot\shared.psm1 -Verbose:`$$false -Debug:`$$false -ArgumentList @(`"Intel Quartus Prime`", `"$WorkingDir`")" -ForegroundColor DarkGray ) | Out-Null +Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -Debug:$false -ArgumentList @("Intel Quartus Prime", "$WorkingDir") + +# Display help if no command was selected +$Help = $Help -or (-not ($All -or $Altera -or $Max -or $Cyclone -or $Arria -or $Stratix -or $Nanometer -or $Clean)) + +if ($Help) +{ Get-Help $MYINVOCATION.InvocationName -Detailed + Exit-CompileScript +} +if ($All) +{ $Altera = $true + $Max = $true + $Cyclone = $true + $Arria = $true + $Stratix = $true + $Nanometer = $true +} + +function Get-AlteraQuartusDirectory +{ if (Test-Path env:QUARTUS_ROOTDIR) + { return $QUARTUS_ROOTDIR + "\" + (Get-VendorToolSourceDirectory) } + else + { $EnvSourceDir = "" + foreach ($Drive in Get-DriveInfo) + { $Path = $Drive.Name + "Altera" + if (Test-Path $Path -PathType Container) + { foreach ($Major in 16..13) + { foreach ($Minor in 3..0) + { $Dir = $Path + "\" + $Major + "." + $Minor + "\quartus" + if (Test-Path $Dir -PathType Container) + { $EnvSourceDir = $Dir + "\" + (Get-VendorToolSourceDirectory) + return $EnvSourceDir + } + } + } + } + } + } +} + +$SourceDirectory = Get-SourceDirectory $Source (Get-AlteraQuartusDirectory) +$DestinationDirectory = Get-DestinationDirectory $Output +$GHDLBinary = Get-GHDLBinary $GHDL + +# create "Altera" directory and change to it +New-DestinationDirectory $DestinationDirectory +cd $DestinationDirectory + + +$VHDLVersion,$VHDLStandard,$VHDLFlavor = Get-VHDLVariables $VHDL93 $VHDL2008 + +# define global GHDL Options +$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" + +$StopCompiling = $false +$ErrorCount = 0 + +# Cleanup directories +# ============================================================================== +if ($Clean) +{ Write-Host "[ERROR]: '-Clean' is not implemented!" -ForegroundColor Red + Exit-CompileScript -1 + + Write-Host "Cleaning up vendor directory ..." -ForegroundColor Yellow + rm *.cf +} + + +# Altera standard libraries +# ============================================================================== +# compile lpm library +if ((-not $StopCompiling) -and $Altera) +{ $Library = "lpm" + $Files = @( + "220pack.vhd", + "220model.vhd" + ) + $SourceFiles = $Files | % { "$SourceDirectory\$_" } + + $ErrorCount += 0 + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) +} + +# compile sgate library +if ((-not $StopCompiling) -and $Altera) +{ $Library = "sgate" + $Files = @( + "sgate_pack.vhd", + "sgate.vhd" + ) + $SourceFiles = $Files | % { "$SourceDirectory\$_" } + + $ErrorCount += 0 + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) +} + +# compile altera library +if ((-not $StopCompiling) -and $Altera) +{ $Library = "altera" + $Files = @( + "altera_europa_support_lib.vhd", + "altera_primitives_components.vhd", + "altera_primitives.vhd", + "altera_standard_functions.vhd", + "altera_syn_attributes.vhd", + "alt_dspbuilder_package.vhd" + ) + $SourceFiles = $Files | % { "$SourceDirectory\$_" } + + $ErrorCount += 0 + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) +} + +# compile altera_mf library +if ((-not $StopCompiling) -and $Altera) +{ $Library = "altera_mf" + $Files = @( + "altera_mf_components.vhd", + "altera_mf.vhd" + ) + $SourceFiles = $Files | % { "$SourceDirectory\$_" } + + $ErrorCount += 0 + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) +} + +# compile altera_lnsim library +if ((-not $StopCompiling) -and $Altera) +{ $Library = "altera_lnsim" + $Files = @( + "altera_lnsim_components.vhd" + ) + $SourceFiles = $Files | % { "$SourceDirectory\$_" } + + $ErrorCount += 0 + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) +} + +# Altera device libraries +# ============================================================================== +# compile max library +if ((-not $StopCompiling) -and $Max) +{ $Library = "max" + $Files = @( + "max_atoms.vhd", + "max_components.vhd" + ) + $SourceFiles = $Files | % { "$SourceDirectory\$_" } + + $ErrorCount += 0 + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) +} + +# compile maxii library +if ((-not $StopCompiling) -and $Max) +{ $Library = "maxii" + $Files = @( + "maxii_atoms.vhd", + "maxii_components.vhd" + ) + $SourceFiles = $Files | % { "$SourceDirectory\$_" } + + $ErrorCount += 0 + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) +} + +# compile maxv library +if ((-not $StopCompiling) -and $Max) +{ $Library = "maxv" + $Files = @( + "maxv_atoms.vhd", + "maxv_components.vhd" + ) + $SourceFiles = $Files | % { "$SourceDirectory\$_" } + + $ErrorCount += 0 + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) +} + +# compile arriaii library +if ((-not $StopCompiling) -and $Arria) +{ $Library = "arriaii" + $Files = @( + "arriaii_atoms.vhd", + "arriaii_components.vhd", + "arriaii_hssi_components.vhd", + "arriaii_hssi_atoms.vhd" + ) + $SourceFiles = $Files | % { "$SourceDirectory\$_" } + + $ErrorCount += 0 + 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 +if ((-not $StopCompiling) -and $Arria) +{ $Library = "arriaii_pcie_hip" + $Files = @( + "arriaii_pcie_hip_components.vhd", + "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) +} + +# compile arriaiigz library +if ((-not $StopCompiling) -and $Arria) +{ $Library = "arriaiigz" + $Files = @( + "arriaiigz_atoms.vhd", + "arriaiigz_components.vhd", + "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) +} + +# compile arriav library +if ((-not $StopCompiling) -and $Arria) +{ $Library = "arriav" + $Files = @( + "arriav_atoms.vhd", + "arriav_components.vhd", + "arriav_hssi_components.vhd", + "arriav_hssi_atoms.vhd" + ) + $SourceFiles = $Files | % { "$SourceDirectory\$_" } + + $ErrorCount += 0 + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) +} + +# compile arriavgz library +if ((-not $StopCompiling) -and $Arria) +{ $Library = "arriavgz" + $Files = @( + "arriavgz_atoms.vhd", + "arriavgz_components.vhd", + "arriavgz_hssi_components.vhd", + "arriavgz_hssi_atoms.vhd" + ) + $SourceFiles = $Files | % { "$SourceDirectory\$_" } + + $ErrorCount += 0 + 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 +if ((-not $StopCompiling) -and $Arria) +{ $Library = "arriavgz_pcie_hip" + $Files = @( + "arriavgz_pcie_hip_components.vhd", + "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) +} + +# compile cycloneiv library +if ((-not $StopCompiling) -and $Cyclone) +{ $Library = "cycloneiv" + $Files = @( + "cycloneiv_atoms.vhd", + "cycloneiv_components.vhd", + "cycloneiv_hssi_components.vhd", + "cycloneiv_hssi_atoms.vhd" + ) + $SourceFiles = $Files | % { "$SourceDirectory\$_" } + + $ErrorCount += 0 + 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 +if ((-not $StopCompiling) -and $Cyclone) +{ $Library = "cycloneiv_pcie_hip" + $Files = @( + "cycloneiv_pcie_hip_components.vhd", + "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) +} + +# compile cycloneive library +if ((-not $StopCompiling) -and $Cyclone) +{ $Library = "cycloneive" + $Files = @( + "cycloneive_atoms.vhd", + "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) +} + +# compile cyclonev library +if ((-not $StopCompiling) -and $Cyclone) +{ $Library = "cyclonev" + $Files = @( + "cyclonev_atoms.vhd", + "cyclonev_components.vhd", + "cyclonev_hssi_components.vhd", + "cyclonev_hssi_atoms.vhd" + ) + $SourceFiles = $Files | % { "$SourceDirectory\$_" } + + $ErrorCount += 0 + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) +} + +# compile stratixiv library +if ((-not $StopCompiling) -and $Stratix) +{ $Library = "stratixiv" + $Files = @( + "stratixiv_atoms.vhd", + "stratixiv_components.vhd", + "stratixiv_hssi_components.vhd", + "stratixiv_hssi_atoms.vhd" + ) + $SourceFiles = $Files | % { "$SourceDirectory\$_" } + + $ErrorCount += 0 + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) +} + +# compile stratixiv_pcie_hip library +if ((-not $StopCompiling) -and $Stratix) +{ $Library = "stratixiv_pcie_hip" + $Files = @( + "stratixiv_pcie_hip_components.vhd", + "stratixiv_pcie_hip_atoms.vhd" + ) + $SourceFiles = $Files | % { "$SourceDirectory\$_" } + + $ErrorCount += 0 + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) +} + +# compile stratixv library +if ((-not $StopCompiling) -and $Stratix) +{ $Library = "stratixv" + $Files = @( + "stratixv_atoms.vhd", + "stratixv_components.vhd", + "stratixv_hssi_components.vhd", + "stratixv_hssi_atoms.vhd" + ) + $SourceFiles = $Files | % { "$SourceDirectory\$_" } + + $ErrorCount += 0 + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) +} + +# compile stratixv_pcie_hip library +if ((-not $StopCompiling) -and $Stratix) +{ $Library = "stratixv_pcie_hip" + $Files = @( + "stratixv_pcie_hip_components.vhd", + "stratixv_pcie_hip_atoms.vhd" + ) + $SourceFiles = $Files | % { "$SourceDirectory\$_" } + + $ErrorCount += 0 + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) +} + +# compile fiftyfivenm library +if ((-not $StopCompiling) -and $Nanometer) +{ $Library = "fiftyfivenm" + $Files = @( + "fiftyfivenm_atoms.vhd", + "fiftyfivenm_components.vhd" + ) + $SourceFiles = $Files | % { "$SourceDirectory\$_" } + + $ErrorCount += 0 + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug + $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) +} + +# compile twentynm library +if ((-not $StopCompiling) -and $Nanometer) +{ $Library = "twentynm" + $Files = @( + "twentynm_atoms.vhd", + "twentynm_components.vhd", + "twentynm_hip_components.vhd", + "twentynm_hip_atoms.vhd", + "twentynm_hssi_components.vhd", + "twentynm_hssi_atoms.vhd" + ) + $SourceFiles = $Files | % { "$SourceDirectory\$_" } + + $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 Altera libraries " -NoNewline +if ($ErrorCount -gt 0) +{ Write-Host "[FAILED]" -ForegroundColor Red } +else +{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green } + +Exit-CompileScript diff --git a/libraries/vendors/compile-intel.sh b/libraries/vendors/compile-intel.sh new file mode 100644 index 000000000..46cccfde1 --- /dev/null +++ b/libraries/vendors/compile-intel.sh @@ -0,0 +1,712 @@ +#! /usr/bin/env bash +# 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: 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 +# +# ============================================================================== +# 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. +# ============================================================================== + +# --------------------------------------------- +# work around for Darwin (Mac OS) +READLINK=readlink; if [[ $(uname) == "Darwin" ]]; then READLINK=greadlink; fi + +# save working directory +WorkingDir=$(pwd) +ScriptDir="$(dirname $0)" +ScriptDir="$($READLINK -f $ScriptDir)" + +# source configuration file from GHDL's 'vendors' library directory +. $ScriptDir/../ansi_color.sh +. $ScriptDir/config.sh +. $ScriptDir/shared.sh + +# command line argument processing +NO_COMMAND=1 +SKIP_EXISTING_FILES=0 +SKIP_LARGE_FILES=0 +SUPPRESS_WARNINGS=0 +HALT_ON_ERROR=0 +VHDLStandard=93 +GHDLBinDir="" +DestDir="" +SrcDir="" +while [[ $# > 0 ]]; do + key="$1" + case $key in + -c|--clean) + CLEAN=TRUE + NO_COMMAND=0 + ;; + -a|--all) + COMPILE_ALL=TRUE + NO_COMMAND=0 + ;; + --altera) + COMPILE_ALTERA=TRUE + NO_COMMAND=0 + ;; + --max) + COMPILE_MAX=TRUE + NO_COMMAND=0 + ;; + --cyclone) + COMPILE_CYCLONE=TRUE + NO_COMMAND=0 + ;; + --arria) + COMPILE_ARRIA=TRUE + NO_COMMAND=0 + ;; + --stratix) + COMPILE_STRATIX=TRUE + NO_COMMAND=0 + ;; + --nanometer) + COMPILE_NM=TRUE + NO_COMMAND=0 + ;; + -h|--help) + HELP=TRUE + NO_COMMAND=0 + ;; + -s|--skip-existing) + SKIP_EXISTING_FILES=1 + ;; + -S|--skip-largefiles) + SKIP_LARGE_FILES=1 + ;; + -n|--no-warnings) + SUPPRESS_WARNINGS=1 + ;; + -H|--halt-on-error) + HALT_ON_ERROR=1 + ;; + --vhdl93) + VHDLStandard=93 + ;; + --vhdl2008) + VHDLStandard=2008 + ;; + --ghdl) + GHDLBinDir="$2" + shift # skip argument + ;; + --src) + SrcDir="$2" + shift # skip argument + ;; + --out) + DestDir="$2" + shift # skip argument + ;; + *) # unknown option + echo 1>&2 -e "${COLORED_ERROR} Unknown command line option '$key'.${ANSI_NOCOLOR}" + exit -1 + ;; + esac + shift # past argument or value +done + +if [ $NO_COMMAND -eq 1 ]; then + HELP=TRUE +fi + +if [ "$HELP" == "TRUE" ]; then + test $NO_COMMAND -eq 1 && echo 1>&2 -e "\n${COLORED_ERROR} No command selected." + echo "" + echo "Synopsis:" + echo " A script to compile the Altera Quartus simulation libraries for GHDL on Linux." + echo " One library folder 'lib/v??' per VHDL library will be created relative to the current" + echo " working directory." + echo "" + echo " Use the adv. options or edit 'config.sh' to supply paths and default params." + echo "" + echo "Usage:" + echo " compile-altera.sh <common command>|<library> [<options>] [<adv. options>]" + echo "" + echo "Common commands:" + echo " -h --help Print this help page" + echo " -c --clean Remove all generated files" + echo "" + echo "Libraries:" + echo " -a --all Compile all Altera simulation libraries." + echo " --altera Compile the Altera standard libraries: lpm, sgate, altera, altera_mf, altera_lnsim." + echo " --max Compile the Altera Max device libraries." + echo " --cyclone Compile the Altera Cyclone device libraries." + echo " --arria Compile the Altera Arria device libraries." + echo " --stratix Compile the Altera Stratix device libraries." + echo " --nanometer Unknown device library." + echo "" + echo "Library compile options:" + echo " --vhdl93 Compile the libraries with VHDL-93." + echo " --vhdl2008 Compile the libraries with VHDL-2008." + echo " -s --skip-existing Skip already compiled files (an *.o file exists)." + echo " -S --skip-largefiles Don't compile large files. Exclude *HSSI* and *HIP* files." + echo " -H --halt-on-error Halt on error(s)." + echo "" + echo "Advanced options:" + echo " --ghdl <GHDL bin dir> Path to GHDL's binary directory, e.g. /usr/local/bin" + echo " --out <dir name> Name of the output directory, e.g. xilinx-vivado" + echo " --src <Path to lib> Path to the sources, e.g. /opt/altera/16.0/quartus/eda/sim_lib" + echo "" + echo "Verbosity:" + echo " -n --no-warnings Suppress all warnings. Show only error messages." + echo "" + exit 0 +fi + +if [ "$COMPILE_ALL" == "TRUE" ]; then + COMPILE_ALTERA=TRUE + COMPILE_MAX=TRUE + COMPILE_CYCLONE=TRUE + COMPILE_ARRIA=TRUE + COMPILE_STRATIX=TRUE + COMPILE_NM=TRUE +fi + +if [ $VHDLStandard -eq 2008 ]; then + echo -e "${ANSI_RED}Not all Altera packages are VHDL-2008 compatible! Setting HALT_ON_ERROR to FALSE.${ANSI_NOCOLOR}" + HALT_ON_ERROR=0 +fi + +DefaultDirectories=("/opt/Altera" "/opt/altera") +if [ ! -z $QUARTUS_ROOTDIR ]; then + EnvSourceDir=$QUARTUS_ROOTDIR/${SourceDirectories[AlteraQuartus]} +else + for DefaultDir in ${DefaultDirectories[@]}; do + for Major in 17 16 15 14 13; do + for Minor in 3 2 1 0; do + Dir=$DefaultDir/${Major}.${Minor}/quartus + if [ -d $Dir ]; then + EnvSourceDir=$Dir/${SourceDirectories[AlteraQuartus]} + break 3 + fi + done + done + done +fi + +# -> $SourceDirectories +# -> $DestinationDirectories +# -> $SrcDir +# -> $DestDir +# -> $GHDLBinDir +# <= $SourceDirectory +# <= $DestinationDirectory +# <= $GHDLBinary +SetupDirectories AlteraQuartus "Altera Quartus" + +# create "osvvm" directory and change to it +# => $DestinationDirectory +CreateDestinationDirectory +cd $DestinationDirectory + + +# => $SUPPRESS_WARNINGS +# <= $GRC_COMMAND +SetupGRCat + + +# -> $VHDLStandard +# <= $VHDLVersion +# <= $VHDLStandard +# <= $VHDLFlavor +GHDLSetup + +# define global GHDL Options +GHDL_OPTIONS=(-fexplicit -frelaxed-rules --no-vital-checks --warn-binding --mb-comments) + + +GHDL_PARAMS=(${GHDL_OPTIONS[@]}) +GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard -P$DestinationDirectory) + +STOPCOMPILING=0 +ERRORCOUNT=0 + +# Cleanup directories +# ============================================================================== +if [ "$CLEAN" == "TRUE" ]; then + echo 1>&2 -e "${COLORED_ERROR} '--clean' is not implemented!" + exit -1 + echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_NOCOLOR}" + rm *.o 2> /dev/null + rm *.cf 2> /dev/null +fi + + +# Altera standard libraries +# ============================================================================== +# compile lpm library +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ALTERA" == "TRUE" ]; then + Library="lpm" + Files=( + 220pack.vhd + 220model.vhd + ) + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +# compile sgate library +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ALTERA" == "TRUE" ]; then + Library="sgate" + Files=( + sgate_pack.vhd + sgate.vhd + ) + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +# compile altera library +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ALTERA" == "TRUE" ]; then + Library="altera" + Files=( + altera_europa_support_lib.vhd + altera_primitives_components.vhd + altera_primitives.vhd + altera_standard_functions.vhd + altera_syn_attributes.vhd + alt_dspbuilder_package.vhd + ) + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +# compile altera_mf library +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ALTERA" == "TRUE" ]; then + Library="altera_mf" + Files=( + altera_mf_components.vhd + altera_mf.vhd + ) + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +# compile altera_lnsim library +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ALTERA" == "TRUE" ]; then + Library="altera_lnsim" + Files=( + altera_lnsim_components.vhd + ) + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +# Altera device libraries +# ============================================================================== +# compile Max library +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_MAX" == "TRUE" ]; then + Library="max" + Files=( + max_atoms.vhd + max_components.vhd + ) + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +# compile MaxII library +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_MAX" == "TRUE" ]; then + Library="maxii" + Files=( + maxii_atoms.vhd + maxii_components.vhd + ) + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +# compile MaxV library +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_MAX" == "TRUE" ]; then + Library="maxv" + Files=( + maxv_atoms.vhd + maxv_components.vhd + ) + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +# compile ArriaII library +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ARRIA" == "TRUE" ]; then + Library="arriaii" + Files=( + arriaii_atoms.vhd + arriaii_components.vhd + ) + if [ $SKIP_LARGE_FILES -eq 0 ]; then + Files+=( + arriaii_hssi_components.vhd + arriaii_hssi_atoms.vhd + ) + fi + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ARRIA" == "TRUE" ] && [ $SKIP_LARGE_FILES -eq 0 ]; then + Library="arriaii_pcie_hip" + Files=( + arriaii_pcie_hip_components.vhd + arriaii_pcie_hip_atoms.vhd + ) + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +# compile ArriaIIGZ library +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ARRIA" == "TRUE" ]; then + Library="arriaiigz" + Files=( + arriaiigz_atoms.vhd + arriaiigz_components.vhd + ) + if [ $SKIP_LARGE_FILES -eq 0 ]; then + Files+=( + arriaiigz_hssi_components.vhd + ) + fi + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +# compile ArriaV library +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ARRIA" == "TRUE" ]; then + Library="arriav" + Files=( + arriav_atoms.vhd + arriav_components.vhd + ) + if [ $SKIP_LARGE_FILES -eq 0 ]; then + Files+=( + arriav_hssi_components.vhd + arriav_hssi_atoms.vhd + ) + fi + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +# compile ArriaVGZ library +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ARRIA" == "TRUE" ]; then + Library="arriavgz" + Files=( + arriavgz_atoms.vhd + arriavgz_components.vhd + ) + if [ $SKIP_LARGE_FILES -eq 0 ]; then + Files+=( + arriavgz_hssi_components.vhd + arriavgz_hssi_atoms.vhd + ) + fi + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_ARRIA" == "TRUE" ] && [ $SKIP_LARGE_FILES -eq 0 ]; then + Library="arriavgz_pcie_hip" + Files=( + arriavgz_pcie_hip_components.vhd + arriavgz_pcie_hip_atoms.vhd + ) + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +# compile CycloneIV library +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_CYCLONE" == "TRUE" ]; then + Library="cycloneiv" + Files=( + cycloneiv_atoms.vhd + cycloneiv_components.vhd + ) + if [ $SKIP_LARGE_FILES -eq 0 ]; then + Files+=( + cycloneiv_hssi_components.vhd + cycloneiv_hssi_atoms.vhd + ) + fi + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_CYCLONE" == "TRUE" ] && [ $SKIP_LARGE_FILES -eq 0 ]; then + Library="cycloneiv_pcie_hip" + Files=( + cycloneiv_pcie_hip_components.vhd + cycloneiv_pcie_hip_atoms.vhd + ) + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +# compile CycloneIVE library +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_CYCLONE" == "TRUE" ]; then + Library="cycloneive" + Files=( + cycloneive_atoms.vhd + cycloneive_components.vhd + ) + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +# compile CycloneV library +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_CYCLONE" == "TRUE" ]; then + Library="cyclonev" + Files=( + cyclonev_atoms.vhd + cyclonev_components.vhd + ) + if [ $SKIP_LARGE_FILES -eq 0 ]; then + Files+=( + cyclonev_hssi_components.vhd + cyclonev_hssi_atoms.vhd + ) + fi + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +# compile StratixIV library +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_STRATIX" == "TRUE" ]; then + Library="stratixiv" + Files=( + stratixiv_atoms.vhd + stratixiv_components.vhd + ) + if [ $SKIP_LARGE_FILES -eq 0 ]; then + Files+=( + stratixiv_hssi_components.vhd + stratixiv_hssi_atoms.vhd + ) + fi + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_STRATIX" == "TRUE" ] && [ $SKIP_LARGE_FILES -eq 0 ]; then + Library="stratixiv_pcie_hip" + Files=( + stratixiv_pcie_hip_components.vhd + stratixiv_pcie_hip_atoms.vhd + ) + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +# compile StratixV library +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_STRATIX" == "TRUE" ]; then + Library="stratixv" + Files=( + stratixv_atoms.vhd + stratixv_components.vhd + ) + if [ $SKIP_LARGE_FILES -eq 0 ]; then + Files+=( + stratixv_hssi_components.vhd + stratixv_hssi_atoms.vhd + ) + fi + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_STRATIX" == "TRUE" ] && [ $SKIP_LARGE_FILES -eq 0 ]; then + Library="stratixv_pcie_hip" + Files=( + stratixv_pcie_hip_components.vhd + stratixv_pcie_hip_atoms.vhd + ) + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +# compile fiftyfivenm library +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_NM" == "TRUE" ]; then + Library="fiftyfivenm" + Files=( + fiftyfivenm_atoms.vhd + fiftyfivenm_components.vhd + ) + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +# compile twentynm library +if [ $STOPCOMPILING -eq 0 ] && [ "$COMPILE_NM" == "TRUE" ]; then + Library="twentynm" + Files=( + twentynm_atoms.vhd + twentynm_components.vhd + ) + if [ $SKIP_LARGE_FILES -eq 0 ]; then + Files+=( + twentynm_hip_components.vhd + twentynm_hip_atoms.vhd + twentynm_hssi_components.vhd + twentynm_hssi_atoms.vhd + ) + fi + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + +echo "--------------------------------------------------------------------------------" +echo -n "Compiling Altera Quartus libraries " +if [ $ERRORCOUNT -gt 0 ]; then + echo -e $COLORED_FAILED +else + echo -e $COLORED_SUCCESSFUL +fi diff --git a/libraries/vendors/compile-lattice.ps1 b/libraries/vendors/compile-lattice.ps1 index 789e6bd65..2761bf816 100644 --- a/libraries/vendors/compile-lattice.ps1 +++ b/libraries/vendors/compile-lattice.ps1 @@ -16,6 +16,7 @@ # # ============================================================================== # 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 @@ -98,14 +99,14 @@ param( # Skip warning messages. (Show errors only.) [switch]$SuppressWarnings = $false, - # Halt on errors + # Halt on errors. [switch]$HaltOnError = $false, - # Set vendor library source directory + # Set vendor library source directory. [string]$Source = "", - # Set output directory name + # Set output directory name. [string]$Output = "", - # Set GHDL executable + # Set GHDL binary directory. [string]$GHDL = "" ) @@ -114,11 +115,8 @@ param( $WorkingDir = Get-Location # set default values -$EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"] -$EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"] -if ($EnableVerbose -eq $null) { $EnableVerbose = $false } -if ($EnableDebug -eq $null) { $EnableDebug = $false } -if ($EnableDebug -eq $true) { $EnableVerbose = $true } +$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] +$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug # load modules from GHDL's 'vendors' library directory Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -Debug:$false -ArgumentList "LatticeDiamond" diff --git a/libraries/vendors/compile-osvvm.ps1 b/libraries/vendors/compile-osvvm.ps1 index 8b047adfd..bdf222810 100644 --- a/libraries/vendors/compile-osvvm.ps1 +++ b/libraries/vendors/compile-osvvm.ps1 @@ -15,6 +15,7 @@ #
# ==============================================================================
# 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
@@ -59,11 +60,11 @@ param( # Halt on errors
[switch]$HaltOnError = $false,
- # Set vendor library source directory
+ # Set vendor library source directory.
[string]$Source = "",
- # Set output directory name
+ # Set output directory name.
[string]$Output = "",
- # Set GHDL executable
+ # Set GHDL binary directory.
[string]$GHDL = ""
)
diff --git a/libraries/vendors/compile-uvvm.ps1 b/libraries/vendors/compile-uvvm.ps1 index 8e53adb77..be9ca1d97 100644 --- a/libraries/vendors/compile-uvvm.ps1 +++ b/libraries/vendors/compile-uvvm.ps1 @@ -15,6 +15,7 @@ # # ============================================================================== # 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 @@ -56,14 +57,20 @@ param( [switch]$UVVM_VCC_Framework = $true, # 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, @@ -79,7 +86,7 @@ param( [string]$Source = "", # Set output directory name. [string]$Output = "", - # Set GHDL executable. + # Set GHDL binary directory. [string]$GHDL = "" ) @@ -98,7 +105,8 @@ Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -Debug:$false -ArgumentL # 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_AXI_Lite -or $UVVM_VIP_AXI_Stream -or $UVVM_VIP_I2C -or $UVVM_VIP_SBI -or $UVVM_VIP_UART)) ))) + ($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)) ))) { Get-Help $MYINVOCATION.InvocationName -Detailed Exit-CompileScript } @@ -112,10 +120,13 @@ if ($UVVM) $UVVM_VCC_Framework = $true } if ($UVVM_VIP) -{ $UVVM_VIP_AXI_Lite = $true +{ $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 } @@ -124,7 +135,7 @@ $SourceDirectory = Get-SourceDirectory $Source "" $DestinationDirectory = Get-DestinationDirectory $Output $GHDLBinary = Get-GHDLBinary $GHDL -# create "Altera" directory and change to it +# create "uvvm" directory and change to it New-DestinationDirectory $DestinationDirectory cd $DestinationDirectory @@ -169,81 +180,30 @@ $UVVM_VVC_Files = @( "uvvm_vvc_framework\src\ti_data_stack_pkg.vhd" "uvvm_vvc_framework\src\ti_uvvm_engine.vhd" ) -$VIP_Files = @{ - "AXILite" = @{ - "Variable" = "UVVM_VIP_AXI_Lite"; - "Library" = "bitvis_vip_axilite"; - "Files" = @( - "bitvis_vip_axilite\src\axilite_bfm_pkg.vhd", - "bitvis_vip_axilite\src\vvc_cmd_pkg.vhd", - "uvvm_vvc_framework\src_target_dependent\td_target_support_pkg.vhd", - "uvvm_vvc_framework\src_target_dependent\td_vvc_framework_common_methods_pkg.vhd", - "bitvis_vip_axilite\src\vvc_methods_pkg.vhd", - "uvvm_vvc_framework\src_target_dependent\td_queue_pkg.vhd", - "uvvm_vvc_framework\src_target_dependent\td_vvc_entity_support_pkg.vhd", - "bitvis_vip_axilite\src\axilite_vvc.vhd" - ) - }; - "AXIStream" = @{ - "Variable" = "UVVM_VIP_AXI_Stream"; - "Library" = "bitvis_vip_axistream"; - "Files" = @( - "bitvis_vip_axistream\src\axistream_bfm_pkg.vhd", - "bitvis_vip_axistream\src\vvc_cmd_pkg.vhd", - "uvvm_vvc_framework\src_target_dependent\td_target_support_pkg.vhd", - "uvvm_vvc_framework\src_target_dependent\td_vvc_framework_common_methods_pkg.vhd", - "bitvis_vip_axistream\src\vvc_methods_pkg.vhd", - "uvvm_vvc_framework\src_target_dependent\td_queue_pkg.vhd", - "uvvm_vvc_framework\src_target_dependent\td_vvc_entity_support_pkg.vhd", - "bitvis_vip_axistream\src\axistream_vvc.vhd" - ) - }; - "I2C" = @{ - "Variable" = "UVVM_VIP_I2C"; - "Library" = "bitvis_vip_i2c"; - "Files" = @( - "bitvis_vip_i2c\src\i2c_bfm_pkg.vhd", - "bitvis_vip_i2c\src\vvc_cmd_pkg.vhd", - "uvvm_vvc_framework\src_target_dependent\td_target_support_pkg.vhd", - "uvvm_vvc_framework\src_target_dependent\td_vvc_framework_common_methods_pkg.vhd", - "bitvis_vip_i2c\src\vvc_methods_pkg.vhd", - "uvvm_vvc_framework\src_target_dependent\td_queue_pkg.vhd", - "uvvm_vvc_framework\src_target_dependent\td_vvc_entity_support_pkg.vhd", - "bitvis_vip_i2c\src\i2c_vvc.vhd" - ) - }; - "SBI" = @{ - "Variable" = "UVVM_VIP_SBI"; - "Library" = "bitvis_vip_sbi"; - "Files" = @( - "bitvis_vip_sbi/src/sbi_bfm_pkg.vhd", - "bitvis_vip_sbi/src/vvc_cmd_pkg.vhd", - "uvvm_vvc_framework/src_target_dependent/td_target_support_pkg.vhd", - "uvvm_vvc_framework/src_target_dependent/td_vvc_framework_common_methods_pkg.vhd", - "bitvis_vip_sbi/src/vvc_methods_pkg.vhd", - "uvvm_vvc_framework/src_target_dependent/td_queue_pkg.vhd", - "uvvm_vvc_framework/src_target_dependent/td_vvc_entity_support_pkg.vhd", - "bitvis_vip_sbi/src/sbi_vvc.vhd" - ) - }; - "UART" = @{ - "Variable" = "UVVM_VIP_UART"; - "Library" = "bitvis_vip_uart"; - "Files" = @( - "bitvis_vip_uart\src\uart_bfm_pkg.vhd", - "bitvis_vip_uart\src\vvc_cmd_pkg.vhd", - "uvvm_vvc_framework\src_target_dependent\td_target_support_pkg.vhd", - "uvvm_vvc_framework\src_target_dependent\td_vvc_framework_common_methods_pkg.vhd", - "bitvis_vip_uart\src\vvc_methods_pkg.vhd", - "uvvm_vvc_framework\src_target_dependent\td_queue_pkg.vhd", - "uvvm_vvc_framework\src_target_dependent\td_vvc_entity_support_pkg.vhd", - "bitvis_vip_uart\src\uart_rx_vvc.vhd", - "bitvis_vip_uart\src\uart_tx_vvc.vhd", - "bitvis_vip_uart\src\uart_vvc.vhd" - ) + + +Write-Host "Reading VIP compile order files..." -ForegroundColor Yellow +$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\$_" } + if ($EnableDebug) + { foreach ($File in $VIPFiles) + { Write-Host " $File" -ForegroundColor DarkGray } } + $VIP_Files[$VIPName] = @{ + "Variable" = "UVVM_$VIPVariable"; + "Library" = $VIPName; + "Files" = $VIPFiles + }; } + # UVVM packages # ============================================================================== # compile uvvm_util library @@ -270,7 +230,7 @@ if ((-not $StopCompiling) -and $UVVM_VCC_Framework) 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\$_" } + $SourceFiles = $VIP_Files[$vip]["Files"] #| % { "$SourceDirectory\$_" } $ErrorCount += 0 Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $SuppressWarnings $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug diff --git a/libraries/vendors/compile-uvvm.sh b/libraries/vendors/compile-uvvm.sh index 4555c1f8e..9da8bc274 100644 --- a/libraries/vendors/compile-uvvm.sh +++ b/libraries/vendors/compile-uvvm.sh @@ -16,6 +16,7 @@ # # ============================================================================== # 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 @@ -73,6 +74,46 @@ while [[ $# > 0 ]]; do COMPILE_UVVM_VIP=TRUE NO_COMMAND=0 ;; + --uvvm-utilities) + COMPILE_UVVM_UTILITIES=TRUE + NO_COMMAND=0 + ;; + --uvvm-vcc-framework) + COMPILE_UVVM_VVC_FRAMEWORK=TRUE + NO_COMMAND=0 + ;; + --uvvm-vip-avalon_mm) + COMPILE_UVVM_VIP_AVALON_MM=TRUE + NO_COMMAND=0 + ;; + --uvvm-vip-axi_lite) + COMPILE_UVVM_VIP_AXILITE=TRUE + NO_COMMAND=0 + ;; + --uvvm-vip-axi_stream) + COMPILE_UVVM_VIP_AXISTREAM=TRUE + NO_COMMAND=0 + ;; + --uvvm-vip-gpio) + COMPILE_UVVM_VIP_GPIO=TRUE + NO_COMMAND=0 + ;; + --uvvm-vip-i2c) + COMPILE_UVVM_VIP_I2C=TRUE + NO_COMMAND=0 + ;; + --uvvm-vip-sbi) + COMPILE_UVVM_VIP_SBI=TRUE + NO_COMMAND=0 + ;; + --uvvm-vip-spi) + COMPILE_UVVM_VIP_SPI=TRUE + NO_COMMAND=0 + ;; + --uvvm-vip-uart) + COMPILE_UVVM_VIP_UART=TRUE + NO_COMMAND=0 + ;; -h|--help) HELP=TRUE NO_COMMAND=0 @@ -132,6 +173,20 @@ if [ "$HELP" == "TRUE" ]; then echo " --uvvm Compile UVVM library packages." echo " --uvvm-vip Compile UVVM Verification IPs (VIPs)." echo "" + echo "Common Packages:" + echo " --uvvm-utilities " + echo " --uvvm-vcc-framework " + echo "" + echo "Verification IPs:" + echo " --uvvm-vip-avalon_mm " + echo " --uvvm-vip-axi_lite " + echo " --uvvm-vip-axi_stream " + echo " --uvvm-vip-gpio " + echo " --uvvm-vip-i2c " + echo " --uvvm-vip-sbi " + echo " --uvvm-vip-spi " + echo " --uvvm-vip-uart " + echo "" echo "Library compile options:" echo " -H --halt-on-error Halt on error(s)." echo "" @@ -155,10 +210,13 @@ if [ "$COMPILE_UVVM" == "TRUE" ]; then COMPILE_UVVM_VVC_FRAMEWORK=TRUE fi if [ "$COMPILE_UVVM_VIP" == "TRUE" ]; then + COMPILE_UVVM_VIP_AVALON_MM=TRUE COMPILE_UVVM_VIP_AXILITE=TRUE COMPILE_UVVM_VIP_AXISTREAM=TRUE + COMPILE_UVVM_VIP_GPIO=TRUE COMPILE_UVVM_VIP_I2C=TRUE COMPILE_UVVM_VIP_SBI=TRUE + COMPILE_UVVM_VIP_SPI=TRUE COMPILE_UVVM_VIP_UART=TRUE fi @@ -252,6 +310,31 @@ fi # Verification IPs # ============================================================================== +# compile bitvis_vip_avalon_mm packages +ERRORCOUNT=0 +if [ "$COMPILE_UVVM_VIP_AVALON_MM" == "TRUE" ]; then + Library="bitvis_vip_avalon_mm" + VHDLVersion="v08" + Files=( + bitvis_vip_avalon_mm/src/avalon_mm_bfm_pkg.vhd + bitvis_vip_avalon_mm/src/vvc_cmd_pkg.vhd + uvvm_vvc_framework/src_target_dependent/td_target_support_pkg.vhd + uvvm_vvc_framework/src_target_dependent/td_vvc_framework_common_methods_pkg.vhd + bitvis_vip_avalon_mm/src/vvc_methods_pkg.vhd + uvvm_vvc_framework/src_target_dependent/td_queue_pkg.vhd + uvvm_vvc_framework/src_target_dependent/td_vvc_entity_support_pkg.vhd + bitvis_vip_avalon_mm/src/avalon_mm_vvc.vhd + ) + + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + # compile bitvis_vip_axilite packages ERRORCOUNT=0 if [ "$COMPILE_UVVM_VIP_AXILITE" == "TRUE" ]; then @@ -302,6 +385,31 @@ if [ "$COMPILE_UVVM_VIP_AXISTREAM" == "TRUE" ]; then GHDLCompilePackages fi +# compile bitvis_vip_gpio packages +ERRORCOUNT=0 +if [ "$COMPILE_UVVM_VIP_GPIO" == "TRUE" ]; then + Library="bitvis_vip_gpio" + VHDLVersion="v08" + Files=( + bitvis_vip_gpio/src/gpio_bfm_pkg.vhd + bitvis_vip_gpio/src/vvc_cmd_pkg.vhd + uvvm_vvc_framework/src_target_dependent/td_target_support_pkg.vhd + uvvm_vvc_framework/src_target_dependent/td_vvc_framework_common_methods_pkg.vhd + bitvis_vip_gpio/src/vvc_methods_pkg.vhd + uvvm_vvc_framework/src_target_dependent/td_queue_pkg.vhd + uvvm_vvc_framework/src_target_dependent/td_vvc_entity_support_pkg.vhd + bitvis_vip_gpio/src/gpio_vvc.vhd + ) + + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + # compile bitvis_vip_i2c packages ERRORCOUNT=0 if [ "$COMPILE_UVVM_VIP_I2C" == "TRUE" ]; then @@ -352,6 +460,31 @@ if [ "$COMPILE_UVVM_VIP_SBI" == "TRUE" ]; then GHDLCompilePackages fi +# compile bitvis_vip_spi packages +ERRORCOUNT=0 +if [ "$COMPILE_UVVM_VIP_SPI" == "TRUE" ]; then + Library="bitvis_vip_spi" + VHDLVersion="v08" + Files=( + bitvis_vip_spi/src/spi_bfm_pkg.vhd + bitvis_vip_spi/src/vvc_cmd_pkg.vhd + uvvm_vvc_framework/src_target_dependent/td_target_support_pkg.vhd + uvvm_vvc_framework/src_target_dependent/td_vvc_framework_common_methods_pkg.vhd + bitvis_vip_spi/src/vvc_methods_pkg.vhd + uvvm_vvc_framework/src_target_dependent/td_queue_pkg.vhd + uvvm_vvc_framework/src_target_dependent/td_vvc_entity_support_pkg.vhd + bitvis_vip_spi/src/spi_vvc.vhd + ) + + # append absolute source path + SourceFiles=() + for File in ${Files[@]}; do + SourceFiles+=("$SourceDirectory/$File") + done + + GHDLCompilePackages +fi + # compile bitvis_vip_uart packages ERRORCOUNT=0 if [ "$COMPILE_UVVM_VIP_UART" == "TRUE" ]; then diff --git a/libraries/vendors/compile-vunit.ps1 b/libraries/vendors/compile-vunit.ps1 index 993a91a31..2ba5b9362 100644 --- a/libraries/vendors/compile-vunit.ps1 +++ b/libraries/vendors/compile-vunit.ps1 @@ -15,6 +15,7 @@ # # ============================================================================== # 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 @@ -56,14 +57,14 @@ param( #Skip warning messages. (Show errors only.) [switch]$SuppressWarnings = $false, - # Halt on errors + # Halt on errors. [switch]$HaltOnError = $false, - # Set vendor library source directory + # Set vendor library source directory. [string]$Source = "", - # Set output directory name + # Set output directory name. [string]$Output = "", - # Set GHDL executable + # Set GHDL binary directory. [string]$GHDL = "" ) @@ -72,11 +73,8 @@ param( $WorkingDir = Get-Location # set default values -$EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"] -$EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"] -if ($EnableVerbose -eq $null) { $EnableVerbose = $false } -if ($EnableDebug -eq $null) { $EnableDebug = $false } -if ($EnableDebug -eq $true) { $EnableVerbose = $true } +$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] +$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug # load modules from GHDL's 'vendors' library directory Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -Debug:$false -ArgumentList "VUnit" diff --git a/libraries/vendors/compile-xilinx-ise.ps1 b/libraries/vendors/compile-xilinx-ise.ps1 index 3ec51d591..42a54327e 100644 --- a/libraries/vendors/compile-xilinx-ise.ps1 +++ b/libraries/vendors/compile-xilinx-ise.ps1 @@ -16,6 +16,7 @@ # # ============================================================================== # 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 @@ -78,14 +79,14 @@ param( # Skip warning messages. (Show errors only.) [switch]$SuppressWarnings = $false, - # Halt on errors + # Halt on errors. [switch]$HaltOnError = $false, - # Set vendor library source directory + # Set vendor library source directory. [string]$Source = "", - # Set output directory name + # Set output directory name. [string]$Output = "", - # Set GHDL executable + # Set GHDL binary directory. [string]$GHDL = "" ) @@ -99,11 +100,8 @@ if ($Help) $WorkingDir = Get-Location # set default values -$EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"] -$EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"] -if ($EnableVerbose -eq $null) { $EnableVerbose = $false } -if ($EnableDebug -eq $null) { $EnableDebug = $false } -if ($EnableDebug -eq $true) { $EnableVerbose = $true } +$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] +$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug # load modules from GHDL's 'vendors' library directory Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -Debug:$false -ArgumentList "XilinxISE" diff --git a/libraries/vendors/compile-xilinx-vivado.ps1 b/libraries/vendors/compile-xilinx-vivado.ps1 index 621d84ab0..c25ab0c08 100644 --- a/libraries/vendors/compile-xilinx-vivado.ps1 +++ b/libraries/vendors/compile-xilinx-vivado.ps1 @@ -16,6 +16,7 @@ # # ============================================================================== # 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 @@ -63,21 +64,21 @@ param( # Clean up directory before analyzing. [switch]$Clean = $false, - # Set VHDL Standard to '93 + # Set VHDL Standard to '93. [switch]$VHDL93 = $false, - # Set VHDL Standard to '08 + # Set VHDL Standard to '08. [switch]$VHDL2008 = $false, # Skip warning messages. (Show errors only.) [switch]$SuppressWarnings = $false, - # Halt on errors + # Halt on errors. [switch]$HaltOnError = $false, - # Set vendor library source directory + # Set vendor library source directory. [string]$Source = "", - # Set output directory name + # Set output directory name. [string]$Output = "", - # Set GHDL executable + # Set GHDL binary directory. [string]$GHDL = "" ) @@ -86,11 +87,8 @@ param( $WorkingDir = Get-Location # set default values -$EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"] -$EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"] -if ($EnableVerbose -eq $null) { $EnableVerbose = $false } -if ($EnableDebug -eq $null) { $EnableDebug = $false } -if ($EnableDebug -eq $true) { $EnableVerbose = $true } +$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] +$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug # load modules from GHDL's 'vendors' library directory Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -ArgumentList "XilinxVivado" diff --git a/libraries/vendors/config.psm1 b/libraries/vendors/config.psm1 index 873dad255..59e0a3ea9 100644 --- a/libraries/vendors/config.psm1 +++ b/libraries/vendors/config.psm1 @@ -14,6 +14,7 @@ # # ============================================================================== # 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 @@ -40,34 +41,47 @@ $Module_VendorToolName = $VendorToolName # Configure your tools here. Use absolute paths, without trailing directory # delimiter. Empty strings indicate not installed tools -$InstallationDirectories = @{ - "AlteraQuartus" = "" # "C:\Altera\16.0\quartus"; - "LatticeDiamond" = "" # "C:\Lattice\Diamond\3.8_x64" - "OSVVM" = "" # "C:\git\GitHub\osvvm"; - "UVVM" = "" # "C:\git\GitHub\uvvm_all"; - "VUnit" = "" # "C:\git\GitHub\vunit" - "XilinxISE" = "" # "C:\Xilinx\14.7\ISE_DS"; - "XilinxVivado" = "" # "C:\Xilinx\Vivado\2016.3"; -} - -$SourceDirectories = @{ - "AlteraQuartus" = "eda\sim_lib"; - "LatticeDiamond" = "cae_library\simulation\vhdl" - "OSVVM" = "."; - "UVVM" = "."; - "VUnit" = "vunit\vhdl"; - "XilinxISE" = "ISE\vhdl\src"; - "XilinxVivado" = "data\vhdl\src" -} - -$DestinationDirectories = @{ - "AlteraQuartus" = "altera"; - "LatticeDiamond" = "lattice"; - "OSVVM" = "."; - "UVVM" = "."; - "VUnit" = "."; - "XilinxISE" = "xilinx-ise"; - "XilinxVivado" = "xilinx-vivado" +$Settings = @{ + "AlteraQuartus" = @{ + "InstallationDirectory" = ""; # "C:\Altera\16.0\quartus"; + "SourceDirectory" = "eda\sim_lib"; + "DestinationDirectory" = "altera" + }; + "IntelQuartus" = @{ + "InstallationDirectory" = ""; # "C:\IntelFPGA\17.0\quartus"; + "SourceDirectory" = "eda\sim_lib"; + "DestinationDirectory" = "intel" + }; + "LatticeDiamond" = @{ + "InstallationDirectory" = ""; # "C:\Lattice\Diamond\3.8_x64"; + "SourceDirectory" = "cae_library\simulation\vhdl"; + "DestinationDirectory" = "lattice" + }; + "OSVVM" = @{ + "InstallationDirectory" = ""; # "C:\git\GitHub\osvvm"; + "SourceDirectory" = "."; + "DestinationDirectory" = "." + }; + "UVVM" = @{ + "InstallationDirectory" = ""; # "C:\git\GitHub\uvvm_alls"; + "SourceDirectory" = "."; + "DestinationDirectory" = "." + }; + "VUnit" = @{ + "InstallationDirectory" = ""; # "C:\git\GitHub\vunit"; + "SourceDirectory" = "vunit\vhdl"; + "DestinationDirectory" = "." + }; + "XilinxISE" = @{ + "InstallationDirectory" = ""; # "C:\Xilinx\14.7\ISE_DS"; + "SourceDirectory" = "ISE\vhdl\src"; + "DestinationDirectory" = "xilinx-ise" + }; + "XilinxVivado" = @{ + "InstallationDirectory" = ""; # "C:\Xilinx\Vivado\2017.1"; + "SourceDirectory" = "data\vhdl\src"; + "DestinationDirectory" = "xilinx-vivado" + } } @@ -79,7 +93,7 @@ function Get-VendorToolInstallationDirectory .DESCRIPTION Undocumented #> - return $InstallationDirectories[$Module_VendorToolName] + return $Settings[$Module_VendorToolName]["InstallationDirectory"] } function Get-VendorToolSourceDirectory @@ -90,7 +104,7 @@ function Get-VendorToolSourceDirectory .DESCRIPTION Undocumented #> - return $SourceDirectories[$Module_VendorToolName] + return $Settings[$Module_VendorToolName]["SourceDirectory"] } function Get-VendorToolDestinationDirectory @@ -101,7 +115,7 @@ function Get-VendorToolDestinationDirectory .DESCRIPTION Undocumented #> - return $DestinationDirectories[$Module_VendorToolName] + return $Settings[$Module_VendorToolName]["DestinationDirectory"] } Export-ModuleMember -Function 'Get-VendorToolInstallationDirectory' diff --git a/libraries/vendors/config.sh b/libraries/vendors/config.sh index 0880fdb4a..f016917ca 100644 --- a/libraries/vendors/config.sh +++ b/libraries/vendors/config.sh @@ -14,6 +14,7 @@ # # ============================================================================== # 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 @@ -41,6 +42,7 @@ # compile script. Empty strings means not configured. declare -A InstallationDirectories InstallationDirectories[AlteraQuartus]="" # "/opt/altera/16.0/quartus" +InstallationDirectories[IntelQuartus]="" # "/opt/intelFPGA/17.0/quartus" InstallationDirectories[LatticeDiamond]="" # "/usr/local/diamond/3.7_x64" InstallationDirectories[OSVVM]="" # "~/git/github/osvvm" InstallationDirectories[UVVM]="" # "~/git/github/uvvm_all" @@ -51,6 +53,7 @@ InstallationDirectories[XilinxVivado]="" # "/opt/Xilinx/Vivado/2016.2" # Configure preferred output directories for each library set: declare -A DestinationDirectories DestinationDirectories[AlteraQuartus]="altera" +DestinationDirectories[IntelQuartus]="intel" DestinationDirectories[LatticeDiamond]="lattice" DestinationDirectories[OSVVM]="." # "osvvm" DestinationDirectories[UVVM]="." @@ -61,6 +64,7 @@ DestinationDirectories[XilinxVivado]="xilinx-vivado" # Declare source directories depending on the installation paths: declare -A SourceDirectories SourceDirectories[AlteraQuartus]="eda/sim_lib" +SourceDirectories[IntelQuartus]="eda/sim_lib" SourceDirectories[LatticeDiamond]="cae_library/simulation/vhdl" SourceDirectories[OSVVM]="." SourceDirectories[UVVM]="." diff --git a/libraries/vendors/shared.psm1 b/libraries/vendors/shared.psm1 index f91b773e0..3ff91c2db 100644 --- a/libraries/vendors/shared.psm1 +++ b/libraries/vendors/shared.psm1 @@ -15,6 +15,7 @@ # # ============================================================================== # 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 @@ -90,19 +91,22 @@ function Get-SourceDirectory [string]$EnvSource ) + $VendorToolInstallationDirectory = Get-VendorToolInstallationDirectory + $VendorToolSourceDirectory = Get-VendorToolSourceDirectory + if ($Source -ne "") { $SourceDirectory = $Source.TrimEnd("\") } elseif ($EnvSource -ne "") { $SourceDirectory = $EnvSource } + elseif ($VendorToolInstallationDirectory -ne "") + { $SourceDirectory = $VendorToolInstallationDirectory + "\" + $VendorToolSourceDirectory } else - { $SourceDirectory = (Get-VendorToolInstallationDirectory) + "\" + (Get-VendorToolSourceDirectory) } - - if ($SourceDirectory -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 } - elseif (-not (Test-Path $SourceDirectory -PathType Container)) + + if (-not (Test-Path $SourceDirectory -PathType Container)) { Write-Host "[ERROR]: Path '$SourceDirectory' does not exist." -ForegroundColor Red Exit-CompileScript -1 } @@ -136,8 +140,8 @@ function Get-DestinationDirectory Exit-CompileScript -1 } - # if ($DestinationDirectory.IsAbsolute()) - # { $DestinationDirectory = "$Module_WorkingDir\$DestinationDirectory" } + if (-not [System.IO.Path]::IsPathRooted($DestinationDirectory)) + { $DestinationDirectory = "$Module_WorkingDir\$DestinationDirectory" } return $DestinationDirectory } @@ -269,24 +273,22 @@ function Start-PackageCompilation [Parameter(Mandatory=$true)][bool]$SuppressWarnings, [Parameter(Mandatory=$true)][bool]$HaltOnError ) - # set default values - $EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"] - $EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"] - if ($EnableVerbose -eq $null) { $EnableVerbose = $false } - if ($EnableDebug -eq $null) { $EnableDebug = $false } - if ($EnableDebug -eq $true) { $EnableVerbose = $true } + # set default valuesvalues + $EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] + $EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug - $LibraryDirectory="$DestinationDirectory/$Library/$VHDLVersion" - $EnableDebug -and (Write-Host " mkdir $LibraryDirectory" -ForegroundColor DarkGray ) | Out-Null + Write-Host "Compiling library '$Library' ..." -ForegroundColor Yellow + $LibraryDirectory= "$DestinationDirectory/$Library/$VHDLVersion" + $EnableVerbose -and (Write-Host " Creating library $Library ..." -ForegroundColor Gray ) | Out-Null + $EnableDebug -and (Write-Host " mkdir $LibraryDirectory" -ForegroundColor DarkGray ) | Out-Null mkdir $LibraryDirectory -ErrorAction SilentlyContinue | Out-Null - $EnableDebug -and (Write-Host " cd $LibraryDirectory" -ForegroundColor DarkGray ) | Out-Null + $EnableDebug -and (Write-Host " cd $LibraryDirectory" -ForegroundColor DarkGray ) | Out-Null cd $LibraryDirectory - Write-Host "Compiling library '$Library' ..." -ForegroundColor Yellow $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 + { 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) { $ErrorCount += 1 @@ -330,23 +332,21 @@ function Start-PrimitiveCompilation [Parameter(Mandatory=$true)][bool]$HaltOnError ) # set default values - $EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"] - $EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"] - if ($EnableVerbose -eq $null) { $EnableVerbose = $false } - if ($EnableDebug -eq $null) { $EnableDebug = $false } - if ($EnableDebug -eq $true) { $EnableVerbose = $true } + $EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] + $EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug + Write-Host "Compiling library '$Library' ..." -ForegroundColor Yellow $LibraryDirectory="$DestinationDirectory/$Library/$VHDLVersion" - $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 - Write-Host "Compiling library '$Library' ..." -ForegroundColor Yellow $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 + { 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) { $ErrorCount += 1 |