From 06906cef13381eb8a021d0822b778df219b1f7b1 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Fri, 28 Jul 2017 15:45:54 +0200 Subject: Reworked and improved pre-compile scripts. Added Intel FPGA support. Extended list of UVVM verification IPs. --- dist/windows/InstallerTemplate.ps1 | 161 ++++--- dist/windows/compile.ps1 | 397 +++++++++------- libraries/vendors/compile-altera.ps1 | 22 +- libraries/vendors/compile-intel.ps1 | 555 ++++++++++++++++++++++ libraries/vendors/compile-intel.sh | 712 ++++++++++++++++++++++++++++ libraries/vendors/compile-lattice.ps1 | 16 +- libraries/vendors/compile-osvvm.ps1 | 7 +- libraries/vendors/compile-uvvm.ps1 | 114 ++--- libraries/vendors/compile-uvvm.sh | 133 ++++++ libraries/vendors/compile-vunit.ps1 | 16 +- libraries/vendors/compile-xilinx-ise.ps1 | 16 +- libraries/vendors/compile-xilinx-vivado.ps1 | 20 +- libraries/vendors/config.psm1 | 76 +-- libraries/vendors/config.sh | 4 + libraries/vendors/shared.psm1 | 60 +-- 15 files changed, 1881 insertions(+), 428 deletions(-) create mode 100644 libraries/vendors/compile-intel.ps1 create mode 100644 libraries/vendors/compile-intel.sh diff --git a/dist/windows/InstallerTemplate.ps1 b/dist/windows/InstallerTemplate.ps1 index af60009f2..54c1894a1 100644 --- a/dist/windows/InstallerTemplate.ps1 +++ b/dist/windows/InstallerTemplate.ps1 @@ -42,17 +42,22 @@ # PS> .\install.ps1 -Install # # # Advanced flow -# PS> .\compile.ps1 -Install "C:\Tools\GHDL" +# PS> .\compile.ps1 -AddToPath Machine -Install "C:\Tools\GHDL" # [CmdletBinding()] Param( # install all files into a directory (xcopy deployment) [switch]$Install = $false, - [parameter(mandatory=$false, ValueFromRemainingArguments=$true)] - [string]$InstallDir = "", + [Parameter(Mandatory=$false, ValueFromRemainingArguments=$true)] + [String]$InstallDir = "", # update files [switch]$Update, + # register GHDL in PATH + [Parameter(Mandatory=$false)] + [ValidateSet("Machine", "User", "Session", "Remove", "Pass")] + [String]$AddToPath = "", + # display this help" [switch]$Help ) @@ -81,16 +86,6 @@ Write-Host "==================================================================== Write-Host "GHDL for Windows - GHDL install script" -ForegroundColor Magenta Write-Host "================================================================================" -ForegroundColor Magenta -if ($Help) -{ Get-Help $MYINVOCATION.InvocationName -Detailed - Exit-CompileScript -} - -$EnvPath_ContainerMapping = @{ - Machine = [EnvironmentVariableTarget]::Machine - User = [EnvironmentVariableTarget]::User -} - function Exit-Script { [CmdletBinding()] param( @@ -100,6 +95,16 @@ function Exit-Script exit $ExitCode } +if ($Help) +{ Get-Help $MYINVOCATION.InvocationName -Detailed + Exit-Script +} + +$EnvPath_ContainerMapping = @{ + Machine = [EnvironmentVariableTarget]::Machine + User = [EnvironmentVariableTarget]::User +} + # GitHub user: https://github.com/mkropat # Gist account at GitHub: https://gist.github.com/mkropat # Gist snippet URL: https://gist.github.com/mkropat/c1226e0cc2ca941b23a9 @@ -210,16 +215,30 @@ if ($Install) Remove-Item $TempFilePath - Write-Host " Install GHDL in PATH at machine level? [" -NoNewline -ForegroundColor DarkCyan - Write-Host "M" -NoNewline -ForegroundColor Cyan - Write-Host "achine/" -NoNewline -ForegroundColor DarkCyan - Write-Host "u" -NoNewline -ForegroundColor Cyan - Write-Host "ser/" -NoNewline -ForegroundColor DarkCyan - Write-Host "s" -NoNewline -ForegroundColor Cyan - Write-Host "ession/" -NoNewline -ForegroundColor DarkCyan - Write-Host "n" -NoNewline -ForegroundColor Cyan - Write-Host "o]: " -NoNewline -ForegroundColor DarkCyan - $InstallInPath = (Read-Host).ToLower() + + if ($AddToPath -eq "") + { while($true) + { Write-Host " Install GHDL in PATH at machine level? [" -NoNewline -ForegroundColor DarkCyan + Write-Host "M" -NoNewline -ForegroundColor Cyan + Write-Host "achine/" -NoNewline -ForegroundColor DarkCyan + Write-Host "u" -NoNewline -ForegroundColor Cyan + Write-Host "ser/" -NoNewline -ForegroundColor DarkCyan + Write-Host "s" -NoNewline -ForegroundColor Cyan + Write-Host "ession]: " -NoNewline -ForegroundColor DarkCyan + $InstallInPath = (Read-Host).ToLower() + if ($InstallInPath -in "m","u","s") + { break } + else + { Write-Host "[ERROR]: Unsupported choice: '$InstallInPath'." -ForegroundColor Red } + } + } + elseif ($AddToPath -eq "Machine") + { $InstallInPath = "m" } + elseif ($AddToPath -eq "User") + { $InstallInPath = "u" } + elseif ($AddToPath -eq "Session") + { $InstallInPath = "s" } + if (($InstallInPath -eq "") -or ($InstallInPath -eq "m")) { Write-Host " Adding GHDL to PATH at machine level." Add-EnvPath -Path "$InstallPath\bin" -Container "Machine" @@ -244,7 +263,12 @@ if ($Install) } # Install elseif ($Update) { Write-Host "Updating GHDL $GHDLVersion for Windows..." - $InstallPath = $InstallDir.TrimEnd("\") + if ($InstallDir -eq "") + { $InstallPath = $DefaultInstallPath + } + else + { $InstallPath = $InstallDir } + $InstallPath = $InstallPath.TrimEnd("\") Write-Host " Install directory: $InstallPath" if (Test-Path -Path $InstallPath) @@ -252,17 +276,6 @@ elseif ($Update) Get-ChildItem -Path $InstallPath -Depth 0 | foreach { Remove-Item $_.FullName -Recurse -Force } } - Write-Host " Removing GHDL from PATH variables in Machine, User, Session ..." -ForegroundColor Yellow - foreach ($container in @("Machine", "User")) - { foreach ($entry in (Get-EnvPath -Container $container)) - { if ($entry.ToLower().Contains("ghdl")) - { Write-Host " Removing '$entry' from $container level." - Remove-EnvPath -Path $entry -Container $container - } - } - } - Remove-EnvPath -Path $entry -Container "Session" - Write-Host " Creating directory sub-directories in '$InstallPath' ..." # writing ZIP file to disk @@ -276,29 +289,63 @@ elseif ($Update) Remove-Item $TempFilePath - Write-Host " Install GHDL in PATH at machine level? [" -NoNewline -ForegroundColor DarkCyan - Write-Host "M" -NoNewline -ForegroundColor Cyan - Write-Host "achine/" -NoNewline -ForegroundColor DarkCyan - Write-Host "u" -NoNewline -ForegroundColor Cyan - Write-Host "ser/" -NoNewline -ForegroundColor DarkCyan - Write-Host "s" -NoNewline -ForegroundColor Cyan - Write-Host "ession/" -NoNewline -ForegroundColor DarkCyan - Write-Host "n" -NoNewline -ForegroundColor Cyan - Write-Host "o]: " -NoNewline -ForegroundColor DarkCyan - $InstallInPath = (Read-Host).ToLower() - if (($InstallInPath -eq "") -or ($InstallInPath -eq "m")) - { Write-Host " Adding GHDL to PATH at machine level." - Add-EnvPath -Path "$InstallPath\bin" -Container "Machine" - Add-EnvPath -Path "$InstallPath\bin" -Container "Session" - } - elseif ($InstallInPath -eq "u") - { Write-Host " Adding GHDL to PATH at user level." - Add-EnvPath -Path "$InstallPath\bin" -Container "User" - Add-EnvPath -Path "$InstallPath\bin" -Container "Session" + if ($AddToPath -eq "") + { while($true) + { Write-Host " Install GHDL in PATH at machine level? [" -NoNewline -ForegroundColor DarkCyan + Write-Host "M" -NoNewline -ForegroundColor Cyan + Write-Host "achine/" -NoNewline -ForegroundColor DarkCyan + Write-Host "u" -NoNewline -ForegroundColor Cyan + Write-Host "ser/" -NoNewline -ForegroundColor DarkCyan + Write-Host "s" -NoNewline -ForegroundColor Cyan + Write-Host "ession/" -NoNewline -ForegroundColor DarkCyan + Write-Host "r" -NoNewline -ForegroundColor Cyan + Write-Host "emove/" -NoNewline -ForegroundColor DarkCyan + Write-Host "p" -NoNewline -ForegroundColor Cyan + Write-Host "ass]: " -NoNewline -ForegroundColor DarkCyan + $InstallInPath = (Read-Host).ToLower() + if ($InstallInPath -in "m","u","s","r","p") + { break } + else + { Write-Host "[ERROR]: Unsupported choice: '$InstallInPath'." -ForegroundColor Red } + } } - elseif ($InstallInPath -eq "s") - { Write-Host " Adding GHDL to PATH at session level." - Add-EnvPath -Path "$InstallPath\bin" -Container "Session" + elseif ($AddToPath -eq "Machine") + { $InstallInPath = "m" } + elseif ($AddToPath -eq "User") + { $InstallInPath = "u" } + elseif ($AddToPath -eq "Session") + { $InstallInPath = "s" } + elseif ($AddToPath -eq "Remove") + { $InstallInPath = "r" } + elseif ($AddToPath -eq "Pass") + { $InstallInPath = "p" } + + if ($InstallInPath -ne "p") + { Write-Host " Removing GHDL from PATH variables in Machine, User, Session ..." -ForegroundColor Yellow + foreach ($container in @("Machine", "User")) + { foreach ($entry in (Get-EnvPath -Container $container)) + { if ($entry.ToLower().Contains("ghdl")) + { Write-Host " Removing '$entry' from $container level." + Remove-EnvPath -Path $entry -Container $container + } + } + } + Remove-EnvPath -Path $entry -Container "Session" + + if (($InstallInPath -eq "") -or ($InstallInPath -eq "m")) + { Write-Host " Adding GHDL to PATH at machine level." + Add-EnvPath -Path "$InstallPath\bin" -Container "Machine" + Add-EnvPath -Path "$InstallPath\bin" -Container "Session" + } + elseif ($InstallInPath -eq "u") + { Write-Host " Adding GHDL to PATH at user level." + Add-EnvPath -Path "$InstallPath\bin" -Container "User" + Add-EnvPath -Path "$InstallPath\bin" -Container "Session" + } + elseif ($InstallInPath -eq "s") + { Write-Host " Adding GHDL to PATH at session level." + Add-EnvPath -Path "$InstallPath\bin" -Container "Session" + } } Write-Host diff --git a/dist/windows/compile.ps1 b/dist/windows/compile.ps1 index f75729192..da3c67731 100644 --- a/dist/windows/compile.ps1 +++ b/dist/windows/compile.ps1 @@ -1,39 +1,39 @@ -# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*- +# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*- # vim: tabstop=2:shiftwidth=2:noexpandtab # kate: tab-width 2; replace-tabs off; indent-width 2; # # ============================================================================== -# Authors: Patrick Lehmann (ported batch file to PowerShell) -# Brian Davis (contributions to the batch file) -# Tristan Gingold (initial batch file for compilations on Windows) +# Authors: Patrick Lehmann (ported batch file to PowerShell) +# Brian Davis (contributions to the batch file) +# Tristan Gingold (initial batch file for compilations on Windows) # -# PowerShell Script: Script to compile GHDL for Windows +# PowerShell Script: Script to compile GHDL for Windows # # Description: # ------------------------------------ -# This is a PowerShell script (executable) which: -# - compiles GHDL and GHDLFilter -# - analyses VHDL libraries -# - installs GHDL into a directory (xcopy deploiment) +# This is a PowerShell script (executable) which: +# - compiles GHDL and GHDLFilter +# - analyses VHDL libraries +# - installs GHDL into a directory (xcopy deploiment) # # ============================================================================== -# Copyright (C) 2002, 2003, 2004, 2005 Tristan Gingold -# Copyright (C) 2015-2017 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. +# Copyright (C) 2002, 2003, 2004, 2005 Tristan Gingold +# Copyright (C) 2015-2017 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 @@ -58,7 +58,7 @@ # PS> .\compile.ps1 -Uninstall # # # Create a Zip-file -# PS>.\compile.ps1 -CreatePackage -Zip +# PS>.\compile.ps1 -Package -Zip # [CmdletBinding()] Param( @@ -73,7 +73,7 @@ Param( [switch]$Compile_Libraries, # Create an installer package - [switch]$CreatePackage, + [switch]$Package, # Creates a zip-file for xcopy deployment [switch]$Zip, # Creates a self-extracting ps1-file for xcopy deployment @@ -87,26 +87,28 @@ Param( [switch]$Update, # Uninstall all files from a directory [switch]$Uninstall, + + # register GHDL in PATH + [Parameter(Mandatory=$false)] + [ValidateSet("Machine", "User", "Session", "Remove", "Pass")] + [String]$AddToPath = "", # Display this help" [switch]$Help ) # configure script here -$RelPathToRoot = "..\.." +$RelPathToRoot = "..\.." # save parameters and current working directory -$Script_ScriptDir = $PSScriptRoot -$Script_WorkingDir = Get-Location -$GHDLRootDir = Convert-Path (Resolve-Path ($PSScriptRoot + "\" + $RelPathToRoot)) +$Script_ScriptDir = $PSScriptRoot +$Script_WorkingDir = Get-Location +$GHDLRootDir = Convert-Path (Resolve-Path ($PSScriptRoot + "\" + $RelPathToRoot)) # set default values -$Hosting = $true -$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 } +$Hosting = $true +$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] +$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug # load modules from GHDL's 'libraries' directory Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -Debug:$false -ArgumentList "$Script_WorkingDir", $Hosting @@ -117,7 +119,7 @@ $Help = $Help -or (-not ( $All -or $Clean -or $Clean_GHDL -or $Clean_Libraries -or $Clean_Package_Zip -or $Compile -or $Compile_GHDL -or $Compile_Libraries -or - $CreatePackage -or + $Package -or $Install -or $Update -or $Uninstall )) @@ -131,49 +133,49 @@ if ($Help) } if ($All) -{ $Clean = $true - $Compile = $true - $CreatePackage = $true +{ $Clean = $true + $Compile = $true + $Package = $true } if ($Clean) -{ $Clean_GHDL = $true - $Clean_Libraries = $true - $Clean_Package_Zip = $true +{ $Clean_GHDL = $true + $Clean_Libraries = $true + $Clean_Package_Zip = $true } if ($Compile) -{ $Compile_GHDL = $true - $Compile_Libraries = $true +{ $Compile_GHDL = $true + $Compile_Libraries = $true } # configure some variables: paths, executables, directory names, ... -$GHDLVersion = Get-GHDLVersion $GHDLRootDir -$Backend = "mcode" -$WindowsDirName = "dist\windows" #\$Backend" -$BuildDirectoryName = "build" -$BuildBackendDirectoryName = "$BuildDirectoryName\$Backend" -$VHDLLibrariesDirectoryName = "lib" -$PackageDirectoryName = "build\zip\$Backend" -$ZipPackageFileName = "ghdl-$Backend-$GHDLVersion.zip" -$PS1PackageFileName = "ghdl-$Backend-$GHDLVersion.installer.ps1" -$InstallerTemplateFileName = "InstallerTemplate.ps1" -$DefaultInstallPath = "C:\Program Files (x86)\GHDL" # This is the default path for 32-bit applications (x86-32) +$GHDLVersion = Get-GHDLVersion $GHDLRootDir +$Backend = "mcode" +$WindowsDirName = "dist\windows" #\$Backend" +$BuildDirectoryName = "build" +$BuildBackendDirectoryName = "$BuildDirectoryName\$Backend" +$VHDLLibrariesDirectoryName = "lib" +$PackageDirectoryName = "build\zip\$Backend" +$ZipPackageFileName = "ghdl-$Backend-$GHDLVersion.zip" +$PS1PackageFileName = "ghdl-$Backend-$GHDLVersion.installer.ps1" +$InstallerTemplateFileName = "InstallerTemplate.ps1" +$DefaultInstallPath = "C:\Program Files (x86)\GHDL" # This is the default path for 32-bit applications (x86-32) # construct directories -$GHDLWindowsDir = "$GHDLRootDir\$WindowsDirName" -$GHDLBuildDir = "$GHDLRootDir\$BuildBackendDirectoryName" -$GHDLVendorLibraryDir = "$GHDLRootDir\libraries\vendors" -$GHDLCompiledLibraryDir = "$GHDLRootDir\$BuildBackendDirectoryName\$VHDLLibrariesDirectoryName" -$GHDLZipPackageDir = "$GHDLRootDir\$PackageDirectoryName" -$GHDLZipPackageFile = "$GHDLZipPackageDir\$ZipPackageFileName" -$InstallerTemplateFile = "$GHDLWindowsDir\$InstallerTemplateFileName" -$GHDLPS1PackageFile = "$GHDLZipPackageDir\$PS1PackageFileName" +$GHDLWindowsDir = "$GHDLRootDir\$WindowsDirName" +$GHDLBuildDir = "$GHDLRootDir\$BuildBackendDirectoryName" +$GHDLVendorLibraryDir = "$GHDLRootDir\libraries\vendors" +$GHDLCompiledLibraryDir = "$GHDLRootDir\$BuildBackendDirectoryName\$VHDLLibrariesDirectoryName" +$GHDLZipPackageDir = "$GHDLRootDir\$PackageDirectoryName" +$GHDLZipPackageFile = "$GHDLZipPackageDir\$ZipPackageFileName" +$InstallerTemplateFile = "$GHDLWindowsDir\$InstallerTemplateFileName" +$GHDLPS1PackageFile = "$GHDLZipPackageDir\$PS1PackageFileName" # construct files -$InstallDirFile = "$BuildDirectoryName\InstallDir.conf" +$InstallDirFile = "$BuildDirectoryName\InstallDir.conf" $EnvPath_ContainerMapping = @{ - Machine = [EnvironmentVariableTarget]::Machine - User = [EnvironmentVariableTarget]::User + Machine = [EnvironmentVariableTarget]::Machine + User = [EnvironmentVariableTarget]::User } function Exit-Script @@ -183,8 +185,8 @@ function Exit-Script ) cd $Script_WorkingDir # unload modules - Remove-Module shared -Verbose:$false -Debug:$false - Remove-Module targets -Verbose:$false -Debug:$false + Remove-Module shared -Verbose:$false -Debug:$false + Remove-Module targets -Verbose:$false -Debug:$false exit $ExitCode } @@ -201,8 +203,8 @@ function Add-EnvPath ) if ($Container -ne "Session") - { $containerType = $EnvPath_ContainerMapping[$Container] - $persistedPaths = [Environment]::GetEnvironmentVariable("Path", $containerType) -split ";" + { $containerType = $EnvPath_ContainerMapping[$Container] + $persistedPaths = [Environment]::GetEnvironmentVariable("Path", $containerType) -split ";" if ($persistedPaths -notcontains $Path) { $persistedPaths = $persistedPaths + $Path | where { $_ } [Environment]::SetEnvironmentVariable("Path", $persistedPaths -join ";", $containerType) @@ -229,8 +231,8 @@ function Remove-EnvPath ) if ($Container -ne "Session") - { $containerType = $EnvPath_ContainerMapping[$Container] - $persistedPaths = [Environment]::GetEnvironmentVariable("Path", $containerType) -split ";" + { $containerType = $EnvPath_ContainerMapping[$Container] + $persistedPaths = [Environment]::GetEnvironmentVariable("Path", $containerType) -split ";" if ($persistedPaths -contains $Path) { $persistedPaths = $persistedPaths | where { $_ -and $_ -ne $Path } [Environment]::SetEnvironmentVariable("Path", $persistedPaths -join ";", $containerType) @@ -264,17 +266,17 @@ if ($false) # Write-Host "[ERROR]: This command is not implemented." -ForegroundColor Red Exit-Script -1 -} # Uninstall +} # Uninstall else { # ============================================================================ # Clean tasks # ============================================================================ if ($Clean) - { Write-Host "Removing all created files and directories..." } + { Write-Host "Removing all created files and directories..." } if ($Clean_GHDL) - { $Script_Path = $GHDLWindowsDir + "\compile-ghdl.ps1" - $Script_Parameters = @( + { $Script_Path = $GHDLWindowsDir + "\compile-ghdl.ps1" + $Script_Parameters = @( '-Clean', '-Hosted', '-Verbose:$EnableVerbose', @@ -296,13 +298,13 @@ else Write-Host "[SUCCESSFUL]" -ForegroundColor Green Write-Host } - } # Clean_GHDL + } # Clean_GHDL if ($Clean_Libraries) { if ($Clean_GHDL) - { Write-Host } + { Write-Host } - $Script_Path = $GHDLWindowsDir + "\compile-libraries.ps1" - $Script_Parameters = @( + $Script_Path = $GHDLWindowsDir + "\compile-libraries.ps1" + $Script_Parameters = @( '-Clean', '-Hosted', '-Verbose:$EnableVerbose', @@ -324,10 +326,10 @@ else Write-Host "[SUCCESSFUL]" -ForegroundColor Green Write-Host } - } # Clean_Libraries + } # Clean_Libraries if ($Clean_Package_Zip) { if ($Clean_GHDL -or $Clean_Libraries) - { Write-Host } + { Write-Host } Write-Host "Running more clean-up tasks..." -ForegroundColor DarkCyan Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan @@ -354,18 +356,18 @@ else Write-Host "Clean " -NoNewline Write-Host "[SUCCESSFUL]" -ForegroundColor Green Write-Host - } # Clean_Package_Zip + } # Clean_Package_Zip # ============================================================================ # Compile tasks # ============================================================================ if ($Compile_GHDL) { if ($Clean) - { Write-Host } + { Write-Host } - $Script_Path = $GHDLWindowsDir + "\compile-ghdl.ps1" - $Script_Parameters = @() - $Script_Parameters = @( + $Script_Path = $GHDLWindowsDir + "\compile-ghdl.ps1" + $Script_Parameters = @() + $Script_Parameters = @( '-All', '-Hosted', '-Verbose:$EnableVerbose', @@ -391,14 +393,14 @@ else Write-Host "[SUCCESSFUL]" -ForegroundColor Green Write-Host } - } # Compile_GHDL + } # Compile_GHDL if ($Compile_Libraries) { if ($Compile_GHDL) - { Write-Host } + { Write-Host } - $Script_Path = $GHDLWindowsDir + "\compile-libraries.ps1" - $Script_Parameters = @() - $Script_Parameters = @( + $Script_Path = $GHDLWindowsDir + "\compile-libraries.ps1" + $Script_Parameters = @() + $Script_Parameters = @( '-Compile', '-Hosted', '-Verbose:$EnableVerbose', @@ -427,12 +429,12 @@ else Write-Host "[SUCCESSFUL]" -ForegroundColor Green Write-Host } - } # Compile_GHDL + } # Compile_GHDL # ============================================================================ # Package tasks # ============================================================================ - if ($CreatePackage) + if ($Package) { Write-Host "Creating an installation package for GHDL $GHDLVersion for Windows" $Good = $false @@ -443,7 +445,7 @@ else Write-Host "[Done]" -ForegroundColor Green } else - { Write-Host "[FAILED]" -ForegroundColor RED + { Write-Host "[FAILED]" -ForegroundColor RED Exit-Script -1 } @@ -465,26 +467,26 @@ else } Write-Host " Creating directory '$GHDLZipPackageDir' and sub-directories..." - New-Item -ItemType directory -Path "$GHDLZipPackageDir" -ErrorAction SilentlyContinue | Out-Null - New-Item -ItemType directory -Path "$GHDLZipPackageDir\bin" -ErrorAction SilentlyContinue | Out-Null - New-Item -ItemType directory -Path "$GHDLZipPackageDir\include" -ErrorAction SilentlyContinue | Out-Null - New-Item -ItemType directory -Path "$GHDLZipPackageDir\lib" -ErrorAction SilentlyContinue | Out-Null + New-Item -ItemType directory -Path "$GHDLZipPackageDir" -ErrorAction SilentlyContinue | Out-Null + New-Item -ItemType directory -Path "$GHDLZipPackageDir\bin" -ErrorAction SilentlyContinue | Out-Null + New-Item -ItemType directory -Path "$GHDLZipPackageDir\include" -ErrorAction SilentlyContinue | Out-Null + New-Item -ItemType directory -Path "$GHDLZipPackageDir\lib" -ErrorAction SilentlyContinue | Out-Null Write-Host " Gathering files..." # executables - Copy-Item "$GHDLBuildDir\ghdl.exe" "$GHDLZipPackageDir\bin\ghdl.exe" -ErrorAction SilentlyContinue + Copy-Item "$GHDLBuildDir\ghdl.exe" "$GHDLZipPackageDir\bin\ghdl.exe" -ErrorAction SilentlyContinue # include files - Copy-Item "$GHDLRootDir\src\grt\vpi_user.h" "$GHDLZipPackageDir\include" -ErrorAction SilentlyContinue + Copy-Item "$GHDLRootDir\src\grt\vpi_user.h" "$GHDLZipPackageDir\include" -ErrorAction SilentlyContinue # pre-compile scripts - Copy-Item $GHDLVendorLibraryDir -Recurse "$GHDLZipPackageDir\lib\vendors" -ErrorAction SilentlyContinue + Copy-Item $GHDLVendorLibraryDir -Recurse "$GHDLZipPackageDir\lib\vendors" -ErrorAction SilentlyContinue # pre-compiled libraries - Copy-Item $GHDLCompiledLibraryDir -Recurse "$GHDLZipPackageDir" -ErrorAction SilentlyContinue + Copy-Item $GHDLCompiledLibraryDir -Recurse "$GHDLZipPackageDir" -ErrorAction SilentlyContinue Write-Host " Compressing all files into '$GHDLZipPackageFile'..." $file = Get-ChildItem $GHDLZipPackageDir -Recurse | Write-Zip -IncludeEmptyDirectories -EntryPathRoot $GHDLZipPackageDir -OutputPath $GHDLZipPackageFile Write-Host " $([math]::round(($file.Length / 1MB), 3)) MiB written to disk" - - Write-Host + + Write-Host Write-Host "Creating package " -NoNewline Write-Host "[SUCCESSFUL]" -ForegroundColor Green Write-Host @@ -501,9 +503,9 @@ else } # Read ZIP file and convert it to base64 - $ResolvedPath = Resolve-Path "$GHDLZipPackageFile" - $CompressedFileContentAsBytes = [System.IO.File]::ReadAllBytes("$ResolvedPath") - $CompressedFileContentInBase64 = [System.Convert]::ToBase64String($CompressedFileContentAsBytes) + $ResolvedPath = Resolve-Path "$GHDLZipPackageFile" + $CompressedFileContentAsBytes = [System.IO.File]::ReadAllBytes("$ResolvedPath") + $CompressedFileContentInBase64 = [System.Convert]::ToBase64String($CompressedFileContentAsBytes) # Read a Installer template and add the base64 content $Installer = Get-Content $InstallerTemplateFile @@ -536,10 +538,10 @@ else $InstallPath = Get-Content $InstallDirFile -Encoding Ascii } else - { $InstallPath = $DefaultInstallPath } + { $InstallPath = $DefaultInstallPath } } else - { $InstallPath = $InstallDir } + { $InstallPath = $InstallDir } $InstallPath = $InstallPath.TrimEnd("\") if ($Zip) @@ -549,7 +551,7 @@ else Write-Host "[Done]" -ForegroundColor Green } else - { Write-Host "[FAILED]" -ForegroundColor RED + { Write-Host "[FAILED]" -ForegroundColor RED Exit-Script -1 } @@ -567,31 +569,38 @@ else } Write-Host " Install directory: $InstallPath" Write-Host " Creating directory '$InstallPath' and sub-directories..." - New-Item -ItemType directory -Path "$InstallPath" -ErrorAction SilentlyContinue | Out-Null - New-Item -ItemType directory -Path "$InstallPath\bin" -ErrorAction SilentlyContinue | Out-Null - New-Item -ItemType directory -Path "$InstallPath\include" -ErrorAction SilentlyContinue | Out-Null - New-Item -ItemType directory -Path "$InstallPath\lib" -ErrorAction SilentlyContinue | Out-Null + New-Item -ItemType directory -Path "$InstallPath" -ErrorAction SilentlyContinue | Out-Null + New-Item -ItemType directory -Path "$InstallPath\bin" -ErrorAction SilentlyContinue | Out-Null + New-Item -ItemType directory -Path "$InstallPath\include" -ErrorAction SilentlyContinue | Out-Null + New-Item -ItemType directory -Path "$InstallPath\lib" -ErrorAction SilentlyContinue | Out-Null Write-Host " Copying files..." # executables - Copy-Item "$GHDLBuildDir\ghdl.exe" "$InstallPath\bin\ghdl.exe" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue + Copy-Item "$GHDLBuildDir\ghdl.exe" "$InstallPath\bin\ghdl.exe" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue # include files - Copy-Item "$GHDLRootDir\src\grt\vpi_user.h" "$InstallPath\include" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue + Copy-Item "$GHDLRootDir\src\grt\vpi_user.h" "$InstallPath\include" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue # pre-compile scripts - Copy-Item $GHDLVendorLibraryDir -Recurse "$InstallPath\lib" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue + Copy-Item $GHDLVendorLibraryDir -Recurse "$InstallPath\lib" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue # pre-compiled libraries - Copy-Item $GHDLCompiledLibraryDir -Recurse "$InstallPath" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue - - Write-Host " Install GHDL in PATH at machine level? [" -NoNewline -ForegroundColor DarkCyan - Write-Host "M" -NoNewline -ForegroundColor Cyan - Write-Host "achine/" -NoNewline -ForegroundColor DarkCyan - Write-Host "u" -NoNewline -ForegroundColor Cyan - Write-Host "ser/" -NoNewline -ForegroundColor DarkCyan - Write-Host "s" -NoNewline -ForegroundColor Cyan - Write-Host "ession/" -NoNewline -ForegroundColor DarkCyan - Write-Host "n" -NoNewline -ForegroundColor Cyan - Write-Host "o]: " -NoNewline -ForegroundColor DarkCyan - $InstallInPath = (Read-Host).ToLower() + Copy-Item $GHDLCompiledLibraryDir -Recurse "$InstallPath" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue + + while($true) + { Write-Host " Install GHDL in PATH at machine level? [" -NoNewline -ForegroundColor DarkCyan + Write-Host "M" -NoNewline -ForegroundColor Cyan + Write-Host "achine/" -NoNewline -ForegroundColor DarkCyan + Write-Host "u" -NoNewline -ForegroundColor Cyan + Write-Host "ser/" -NoNewline -ForegroundColor DarkCyan + Write-Host "s" -NoNewline -ForegroundColor Cyan + Write-Host "ession/" -NoNewline -ForegroundColor DarkCyan + Write-Host "p" -NoNewline -ForegroundColor Cyan + Write-Host "ass]: " -NoNewline -ForegroundColor DarkCyan + $InstallInPath = (Read-Host).ToLower() + if ($InstallInPath -in "m","u","s","p") + { break } + else + { Write-Host "[ERROR]: Unsupported choice: '$InstallInPath'." -ForegroundColor Red } + } + if (($InstallInPath -eq "") -or ($InstallInPath -eq "m")) { Write-Host " Adding GHDL to PATH at machine level." Add-EnvPath -Path "$InstallPath\bin" -Container "Machine" @@ -613,8 +622,8 @@ else Write-Host Exit-Script - } # Zip - } # Install + } # Zip + } # Install elseif ($Update) { Write-Host "Updating GHDL $GHDLVersion for Windows..." if (Test-Path $InstallDirFile -PathType Leaf) @@ -622,7 +631,11 @@ else $InstallPath = Get-Content $InstallDirFile -Encoding Ascii } else - { $InstallPath = $InstallDir } + { if ($InstallDir -eq "") + { } + else + { $InstallPath = $InstallDir } + } $InstallPath = $InstallPath.TrimEnd("\") Write-Host " Install directory: $InstallPath" @@ -631,55 +644,79 @@ else Get-ChildItem -Path $InstallPath -Depth 0 | foreach { Remove-Item $_.FullName -Recurse -Force } } - Write-Host " Removing GHDL from PATH variables in Machine, User, Session ..." -ForegroundColor Yellow - foreach ($container in @("Machine", "User")) - { foreach ($entry in (Get-EnvPath -Container $container)) - { if ($entry.ToLower().Contains("ghdl")) - { Write-Host " Removing '$entry' from $container level." - Remove-EnvPath -Path $entry -Container $container - } - } - } - Remove-EnvPath -Path $entry -Container "Session" Write-Host " Creating directory sub-directories in '$InstallPath' ..." - New-Item -ItemType directory -Path "$InstallPath\bin" -ErrorAction SilentlyContinue | Out-Null - New-Item -ItemType directory -Path "$InstallPath\include" -ErrorAction SilentlyContinue | Out-Null - New-Item -ItemType directory -Path "$InstallPath\lib" -ErrorAction SilentlyContinue | Out-Null + New-Item -ItemType directory -Path "$InstallPath\bin" -ErrorAction SilentlyContinue | Out-Null + New-Item -ItemType directory -Path "$InstallPath\include" -ErrorAction SilentlyContinue | Out-Null + New-Item -ItemType directory -Path "$InstallPath\lib" -ErrorAction SilentlyContinue | Out-Null Write-Host " Copying files..." # executables - Copy-Item "$GHDLBuildDir\ghdl.exe" "$InstallPath\bin\ghdl.exe" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue + Copy-Item "$GHDLBuildDir\ghdl.exe" "$InstallPath\bin\ghdl.exe" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue # include files - Copy-Item "$GHDLRootDir\src\grt\vpi_user.h" "$InstallPath\include" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue + Copy-Item "$GHDLRootDir\src\grt\vpi_user.h" "$InstallPath\include" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue # pre-compile scripts - Copy-Item $GHDLVendorLibraryDir -Recurse "$InstallPath\lib" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue + Copy-Item $GHDLVendorLibraryDir -Recurse "$InstallPath\lib" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue # pre-compiled libraries - Copy-Item $GHDLCompiledLibraryDir -Recurse "$InstallPath" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue - - Write-Host " Install GHDL in PATH at machine level? [" -NoNewline -ForegroundColor DarkCyan - Write-Host "M" -NoNewline -ForegroundColor Cyan - Write-Host "achine/" -NoNewline -ForegroundColor DarkCyan - Write-Host "u" -NoNewline -ForegroundColor Cyan - Write-Host "ser/" -NoNewline -ForegroundColor DarkCyan - Write-Host "s" -NoNewline -ForegroundColor Cyan - Write-Host "ession/" -NoNewline -ForegroundColor DarkCyan - Write-Host "n" -NoNewline -ForegroundColor Cyan - Write-Host "o]: " -NoNewline -ForegroundColor DarkCyan - $InstallInPath = (Read-Host).ToLower() - if (($InstallInPath -eq "") -or ($InstallInPath -eq "m")) - { Write-Host " Adding GHDL to PATH at machine level." - Add-EnvPath -Path "$InstallPath\bin" -Container "Machine" - Add-EnvPath -Path "$InstallPath\bin" -Container "Session" - } - elseif ($InstallInPath -eq "u") - { Write-Host " Adding GHDL to PATH at user level." - Add-EnvPath -Path "$InstallPath\bin" -Container "User" - Add-EnvPath -Path "$InstallPath\bin" -Container "Session" + Copy-Item $GHDLCompiledLibraryDir -Recurse "$InstallPath" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue + + if ($AddToPath -eq "") + { while($true) + { Write-Host " Install GHDL in PATH at machine level? [" -NoNewline -ForegroundColor DarkCyan + Write-Host "M" -NoNewline -ForegroundColor Cyan + Write-Host "achine/" -NoNewline -ForegroundColor DarkCyan + Write-Host "u" -NoNewline -ForegroundColor Cyan + Write-Host "ser/" -NoNewline -ForegroundColor DarkCyan + Write-Host "s" -NoNewline -ForegroundColor Cyan + Write-Host "ession/" -NoNewline -ForegroundColor DarkCyan + Write-Host "r" -NoNewline -ForegroundColor Cyan + Write-Host "emove/" -NoNewline -ForegroundColor DarkCyan + Write-Host "p" -NoNewline -ForegroundColor Cyan + Write-Host "ass]: " -NoNewline -ForegroundColor DarkCyan + $InstallInPath = (Read-Host).ToLower() + if ($InstallInPath -in "m","u","s","r","p") + { break } + else + { Write-Host "[ERROR]: Unsupported choice: '$InstallInPath'." -ForegroundColor Red } + } } - elseif ($InstallInPath -eq "s") - { Write-Host " Adding GHDL to PATH at session level." - Add-EnvPath -Path "$InstallPath\bin" -Container "Session" + elseif ($AddToPath -eq "Machine") + { $InstallInPath = "m" } + elseif ($AddToPath -eq "User") + { $InstallInPath = "u" } + elseif ($AddToPath -eq "Session") + { $InstallInPath = "s" } + elseif ($AddToPath -eq "Remove") + { $InstallInPath = "r" } + elseif ($AddToPath -eq "Pass") + { $InstallInPath = "p" } + + if ($InstallInPath -ne "p") + { Write-Host " Removing GHDL from PATH variables in Machine, User, Session ..." -ForegroundColor Yellow + foreach ($container in @("Machine", "User")) + { foreach ($entry in (Get-EnvPath -Container $container)) + { if ($entry.ToLower().Contains("ghdl")) + { Write-Host " Removing '$entry' from $container level." + Remove-EnvPath -Path $entry -Container $container + } + } + } + Remove-EnvPath -Path $entry -Container "Session" + + if (($InstallInPath -eq "") -or ($InstallInPath -eq "m")) + { Write-Host " Adding GHDL to PATH at machine level." + Add-EnvPath -Path "$InstallPath\bin" -Container "Machine" + Add-EnvPath -Path "$InstallPath\bin" -Container "Session" + } + elseif ($InstallInPath -eq "u") + { Write-Host " Adding GHDL to PATH at user level." + Add-EnvPath -Path "$InstallPath\bin" -Container "User" + Add-EnvPath -Path "$InstallPath\bin" -Container "Session" + } + elseif ($InstallInPath -eq "s") + { Write-Host " Adding GHDL to PATH at session level." + Add-EnvPath -Path "$InstallPath\bin" -Container "Session" + } } Write-Host @@ -688,7 +725,7 @@ else Write-Host Exit-Script - } # Update + } # Update elseif ($Uninstall) { Write-Host "Uninstalling GHDL $GHDLVersion for Windows..." if (Test-Path $InstallDirFile -PathType Leaf) @@ -696,7 +733,7 @@ else $InstallPath = Get-Content $InstallDirFile -Encoding Ascii } else - { $InstallPath = $DefaultInstallPath } + { $InstallPath = $DefaultInstallPath } Write-Host " Install directory: $InstallPath" if (Test-Path -Path $InstallPath) @@ -721,8 +758,8 @@ else Write-Host Exit-Script - } # Uninstall + } # Uninstall -} # Clean +} # Clean Exit-Script 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 | [] []" + 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 Path to GHDL's binary directory, e.g. /usr/local/bin" + echo " --out Name of the output directory, e.g. xilinx-vivado" + echo " --src 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 -- cgit v1.2.3