From a41a009f2ebec350f0ebbcbf8353223a15cfa557 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 7 Jun 2016 20:54:10 +0200 Subject: Paebbels/master (#75) * Obviously, this is the initial commit on a .gitignore file. * Implemented vendor specific compile scripts for: Altera Quartus-II (tested with 15.0), Xilinx ISE (tested with 14.7) and OSVVM. * Minor fixes. * First version of a README file for the vendor specific library compile scripts. * Vendor specific simulation library compile scripts: Improved error handling by stream processing. Extracted configuration into a config.ps1 file. * Minor fixes. * Added Unisim SecureIP primitives. Added Unimacro library. * Fixed file encoding of compile-osvvm.ps1. Implemented a 'advanced functions' to restore ghdl warning/error messages as a one-liner. * Splitted Xilinx compile scripts into *-ise.ps1 and *-vivado.ps1. * Added compile script for VUnit. * Updated README.md for the vendor compile scripts. * Added file headers. Change config.ps1 and shared.ps1 to a PowerShell module (*.psm1). * Fixed embedded help pages in all compile scripts. * Fixed all errors in compile script for Vivado simulation libraries: *_retarget_VCOMP.vhd was missing. * First steps towards compile scripts for Linux. * Translated lines from Windows script to Linux script. * Step 3 - colors and basic control blocks. * Changed copyright line in file header. * Changed copyright line in file header. * Added colorizer rules. Added skip mode for existing object files. Added cleanup mode. * Disabled vital checks in Xilinx's simprim library. Fixed typo. * Added '-Clean' parameter to cleanup the directory before analyzing. * Added a new '-Help' switch to all compile scripts to show the embedded help page(s). * Generalized config.sh. Fixed some bugs in compile-xilinx-ise.sh. * Added command line argument parsing. * Fixed syntax errors on Linux. * Added --all option. Generalized GHDL parameters. * Added '--skip-largefile' option. * Added the 'stop compiling' feature (not working). * Updated README.md for vendor specific compile scripts. * Implemented a check if grcat is installed on the system. Added support to execute the script from an other directory. Changed file size test from 'du -b' to 'wc -b'. * Fixed exit code problem in pipes. Fixed word count problem. * Minor fixes. * Fixed possible syntax error. * Implemented vendor specific library compile script for OSVVM. * Implemented vendor specific library compile script for VUnit. * Enabled disabled messages. Fixed typos. * Implemented vendor specific library compile script for Xilinx Vivado. * Minor fixes. * Implemented vendor specific library compile script for Altera Quartus-II. * Applied chmod to all new compile scripts. * Minor fixes. * Fixed typos. * Implemented 'halt-on-error' feature. * Fixed relative path problem for grcat. * README updates. * Updated PoSh scripts for - IEEE library compilation (complib.ps1) - added VITAL2000 support for VHDL-2008 - minor fixes - vendor compile scripts - added VHDL93 and VHDL2008 switches to compile vendor libraries with VHDL-2008 - minor fixes * Updated vendor library compile scripts (Bash) for Linux, too. * Fixed error in vendor library compile scripts for osvvm and vunit. * Windows compile scripts for mcode backend: Reworked compile.ps1. * Changed default output directory to xilinx-ise and xilinx-vivado. * compile-altera.sh: Skip large files * Updated compile script for OSVVM. * Improved OSVVM compile script for Linux. --- libraries/vendors/README.md | 79 +++++-- libraries/vendors/compile-altera.ps1 | 248 +++++++++++++++++----- libraries/vendors/compile-altera.sh | 306 ++++++++++++++++++---------- libraries/vendors/compile-lattice.sh | 5 +- libraries/vendors/compile-osvvm.ps1 | 58 +++--- libraries/vendors/compile-osvvm.sh | 176 ++++++++++------ libraries/vendors/compile-vunit.ps1 | 110 +++++----- libraries/vendors/compile-vunit.sh | 124 ++++++----- libraries/vendors/compile-xilinx-ise.ps1 | 146 +++++++++---- libraries/vendors/compile-xilinx-ise.sh | 117 +++++++---- libraries/vendors/compile-xilinx-vivado.ps1 | 122 +++++++---- libraries/vendors/compile-xilinx-vivado.sh | 95 ++++++--- libraries/vendors/config.psm1 | 8 +- libraries/vendors/config.sh | 37 +++- 14 files changed, 1094 insertions(+), 537 deletions(-) (limited to 'libraries') diff --git a/libraries/vendors/README.md b/libraries/vendors/README.md index 81a3306bc..3486a1556 100644 --- a/libraries/vendors/README.md +++ b/libraries/vendors/README.md @@ -87,14 +87,15 @@ The compilation scripts are writen in shell languages: PowerShell for Windows an - **Step 1 - Configure the scripts** Please open the `config.psm1` file and set the dictionary entries for the installed - vendor tools to the appropriate directory to your tool's installation folder. + vendor tools to the appropriate directory to your tool's installation folder. Use an + empty string `""` for not installed tools. `config.psm1`: ```PowerShell $InstallationDirectory = @{ "AlteraQuartusII" = "C:\Altera\15.0"; "XilinxISE" = "C:\Xilinx\14.7"; - "XilinxVivado" = "C:\Xilinx\Vivado\2015.3"; + "XilinxVivado" = "C:\Xilinx\Vivado\2015.4"; "OSVVM" = "D:\git\GitHub\osvvm"; "VUnit" = "D:\git\GitHub\vunit" } @@ -137,61 +138,107 @@ The compilation scripts are writen in shell languages: PowerShell for Windows an - Common parameters to all scripts: -h --help Print the embedded help page(s). - -a --all Compile all libraries, including common libraries, packages and device libraries. -c --clean Cleanup directory before analyzing. -n --no-warnings Don't show warnings. Report errors only. -s --skip-existing Skip already compiled files (an *.o file exists). -S --skip-largefiles Don't compile large entities like DSP and PCIe primitives. -H --halt-on-error Stop compiling if an error occured. - `compile-altera.sh` + Selectable libraries: - --altera Compile base libraries like 'altera' and 'altera_mf' - --max Compile device libraries for Max CPLDs - --arria Compile device libraries for Arria FPGAs - --cyclone Compile device libraries for Cyclone FPGAs - --stratix Compile device libraries for Stratix FPGAs + -a --all Compile all libraries, including common libraries, packages and device libraries. + --altera Compile base libraries like 'altera' and 'altera_mf' + --max Compile device libraries for Max CPLDs + --arria Compile device libraries for Arria FPGAs + --cyclone Compile device libraries for Cyclone FPGAs + --stratix Compile device libraries for Stratix FPGAs + Compile options: + + --vhdl93 Compile selected libraries with VHDL-93 (default). + --vhdl2008 Compile selected libraries with VHDL-2008. - `compile-xilinx-ise.sh` + Selectable libraries: - --unisim Compile the unisim primitives - --unimacro Compile the unimacro macros - --simprim Compile the simprim primitives - --secureip Compile the secureip primitives + -a --all Compile all libraries, including common libraries, packages and device libraries. + --unisim Compile the unisim primitives + --unimacro Compile the unimacro macros + --simprim Compile the simprim primitives + --secureip Compile the secureip primitives + Compile options: + + --vhdl93 Compile selected libraries with VHDL-93 (default). + --vhdl2008 Compile selected libraries with VHDL-2008. - `compile-xilinx-vivado.sh` + Selectable libraries: - --unisim Compile the unisim primitives - --unimacro Compile the unimacro macros - --secureip Compile the secureip primitives + -a --all Compile all libraries, including common libraries, packages and device libraries. + --unisim Compile the unisim primitives + --unimacro Compile the unimacro macros + --secureip Compile the secureip primitives + Compile options: + + --vhdl93 Compile selected libraries with VHDL-93 (default). + --vhdl2008 Compile selected libraries with VHDL-2008. - `compile-osvvm.sh` + Selectable libraries: + + -a --all Compile all. - `compile-vunit.sh` + Selectable libraries: + + -a --all Compile all. ### Selectable Options for the PowerShell Scripts: - Common parameters to all scripts: -Help Print the embedded help page(s). - -All Compile all libraries, including common libraries, packages and device libraries. -Clean Cleanup directory before analyzing. -SuppressWarnings Don't show warnings. Report errors only. - `compile-altera.ps1` + Selectable libraries: + -All Compile all libraries, including common libraries, packages and device libraries. -Altera Compile base libraries like 'altera' and 'altera_mf' -Max Compile device libraries for Max CPLDs -Arria Compile device libraries for Arria FPGAs -Cyclone Compile device libraries for Cyclone FPGAs -Stratix Compile device libraries for Stratix FPGAs + Compile options: + + -VHDL93 Compile selected libraries with VHDL-93 (default). + -VHDL2008 Compile selected libraries with VHDL-2008. - `compile-xilinx-ise.ps1` + Selectable libraries: + -All Compile all libraries, including common libraries, packages and device libraries. -Unisim Compile the unisim primitives -Unimacro Compile the unimacro macros -Simprim Compile the simprim primitives -Secureip Compile the secureip primitives + Compile options: + + -VHDL93 Compile selected libraries with VHDL-93 (default). + -VHDL2008 Compile selected libraries with VHDL-2008. - `compile-xilinx-vivado.ps1` + Selectable libraries: + -All Compile all libraries, including common libraries, packages and device libraries. -Unisim Compile the unisim primitives -Unimacro Compile the unimacro macros -Secureip Compile the secureip primitives + Compile options: + + -VHDL93 Compile selected libraries with VHDL-93 (default). + -VHDL2008 Compile selected libraries with VHDL-2008. - `compile-osvvm.ps1` + Selectable libraries: + + -All Compile all. - `compile-vunit.ps1` + Selectable libraries: + + -All Compile all. ------------------------ Author: Patrick Lehmann (30.11.2015) diff --git a/libraries/vendors/compile-altera.ps1 b/libraries/vendors/compile-altera.ps1 index cfd4bd5fa..aaf9786a9 100644 --- a/libraries/vendors/compile-altera.ps1 +++ b/libraries/vendors/compile-altera.ps1 @@ -54,7 +54,7 @@ [CmdletBinding()] param( # Compile all libraries and packages. - [switch]$All = $null, + [switch]$All = $false, # Compile the Altera standard libraries: lpm, sgate, altera, altera_mf, altera_lnsim [switch]$Altera = $false, @@ -74,11 +74,18 @@ param( # Unknown device library [switch]$Nanometer = $false, + # Set VHDL Standard to '93 + [switch]$VHDL93 = $false, + # Set VHDL Standard to '08 + [switch]$VHDL2008 = $false, + # Clean up directory before analyzing. [switch]$Clean = $false, # Skip warning messages. (Show errors only.) [switch]$SuppressWarnings = $false, + # Halt on errors + [switch]$HaltOnError = $false, # Show the embedded help page(s) [switch]$Help = $false @@ -101,9 +108,7 @@ Import-Module $PSScriptRoot\shared.psm1 $SourceDir = $InstallationDirectory["AlteraQuartusII"] + "\quartus\eda\sim_lib" $DestinationDir = $DestinationDirectory["Altera"] -if (-not $All) -{ $All = $false } -elseif ($All -eq $true) +if ($All -eq $true) { $Altera = $true $Max = $true $Cyclone = $true @@ -112,11 +117,24 @@ elseif ($All -eq $true) $Nanometer = $true } -$StopCompiling = $false +if ($VHDL93 -eq $true) +{ $VHDLStandard = "93c" + $VHDLFlavor = "synopsys" +} +elseif ($VHDL2008 -eq $true) +{ $VHDLStandard = "08" + $VHDLFlavor = "standard" +} +else +{ $VHDLStandard = "93c" + $VHDLFlavor = "synopsys" +} +$StopCompiling = $false +$ErrorCount = 0 # define global GHDL Options -$GlobalOptions = ("-a", "-fexplicit", "-frelaxed-rules", "--mb-comments", "--warn-binding", "--ieee=synopsys", "--no-vital-checks", "--std=93c") +$GlobalOptions = ("-a", "-fexplicit", "-frelaxed-rules", "--mb-comments", "--warn-binding", "--ieee=$VHDLFlavor", "--no-vital-checks", "--std=$VHDLStandard") # create "Altera" directory and change to it Write-Host "Creating vendor directory: '$DestinationDir'" -ForegroundColor Yellow @@ -143,8 +161,13 @@ if ((-not $StopCompiling) -and $Altera) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=lpm " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -159,8 +182,13 @@ if ((-not $StopCompiling) -and $Altera) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=sgate " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -179,8 +207,13 @@ if ((-not $StopCompiling) -and $Altera) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=altera " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -195,8 +228,13 @@ if ((-not $StopCompiling) -and $Altera) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=altera_mf " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -209,8 +247,13 @@ if ((-not $StopCompiling) -and $Altera) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=altera_lnsim " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -227,8 +270,13 @@ if ((-not $StopCompiling) -and $Max) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=max " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -243,8 +291,13 @@ if ((-not $StopCompiling) -and $Max) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=maxii " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -259,8 +312,13 @@ if ((-not $StopCompiling) -and $Max) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=maxv " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -277,8 +335,13 @@ if ((-not $StopCompiling) -and $Arria) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=arriaii " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -293,8 +356,13 @@ if ((-not $StopCompiling) -and $Arria) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=arriaii_pcie_hip " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -310,8 +378,13 @@ if ((-not $StopCompiling) -and $Arria) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=arriaiigz " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -328,8 +401,13 @@ if ((-not $StopCompiling) -and $Arria) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=arriav " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -346,8 +424,13 @@ if ((-not $StopCompiling) -and $Arria) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=arriavgz " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -362,8 +445,13 @@ if ((-not $StopCompiling) -and $Arria) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=arriavgz_pcie_hip " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -380,8 +468,13 @@ if ((-not $StopCompiling) -and $Cyclone) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=cycloneiv " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -396,8 +489,13 @@ if ((-not $StopCompiling) -and $Cyclone) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=cycloneiv_pcie_hip " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -412,8 +510,13 @@ if ((-not $StopCompiling) -and $Cyclone) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=cycloneive " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -430,8 +533,13 @@ if ((-not $StopCompiling) -and $Cyclone) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=cyclonev " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -448,8 +556,13 @@ if ((-not $StopCompiling) -and $Stratix) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=stratixiv " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -464,8 +577,13 @@ if ((-not $StopCompiling) -and $Stratix) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=stratixiv_pcie_hip " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -482,8 +600,13 @@ if ((-not $StopCompiling) -and $Stratix) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=stratixv " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -498,8 +621,13 @@ if ((-not $StopCompiling) -and $Stratix) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=stratixv_pcie_hip " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -514,8 +642,13 @@ if ((-not $StopCompiling) -and $Nanometer) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=fiftyfivenm " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -534,14 +667,19 @@ if ((-not $StopCompiling) -and $Nanometer) { Write-Host "Analyzing file '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=twentynm " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } Write-Host "--------------------------------------------------------------------------------" Write-Host "Compiling Altera libraries " -NoNewline -if ($StopCompiling) +if ($ErrorCount -gt 0) { Write-Host "[FAILED]" -ForegroundColor Red } else { Write-Host "[SUCCESSFUL]" -ForegroundColor Green } diff --git a/libraries/vendors/compile-altera.sh b/libraries/vendors/compile-altera.sh index fdffc99b2..d73a5fabd 100755 --- a/libraries/vendors/compile-altera.sh +++ b/libraries/vendors/compile-altera.sh @@ -101,6 +101,12 @@ while [[ $# > 0 ]]; do NANOMETER=TRUE NO_COMMAND=FALSE ;; + --vhdl93) + VHDL93=TRUE + ;; + --vhdl2008) + VHDL2008=TRUE + ;; *) # unknown option UNKNOWN_OPTION=TRUE ;; @@ -141,6 +147,8 @@ elif [ "$HELP" == "TRUE" ]; then 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 entities like DSP and PCIe primitives." echo " -H --halt-on-error Halt on error(s)." @@ -161,13 +169,23 @@ if [ "$ALL" == "TRUE" ]; then NANOMETER=TRUE fi +if [ "$VHDL93" == "TRUE" ]; then + VHDLStandard="93c" + VHDLFlavor="synopsys" +elif [ "$VHDL2008" == "TRUE" ]; then + VHDLStandard="08" + VHDLFlavor="standard" +else + VHDLStandard="93c" + VHDLFlavor="synopsys" +fi + # extract data from configuration -InstallDir=${InstallationDirectory[AlteraQuartusII]} -SourceDir="$InstallDir/quartus/eda/sim_lib" -DestinationDir=${DestinationDirectory[AlteraQuartusII]} +SourceDir=${SourceDirectory[AlteraQuartus]} +DestinationDir=${DestinationDirectory[AlteraQuartus]} -if [ -z $InstallDir ] || [ -z $DestinationDir ]; then - echo -e "${COLORED_ERROR} Altera Quartus-II is not configured in '$ScriptDir/config.sh'${ANSI_RESET}" +if [ -z $DestinationDir ]; then + echo -e "${COLORED_ERROR} Altera Quartus is not configured in '$ScriptDir/config.sh'${ANSI_RESET}" exit -1 elif [ ! -d $SourceDir ]; then echo -e "${COLORED_ERROR} Path '$SourceDir' does not exist.${ANSI_RESET}" @@ -201,6 +219,7 @@ else fi STOPCOMPILING=FALSE +ERRORCOUNT=0 # Cleanup directory # ============================================================================== @@ -215,7 +234,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ALTERA" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'lpm' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/220pack.vhd $SourceDir/220model.vhd @@ -227,9 +246,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ALTERA" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=lpm "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -239,7 +261,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ALTERA" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'sgate' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/sgate_pack.vhd $SourceDir/sgate.vhd @@ -251,9 +273,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ALTERA" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=sgate "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -263,7 +288,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ALTERA" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'altera' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/altera_europa_support_lib.vhd $SourceDir/altera_primitives_components.vhd @@ -279,9 +304,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ALTERA" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=altera "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -291,7 +319,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ALTERA" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'altera_mf' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/altera_mf_components.vhd $SourceDir/altera_mf.vhd @@ -303,9 +331,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ALTERA" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=altera_mf "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -315,7 +346,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ALTERA" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'altera_lnsim' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/altera_lnsim_components.vhd ) @@ -340,7 +371,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$MAX" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'max' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/max_atoms.vhd $SourceDir/max_components.vhd @@ -352,9 +383,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$MAX" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=max "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -364,7 +398,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$MAX" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'maxii' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/maxii_atoms.vhd $SourceDir/maxii_components.vhd @@ -376,9 +410,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$MAX" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=maxii "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -388,7 +425,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$MAX" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'maxv' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/maxv_atoms.vhd $SourceDir/maxv_components.vhd @@ -400,9 +437,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$MAX" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=maxv "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -412,7 +452,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ARRIA" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'arriaii' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/arriaii_atoms.vhd $SourceDir/arriaii_components.vhd @@ -426,9 +466,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ARRIA" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=arriaii "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -437,21 +480,26 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ARRIA" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'arriaii_pcie_hip' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/arriaii_pcie_hip_components.vhd $SourceDir/arriaii_pcie_hip_atoms.vhd ) for File in ${Files[@]}; do FileName=$(basename "$File") - if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then + if [ "$SKIP_LARGE_FILES" == "TRUE" ]; then + echo -e "${ANSI_CYAN}Skipping large file '$File'${ANSI_RESET}" + elif [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}" else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=arriaii_pcie_hip "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -461,7 +509,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ARRIA" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'arriaiigz' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/arriaiigz_atoms.vhd $SourceDir/arriaiigz_components.vhd @@ -474,9 +522,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ARRIA" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=arriaiigz "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -486,7 +537,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ARRIA" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'arriav' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/arriav_atoms.vhd $SourceDir/arriav_components.vhd @@ -500,9 +551,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ARRIA" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=arriav "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -512,7 +566,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ARRIA" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'arriavgz' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/arriavgz_atoms.vhd $SourceDir/arriavgz_components.vhd @@ -526,9 +580,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ARRIA" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=arriavgz "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -537,21 +594,26 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$ARRIA" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'arriavgz_pcie_hip' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/arriavgz_pcie_hip_components.vhd $SourceDir/arriavgz_pcie_hip_atoms.vhd ) for File in ${Files[@]}; do FileName=$(basename "$File") - if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then + if [ "$SKIP_LARGE_FILES" == "TRUE" ]; then + echo -e "${ANSI_CYAN}Skipping large file '$File'${ANSI_RESET}" + elif [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}" else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=arriavgz_pcie_hip "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -561,7 +623,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$CYCLONE" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'cycloneiv' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/cycloneiv_atoms.vhd $SourceDir/cycloneiv_components.vhd @@ -575,9 +637,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$CYCLONE" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=cycloneiv "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -586,21 +651,26 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$CYCLONE" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'cycloneiv_pcie_hip' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/cycloneiv_pcie_hip_components.vhd $SourceDir/cycloneiv_pcie_hip_atoms.vhd ) for File in ${Files[@]}; do FileName=$(basename "$File") - if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then + if [ "$SKIP_LARGE_FILES" == "TRUE" ]; then + echo -e "${ANSI_CYAN}Skipping large file '$File'${ANSI_RESET}" + elif [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}" else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=cycloneiv_pcie_hip "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -610,7 +680,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$CYCLONE" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'cycloneive' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/cycloneive_atoms.vhd $SourceDir/cycloneive_components.vhd @@ -622,9 +692,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$CYCLONE" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=cycloneive "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -634,7 +707,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$CYCLONE" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'cyclonev' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/cyclonev_atoms.vhd $SourceDir/cyclonev_components.vhd @@ -648,9 +721,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$CYCLONE" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=cyclonev "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -660,7 +736,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$STRATIX" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'stratixiv' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/stratixiv_atoms.vhd $SourceDir/stratixiv_components.vhd @@ -674,9 +750,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$STRATIX" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=stratixiv "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -685,21 +764,26 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$STRATIX" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'stratixiv_pcie_hip' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/stratixiv_pcie_hip_components.vhd $SourceDir/stratixiv_pcie_hip_atoms.vhd ) for File in ${Files[@]}; do FileName=$(basename "$File") - if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then + if [ "$SKIP_LARGE_FILES" == "TRUE" ]; then + echo -e "${ANSI_CYAN}Skipping large file '$File'${ANSI_RESET}" + elif [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}" else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=stratixiv_pcie_hip "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -709,7 +793,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$STRATIX" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'stratixv' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/stratixv_atoms.vhd $SourceDir/stratixv_components.vhd @@ -723,9 +807,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$STRATIX" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=stratixv "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -734,21 +821,26 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$STRATIX" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'stratixv_pcie_hip' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/stratixv_pcie_hip_components.vhd $SourceDir/stratixv_pcie_hip_atoms.vhd ) for File in ${Files[@]}; do FileName=$(basename "$File") - if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then + if [ "$SKIP_LARGE_FILES" == "TRUE" ]; then + echo -e "${ANSI_CYAN}Skipping large file '$File'${ANSI_RESET}" + elif [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}" else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=stratixv_pcie_hip "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -758,7 +850,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$NANOMETER" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'fiftyfivenm' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/fiftyfivenm_atoms.vhd $SourceDir/fiftyfivenm_components.vhd @@ -770,9 +862,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$NANOMETER" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=fiftyfivenm "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -782,7 +877,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$NANOMETER" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'twentynm' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/twentynm_atoms.vhd $SourceDir/twentynm_components.vhd @@ -798,9 +893,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$NANOMETER" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=twentynm "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -808,7 +906,7 @@ fi echo "--------------------------------------------------------------------------------" echo -n "Compiling Altera Quartus-II libraries " -if [ "$STOPCOMPILING" == "TRUE" ]; then +if [ $ERRORCOUNT -gt 0 ]; then echo -e $COLORED_FAILED else echo -e $COLORED_SUCCESSFUL diff --git a/libraries/vendors/compile-lattice.sh b/libraries/vendors/compile-lattice.sh index 4a982799f..8155aaf68 100755 --- a/libraries/vendors/compile-lattice.sh +++ b/libraries/vendors/compile-lattice.sh @@ -132,11 +132,10 @@ elif [ "$HELP" == "TRUE" ]; then fi # extract data from configuration -InstallDir=${InstallationDirectory[LatticeDiamond]} -SourceDir="$InstallDir/cae_library/simulation/vhdl" +SourceDir=${SourceDirectory[LatticeDiamond]} DestinationDir=${DestinationDirectory[LatticeDiamond]} -if [ -z $InstallDir ] || [ -z $DestinationDir ]; then +if [ -z $DestinationDir ]; then echo -e "${COLORED_ERROR} Lattice Diamond is not configured in '$ScriptDir/config.sh'${ANSI_RESET}" exit -1 elif [ ! -d $SourceDir ]; then diff --git a/libraries/vendors/compile-osvvm.ps1 b/libraries/vendors/compile-osvvm.ps1 index 7f271c252..c8c643db9 100644 --- a/libraries/vendors/compile-osvvm.ps1 +++ b/libraries/vendors/compile-osvvm.ps1 @@ -46,10 +46,12 @@ param( [switch]$All = $true, # Clean up directory before analyzing. - [switch]$Clean = $false, + [switch]$Clean = $false, # Skip warning messages. (Show errors only.) [switch]$SuppressWarnings = $false, + # Halt on errors + [switch]$HaltOnError = $false, # Show the embedded help page(s) [switch]$Help = $false @@ -72,14 +74,11 @@ Import-Module $PSScriptRoot\shared.psm1 $SourceDir = $InstallationDirectory["OSVVM"] $DestinationDir = $DestinationDirectory["OSVVM"] -if (-not $All) -{ $All = $false } -elseif ($All -eq $true) +if ($All -eq $true) { # nothing to configure } -$StopCompiling = $false - +$ErrorCount = 0 # define global GHDL Options $GlobalOptions = ("-a", "-fexplicit", "-frelaxed-rules", "--mb-comments", "--warn-binding", "--no-vital-checks", "--std=08") @@ -97,34 +96,35 @@ if ($Clean) } # compile osvvm library -if (-not $StopCompiling) -{ Write-Host "Compiling library 'osvvm' ..." -ForegroundColor Yellow - $Options = $GlobalOptions - $Files = ( - "$SourceDir\NamePkg.vhd", - "$SourceDir\OsvvmGlobalPkg.vhd", - "$SourceDir\TextUtilPkg.vhd", - "$SourceDir\TranscriptPkg.vhd", - "$SourceDir\AlertLogPkg.vhd", - "$SourceDir\MemoryPkg.vhd", - "$SourceDir\MessagePkg.vhd", - "$SourceDir\SortListPkg_int.vhd", - "$SourceDir\RandomBasePkg.vhd", - "$SourceDir\RandomPkg.vhd", - "$SourceDir\CoveragePkg.vhd", - "$SourceDir\OsvvmContext.vhd") - foreach ($File in $Files) - { Write-Host "Analyzing package '$File'" -ForegroundColor Cyan - $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=osvvm " + $File + " 2>&1" - $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } +Write-Host "Compiling library 'osvvm' ..." -ForegroundColor Yellow +$Options = $GlobalOptions +$Files = ( + "$SourceDir\NamePkg.vhd", + "$SourceDir\OsvvmGlobalPkg.vhd", + "$SourceDir\TextUtilPkg.vhd", + "$SourceDir\TranscriptPkg.vhd", + "$SourceDir\AlertLogPkg.vhd", + "$SourceDir\MemoryPkg.vhd", + "$SourceDir\MessagePkg.vhd", + "$SourceDir\SortListPkg_int.vhd", + "$SourceDir\RandomBasePkg.vhd", + "$SourceDir\RandomPkg.vhd", + "$SourceDir\CoveragePkg.vhd", + "$SourceDir\OsvvmContext.vhd") +foreach ($File in $Files) +{ Write-Host "Analyzing package '$File'" -ForegroundColor Cyan + $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=osvvm " + $File + " 2>&1" + $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { break } } } Write-Host "--------------------------------------------------------------------------------" Write-Host "Compiling OSVVM library " -NoNewline -if ($StopCompiling) +if ($ErrorCount -gt 0) { Write-Host "[FAILED]" -ForegroundColor Red } else { Write-Host "[SUCCESSFUL]" -ForegroundColor Green } diff --git a/libraries/vendors/compile-osvvm.sh b/libraries/vendors/compile-osvvm.sh index fe20e3872..d7430434f 100755 --- a/libraries/vendors/compile-osvvm.sh +++ b/libraries/vendors/compile-osvvm.sh @@ -4,10 +4,10 @@ # kate: tab-width 2; replace-tabs off; indent-width 2; # # ============================================================================== -# Bash Script: Script to compile the OSVVM library for GHDL on Linux -# # Authors: Patrick Lehmann # +# Bash Script: Script to compile the OSVVM library for GHDL on Linux +# # Description: # ------------------------------------ # This is a Bash script (executable) which: @@ -15,7 +15,7 @@ # - compiles all OSVVM packages # # ============================================================================== -# Copyright (C) 2015 Patrick Lehmann +# Copyright (C) 2015-2016 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 @@ -37,15 +37,17 @@ # save working directory WorkingDir=$(pwd) ScriptDir="$(dirname $0)" -ScriptDir="$(realpath $ScriptDir)" +ScriptDir="$(readlink -f $ScriptDir)" # source configuration file from GHDL's 'vendors' library directory source $ScriptDir/config.sh source $ScriptDir/shared.sh -NO_COMMAND=TRUE - # command line argument processing +NO_COMMAND=TRUE +GHDLBinDir="" +DestDir="" +SrcDir="" while [[ $# > 0 ]]; do key="$1" case $key in @@ -54,7 +56,11 @@ while [[ $# > 0 ]]; do NO_COMMAND=FALSE ;; -a|--all) - ALL=TRUE + COMPILE_ALL=TRUE + NO_COMMAND=FALSE + ;; + -o|--osvvm) + COMPILE_OSVVM=TRUE NO_COMMAND=FALSE ;; -s|--skip-existing) @@ -66,13 +72,22 @@ while [[ $# > 0 ]]; do -H|--halt-on-error) HALT_ON_ERROR=TRUE ;; -# -v|--verbose) -# VERBOSE=TRUE -# ;; -h|--help) HELP=TRUE NO_COMMAND=FALSE ;; + --ghdl) + GHDLBinDir="$2" + shift # past argument + ;; + --src) + SrcDir="$2" + shift # past argument + ;; + --out) + DestDir="$2" + shift # past argument + ;; *) # unknown option UNKNOWN_OPTION=TRUE ;; @@ -93,50 +108,88 @@ elif [ "$HELP" == "TRUE" ]; then fi echo "" echo "Synopsis:" - echo " Script to compile the simulation library OSVVM for GHDL on Linux" + echo " A script to compile the simulation library 'OSVVM' for GHDL on Linux." + echo " A library folder 'osvvm/v08' 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-osvvm.sh | []" -# [-v] [-c] [--all] [-s|--skip-existing] [-n|--no-warnings] + echo " compile-osvvm.sh | [] []" echo "" echo "Common commands:" - echo " -h --help Print this help page" - echo " -c --clean Remove all generated files" + echo " -h --help Print this help page" + echo " -c --clean Remove all generated files" echo "" echo "Libraries:" - echo " -a --all Compile all packages." + echo " -a --all Compile all packages (default)." + echo " -o --osvvm Compile package osvvm." echo "" echo "Library compile options:" - echo " -s --skip-existing Skip already compiled files (an *.o file exists)." - echo " -H --halt-on-error Halt on error(s)." + echo " -s --skip-existing Skip already compiled files (an *.o file exists)." + echo " -H --halt-on-error Halt on error(s)." + echo "" + echo "Advanced options:" + echo " --ghdl Path to GHDL binary directory e.g. /usr/bin." + echo " --out Name of the output directory." + echo " --src Name of the output directory." echo "" echo "Verbosity:" -# echo " -v --verbose Print more messages" echo " -n --no-warnings Suppress all warnings. Show only error messages." echo "" exit 0 fi -if [ "$ALL" == "TRUE" ]; then - UNISIM=TRUE - UNIMACRO=TRUE - SIMPRIM=TRUE - SECUREIP=TRUE +if [ "$COMPILE_ALL" == "TRUE" ]; then + COMPILE_OSVVM=TRUE fi -# extract data from configuration -InstallDir=${InstallationDirectory[OSVVM]} -SourceDir="$InstallDir" +SourceDirectory=${SourceDirectory[OSVVM]} DestinationDir=${DestinationDirectory[OSVVM]} -if [ -z $InstallDir ] || [ -z $DestinationDir ]; then +# OSVVM source directory +# ---------------------- +# If a command line argument ('--src') was passed in, use it, else use the default value +# from config.sh +if [ ! -z "$SrcDir" ]; then + SourceDirectory=$SrcDir +fi +# OSVVM output directory +# ---------------------- +# If a command line argument ('--out') was passed in, use it, else use the default value +# from config.sh +if [ ! -z "$DestDir" ]; then + DestinationDir=$DestDir +fi + +# Use GHDL binary directory from command line argument, if set +if [ ! -z "$GHDLBinDir" ]; then + GHDLBinary=$GHDLBinDir/ghdl + if [[ ! -x "$GHDLBinary" ]]; then + echo -e "${COLORED_ERROR} GHDL not found or is not executable.${ANSI_RESET}" + exit -1 + fi +else # fall back to GHDL found via PATH + GHDLBinary=$(which ghdl) + if [ $? -ne 0 ]; then + echo -e "${COLORED_ERROR} GHDL not found in PATH.${ANSI_RESET}" + echo -e " Use adv. options '--ghdl' to set the GHDL binary directory." + exit -1 + fi +fi + +if [ -z $SourceDirectory ] || [ -z $DestinationDir ]; then echo -e "${COLORED_ERROR} OSVVM is not configured in '$ScriptDir/config.sh'${ANSI_RESET}" + echo -e " Use adv. options '--src' and '--out' or configure 'config.sh'." exit -1 -elif [ ! -d $SourceDir ]; then +elif [ ! -d $SourceDirectory ]; then echo -e "${COLORED_ERROR} Path '$SourceDir' does not exist.${ANSI_RESET}" exit -1 fi +# append VHDL version folder +DestinationDir=$DestinationDir/v08 + # set bash options set -o pipefail @@ -148,7 +201,7 @@ if [[ -d "$DestinationDir" ]]; then echo -e "${ANSI_YELLOW}Vendor directory '$DestinationDir' already exists.${ANSI_RESET}" else echo -e "${ANSI_YELLOW}Creating vendor directory: '$DestinationDir'${ANSI_RESET}" - mkdir "$DestinationDir" + mkdir -p "$DestinationDir" fi cd $DestinationDir @@ -163,57 +216,60 @@ else fi fi -STOPCOMPILING=FALSE - # Cleanup directory # ============================================================================== if [ "$CLEAN" == "TRUE" ]; then - echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_RESET}" + echo -e "${ANSI_YELLOW}Cleaning up directory ...${ANSI_RESET}" rm *.o 2> /dev/null + rm *.cf 2> /dev/null fi # Library osvvm # ============================================================================== # compile osvvm packages -if [ "$STOPCOMPILING" == "FALSE" ]; then +if [ "$COMPILE_OSVVM" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'osvvm' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) GHDL_PARAMS+=(--std=08) Files=( - $SourceDir/NamePkg.vhd - $SourceDir/OsvvmGlobalPkg.vhd - $SourceDir/TextUtilPkg.vhd - $SourceDir/TranscriptPkg.vhd - $SourceDir/AlertLogPkg.vhd - $SourceDir/MemoryPkg.vhd - $SourceDir/MessagePkg.vhd - $SourceDir/SortListPkg_int.vhd - $SourceDir/RandomBasePkg.vhd - $SourceDir/RandomPkg.vhd - $SourceDir/CoveragePkg.vhd - $SourceDir/OsvvmContext.vhd + NamePkg.vhd + OsvvmGlobalPkg.vhd + TextUtilPkg.vhd + TranscriptPkg.vhd + AlertLogPkg.vhd + MemoryPkg.vhd + MessagePkg.vhd + SortListPkg_int.vhd + RandomBasePkg.vhd + RandomPkg.vhd + CoveragePkg.vhd + OsvvmContext.vhd ) + + echo $GHDLBinary + + ERRORCOUNT=0 for File in ${Files[@]}; do FileName=$(basename "$File") if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then echo -e "${ANSI_CYAN}Skipping package '$File'${ANSI_RESET}" else echo -e "${ANSI_CYAN}Analyzing package '$File'${ANSI_RESET}" - ghdl -a ${GHDL_PARAMS[@]} --work=osvvm "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + $GHDLBinary -a ${GHDL_PARAMS[@]} --work=osvvm "$SourceDirectory/$File" 2>&1 | $GRC_COMMAND + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + break + fi fi fi done + + echo "--------------------------------------------------------------------------------" + echo -n "Compiling OSVVM library " + if [ $ERRORCOUNT -gt 0 ]; then + echo -e $COLORED_FAILED + else + echo -e $COLORED_SUCCESSFUL + fi fi - -echo "--------------------------------------------------------------------------------" -echo -n "Compiling OSVVM library " -if [ "$STOPCOMPILING" == "TRUE" ]; then - echo -e $COLORED_FAILED -else - echo -e $COLORED_SUCCESSFUL -fi - -cd $WorkingDir diff --git a/libraries/vendors/compile-vunit.ps1 b/libraries/vendors/compile-vunit.ps1 index 53c104bc5..e2230fded 100644 --- a/libraries/vendors/compile-vunit.ps1 +++ b/libraries/vendors/compile-vunit.ps1 @@ -46,10 +46,12 @@ param( [switch]$All = $true, # Clean up directory before analyzing. - [switch]$Clean = $false, + [switch]$Clean = $false, #Skip warning messages. (Show errors only.) [switch]$SuppressWarnings = $false, + # Halt on errors + [switch]$HaltOnError = $false, # Show the embedded help page(s) [switch]$Help = $false @@ -72,14 +74,11 @@ Import-Module $PSScriptRoot\shared.psm1 $SourceDir = $InstallationDirectory["VUnit"] $DestinationDir = $DestinationDirectory["VUnit"] -if (-not $All) -{ $All = $false } -elseif ($All -eq $true) +if ($All -eq $true) { # nothing to configure } -$StopCompiling = $false - +$ErrorCount = 0 # define global GHDL Options $GlobalOptions = ("-a", "-fexplicit", "-frelaxed-rules", "--mb-comments", "--warn-binding", "--no-vital-checks", "--std=08") @@ -97,60 +96,61 @@ if ($Clean) } # compile vunit_lib library -if (-not $StopCompiling) -{ Write-Host "Compiling library 'vunit_lib' ..." -ForegroundColor Yellow - $Options = $GlobalOptions - $Files = ( - "$SourceDir\vhdl\run\src\stop_api.vhd", - "$SourceDir\vhdl\vhdl\src\lib\std\textio.vhd", - "$SourceDir\vhdl\vhdl\src\lang\lang.vhd", - "$SourceDir\vhdl\com\src\com_types.vhd", - "$SourceDir\vhdl\run\src\stop_body_2008.vhd", - "$SourceDir\vhdl\com\src\com_api.vhd", - "$SourceDir\vhdl\string_ops\src\string_ops.vhd", - "$SourceDir\vhdl\path\src\path.vhd", - "$SourceDir\vhdl\logging\src\log_types.vhd", - "$SourceDir\vhdl\logging\src\log_formatting.vhd", - "$SourceDir\vhdl\logging\src\log_special_types200x.vhd", - "$SourceDir\vhdl\array\src\array_pkg.vhd", - "$SourceDir\vhdl\logging\src\log_base_api.vhd", - "$SourceDir\vhdl\logging\src\log_base.vhd", - "$SourceDir\vhdl\logging\src\log_api.vhd", - "$SourceDir\vhdl\logging\src\log.vhd", - "$SourceDir\vhdl\check\src\check_types.vhd", - "$SourceDir\vhdl\check\src\check_special_types200x.vhd", - "$SourceDir\vhdl\check\src\check_base_api.vhd", - "$SourceDir\vhdl\check\src\check_base.vhd", - "$SourceDir\vhdl\check\src\check_api.vhd", - "$SourceDir\vhdl\check\src\check.vhd", - "$SourceDir\vhdl\dictionary\src\dictionary.vhd", - "$SourceDir\vhdl\run\src\run_types.vhd", - "$SourceDir\vhdl\run\src\run_special_types200x.vhd", - "$SourceDir\vhdl\run\src\run_base_api.vhd", - "$SourceDir\vhdl\run\src\run_base.vhd", - "$SourceDir\vhdl\run\src\run_api.vhd", - "$SourceDir\vhdl\run\src\run.vhd", - "$SourceDir\vhdl\vunit_run_context.vhd", - "$SourceDir\vhdl\vunit_context.vhd", - "$SourceDir\vhdl\com\src\com_std_codec_builder.vhd", - "$SourceDir\vhdl\com\src\com_debug_codec_builder.vhd", - "$SourceDir\vhdl\com\src\com_string.vhd", - "$SourceDir\vhdl\com\src\com_codec_api.vhd", - "$SourceDir\vhdl\com\src\com_codec.vhd", - "$SourceDir\vhdl\com\src\com.vhd", - "$SourceDir\vhdl\com\src\com_context.vhd") - foreach ($File in $Files) - { Write-Host "Analyzing package '$File'" -ForegroundColor Cyan - $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=vunit_lib " + $File + " 2>&1" - $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } +Write-Host "Compiling library 'vunit_lib' ..." -ForegroundColor Yellow +$Options = $GlobalOptions +$Files = ( + "$SourceDir\vunit\vhdl\run\src\stop_api.vhd", + "$SourceDir\vunit\vhdl\vhdl\src\lib\std\textio.vhd", + "$SourceDir\vunit\vhdl\vhdl\src\lang\lang.vhd", + "$SourceDir\vunit\vhdl\com\src\com_types.vhd", + "$SourceDir\vunit\vhdl\run\src\stop_body_2008.vhd", + "$SourceDir\vunit\vhdl\com\src\com_api.vhd", + "$SourceDir\vunit\vhdl\string_ops\src\string_ops.vhd", + "$SourceDir\vunit\vhdl\path\src\path.vhd", + "$SourceDir\vunit\vhdl\logging\src\log_types.vhd", + "$SourceDir\vunit\vhdl\logging\src\log_formatting.vhd", + "$SourceDir\vunit\vhdl\logging\src\log_special_types200x.vhd", + "$SourceDir\vunit\vhdl\array\src\array_pkg.vhd", + "$SourceDir\vunit\vhdl\logging\src\log_base_api.vhd", + "$SourceDir\vunit\vhdl\logging\src\log_base.vhd", + "$SourceDir\vunit\vhdl\logging\src\log_api.vhd", + "$SourceDir\vunit\vhdl\logging\src\log.vhd", + "$SourceDir\vunit\vhdl\check\src\check_types.vhd", + "$SourceDir\vunit\vhdl\check\src\check_special_types200x.vhd", + "$SourceDir\vunit\vhdl\check\src\check_base_api.vhd", + "$SourceDir\vunit\vhdl\check\src\check_base.vhd", + "$SourceDir\vunit\vhdl\check\src\check_api.vhd", + "$SourceDir\vunit\vhdl\check\src\check.vhd", + "$SourceDir\vunit\vhdl\dictionary\src\dictionary.vhd", + "$SourceDir\vunit\vhdl\run\src\run_types.vhd", + "$SourceDir\vunit\vhdl\run\src\run_special_types200x.vhd", + "$SourceDir\vunit\vhdl\run\src\run_base_api.vhd", + "$SourceDir\vunit\vhdl\run\src\run_base.vhd", + "$SourceDir\vunit\vhdl\run\src\run_api.vhd", + "$SourceDir\vunit\vhdl\run\src\run.vhd", + "$SourceDir\vunit\vhdl\vunit_run_context.vhd", + "$SourceDir\vunit\vhdl\vunit_context.vhd", + "$SourceDir\vunit\vhdl\com\src\com_std_codec_builder.vhd", + "$SourceDir\vunit\vhdl\com\src\com_debug_codec_builder.vhd", + "$SourceDir\vunit\vhdl\com\src\com_string.vhd", + "$SourceDir\vunit\vhdl\com\src\com_codec_api.vhd", + "$SourceDir\vunit\vhdl\com\src\com_codec.vhd", + "$SourceDir\vunit\vhdl\com\src\com.vhd", + "$SourceDir\vunit\vhdl\com\src\com_context.vhd") +foreach ($File in $Files) +{ Write-Host "Analyzing package '$File'" -ForegroundColor Cyan + $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=vunit_lib " + $File + " 2>&1" + $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { break } } } Write-Host "--------------------------------------------------------------------------------" Write-Host "Compiling VUnit library " -NoNewline -if ($StopCompiling) +if ($ErrorCount -gt 0) { Write-Host "[FAILED]" -ForegroundColor Red } else { Write-Host "[SUCCESSFUL]" -ForegroundColor Green } diff --git a/libraries/vendors/compile-vunit.sh b/libraries/vendors/compile-vunit.sh index f77961be2..0cecf3685 100755 --- a/libraries/vendors/compile-vunit.sh +++ b/libraries/vendors/compile-vunit.sh @@ -118,18 +118,14 @@ elif [ "$HELP" == "TRUE" ]; then fi if [ "$ALL" == "TRUE" ]; then - UNISIM=TRUE - UNIMACRO=TRUE - SIMPRIM=TRUE - SECUREIP=TRUE + COMPILE_VUNIT=TRUE fi # extract data from configuration -InstallDir=${InstallationDirectory[VUnit]} -SourceDir="$InstallDir" +SourceDir=${SourceDirectory[VUnit]} DestinationDir=${DestinationDirectory[VUnit]} -if [ -z $InstallDir ] || [ -z $DestinationDir ]; then +if [ -z $DestinationDir ]; then echo -e "${COLORED_ERROR} VUnit is not configured in '$ScriptDir/config.sh'${ANSI_RESET}" exit -1 elif [ ! -d $SourceDir ]; then @@ -163,7 +159,7 @@ else fi fi -STOPCOMPILING=FALSE +ERRORCOUNT=0 # Cleanup directory # ============================================================================== @@ -175,68 +171,68 @@ fi # Library vunit_lib # ============================================================================== # compile vunit packages -if [ "$STOPCOMPILING" == "FALSE" ]; then - echo -e "${ANSI_YELLOW}Compiling library 'vunit_lib' ...${ANSI_RESET}" - GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--std=08) - Files=( - $SourceDir/vhdl/run/src/stop_api.vhd - $SourceDir/vhdl/vhdl/src/lib/std/textio.vhd - $SourceDir/vhdl/vhdl/src/lang/lang.vhd - $SourceDir/vhdl/com/src/com_types.vhd - $SourceDir/vhdl/run/src/stop_body_2008.vhd - $SourceDir/vhdl/com/src/com_api.vhd - $SourceDir/vhdl/string_ops/src/string_ops.vhd - $SourceDir/vhdl/path/src/path.vhd - $SourceDir/vhdl/logging/src/log_types.vhd - $SourceDir/vhdl/logging/src/log_formatting.vhd - $SourceDir/vhdl/logging/src/log_special_types200x.vhd - $SourceDir/vhdl/array/src/array_pkg.vhd - $SourceDir/vhdl/logging/src/log_base_api.vhd - $SourceDir/vhdl/logging/src/log_base.vhd - $SourceDir/vhdl/logging/src/log_api.vhd - $SourceDir/vhdl/logging/src/log.vhd - $SourceDir/vhdl/check/src/check_types.vhd - $SourceDir/vhdl/check/src/check_special_types200x.vhd - $SourceDir/vhdl/check/src/check_base_api.vhd - $SourceDir/vhdl/check/src/check_base.vhd - $SourceDir/vhdl/check/src/check_api.vhd - $SourceDir/vhdl/check/src/check.vhd - $SourceDir/vhdl/dictionary/src/dictionary.vhd - $SourceDir/vhdl/run/src/run_types.vhd - $SourceDir/vhdl/run/src/run_special_types200x.vhd - $SourceDir/vhdl/run/src/run_base_api.vhd - $SourceDir/vhdl/run/src/run_base.vhd - $SourceDir/vhdl/run/src/run_api.vhd - $SourceDir/vhdl/run/src/run.vhd - $SourceDir/vhdl/vunit_run_context.vhd - $SourceDir/vhdl/vunit_context.vhd - $SourceDir/vhdl/com/src/com_std_codec_builder.vhd - $SourceDir/vhdl/com/src/com_debug_codec_builder.vhd - $SourceDir/vhdl/com/src/com_string.vhd - $SourceDir/vhdl/com/src/com_codec_api.vhd - $SourceDir/vhdl/com/src/com_codec.vhd - $SourceDir/vhdl/com/src/com.vhd - $SourceDir/vhdl/com/src/com_context.vhd - ) - for File in ${Files[@]}; do - FileName=$(basename "$File") - if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then - echo -e "${ANSI_CYAN}Skipping package '$File'${ANSI_RESET}" - else - echo -e "${ANSI_CYAN}Analyzing package '$File'${ANSI_RESET}" - ghdl -a ${GHDL_PARAMS[@]} --work=vunit_lib "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE +echo -e "${ANSI_YELLOW}Compiling library 'vunit_lib' ...${ANSI_RESET}" +GHDL_PARAMS=(${GHDL_OPTIONS[@]}) +GHDL_PARAMS+=(--std=08) +Files=( + $SourceDir/run/src/stop_api.vhd + $SourceDir/vhdl/src/lib/std/textio.vhd + $SourceDir/vhdl/src/lang/lang.vhd + $SourceDir/com/src/com_types.vhd + $SourceDir/run/src/stop_body_2008.vhd + $SourceDir/com/src/com_api.vhd + $SourceDir/string_ops/src/string_ops.vhd + $SourceDir/path/src/path.vhd + $SourceDir/logging/src/log_types.vhd + $SourceDir/logging/src/log_formatting.vhd + $SourceDir/logging/src/log_special_types200x.vhd + $SourceDir/array/src/array_pkg.vhd + $SourceDir/logging/src/log_base_api.vhd + $SourceDir/logging/src/log_base.vhd + $SourceDir/logging/src/log_api.vhd + $SourceDir/logging/src/log.vhd + $SourceDir/check/src/check_types.vhd + $SourceDir/check/src/check_special_types200x.vhd + $SourceDir/check/src/check_base_api.vhd + $SourceDir/check/src/check_base.vhd + $SourceDir/check/src/check_api.vhd + $SourceDir/check/src/check.vhd + $SourceDir/dictionary/src/dictionary.vhd + $SourceDir/run/src/run_types.vhd + $SourceDir/run/src/run_special_types200x.vhd + $SourceDir/run/src/run_base_api.vhd + $SourceDir/run/src/run_base.vhd + $SourceDir/run/src/run_api.vhd + $SourceDir/run/src/run.vhd + $SourceDir/vunit_run_context.vhd + $SourceDir/vunit_context.vhd + $SourceDir/com/src/com_std_codec_builder.vhd + $SourceDir/com/src/com_debug_codec_builder.vhd + $SourceDir/com/src/com_string.vhd + $SourceDir/com/src/com_codec_api.vhd + $SourceDir/com/src/com_codec.vhd + $SourceDir/com/src/com.vhd + $SourceDir/com/src/com_context.vhd +) +for File in ${Files[@]}; do + FileName=$(basename "$File") + if [ "$SKIP_EXISTING_FILES" == "TRUE" ] && [ -e "${FileName%.*}.o" ]; then + echo -e "${ANSI_CYAN}Skipping package '$File'${ANSI_RESET}" + else + echo -e "${ANSI_CYAN}Analyzing package '$File'${ANSI_RESET}" + ghdl -a ${GHDL_PARAMS[@]} --work=vunit_lib "$File" 2>&1 | $GRC_COMMAND + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then break fi fi - done -fi + fi +done echo "--------------------------------------------------------------------------------" echo -n "Compiling VUnit library " -if [ "$STOPCOMPILING" == "TRUE" ]; then +if [ $ERRORCOUNT -gt 0 ]; then echo -e $COLORED_FAILED else echo -e $COLORED_SUCCESSFUL diff --git a/libraries/vendors/compile-xilinx-ise.ps1 b/libraries/vendors/compile-xilinx-ise.ps1 index 7557a5129..610210f6c 100644 --- a/libraries/vendors/compile-xilinx-ise.ps1 +++ b/libraries/vendors/compile-xilinx-ise.ps1 @@ -47,25 +47,32 @@ [CmdletBinding()] param( # Compile all libraries and packages. - [switch]$All = $null, + [switch]$All = $false, # Compile the Xilinx simulation library. - [switch]$Unisim = $false, + [switch]$Unisim = $false, # Compile the Xilinx macro library. - [switch]$Unimacro = $false, + [switch]$Unimacro = $false, # Compile the Xilinx post-map simulation library. - [switch]$Simprim = $false, + [switch]$Simprim = $false, # Compile the Xilinx secureip library. - [switch]$SecureIP = $false, + [switch]$SecureIP = $false, + + # Set VHDL Standard to '93 + [switch]$VHDL93 = $false, + # Set VHDL Standard to '08 + [switch]$VHDL2008 = $false, # Clean up directory before analyzing. - [switch]$Clean = $false, + [switch]$Clean = $false, # Skip warning messages. (Show errors only.) [switch]$SuppressWarnings = $false, + # Halt on errors + [switch]$HaltOnError = $false, # Show the embedded help page(s) [switch]$Help = $false @@ -96,8 +103,27 @@ elseif ($All -eq $true) $Unimacro = $true $SecureIP = $true } -$StopCompiling = $false +if ($VHDL93 -eq $true) +{ $VHDLStandard = "93c" + $VHDLFlavor = "synopsys" + $DestinationDir += ".v93" +} +elseif ($VHDL2008 -eq $true) +{ $VHDLStandard = "08" + $VHDLFlavor = "standard" + $DestinationDir += ".v08" + Write-Host "Not all Xilinx primitives are VHDL-2008 compatible! Setting HaltOnError to FALSE." -ForegroundColor Red + $HaltOnError = $false +} +else +{ $VHDLStandard = "93c" + $VHDLFlavor = "synopsys" + $DestinationDir += ".v93" +} + +$StopCompiling = $false +$ErrorCount = 0 # define global GHDL Options $GlobalOptions = ("-a", "-fexplicit", "-frelaxed-rules", "--no-vital-checks", "--warn-binding", "--mb-comments") @@ -120,8 +146,8 @@ if ($Clean) if ((-not $StopCompiling) -and $Unisim) { Write-Host "Compiling library 'unisim' ..." -ForegroundColor Yellow $Options = $GlobalOptions - $Options += "--ieee=synopsys" - $Options += "--std=93c" + $Options += "--ieee=$VHDLFlavor" + $Options += "--std=$VHDLStandard" $Files = ( "$SourceDir\unisims\unisim_VPKG.vhd", "$SourceDir\unisims\unisim_VCOMP.vhd") @@ -129,23 +155,33 @@ if ((-not $StopCompiling) -and $Unisim) { Write-Host "Analyzing package '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=unisim " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } # compile unisim primitives if ((-not $StopCompiling) -and $Unisim) { $Options = $GlobalOptions - $Options += "--ieee=synopsys" - $Options += "--std=93c" + $Options += "--ieee=$VHDLFlavor" + $Options += "--std=$VHDLStandard" $Files = dir "$SourceDir\unisims\primitive\*.vhd*" foreach ($File in $Files) { Write-Host "Analyzing primitive '$($File.FullName)'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=unisim " + $File.FullName + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -153,15 +189,20 @@ if ((-not $StopCompiling) -and $Unisim) if ((-not $StopCompiling) -and $Unisim -and $SecureIP) { Write-Host "Compiling library secureip primitives ..." -ForegroundColor Yellow $Options = $GlobalOptions - $Options += "--ieee=synopsys" - $Options += "--std=93c" + $Options += "--ieee=$VHDLFlavor" + $Options += "--std=$VHDLStandard" $Files = dir "$SourceDir\unisims\secureip\*.vhd*" foreach ($File in $Files) { Write-Host "Analyzing primitive '$($File.FullName)'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=secureip " + $File.FullName + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - #if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + # break + } + } } } @@ -171,31 +212,41 @@ if ((-not $StopCompiling) -and $Unisim -and $SecureIP) if ((-not $StopCompiling) -and $Unimacro) { Write-Host "Compiling library 'unimacro' ..." -ForegroundColor Yellow $Options = $GlobalOptions - $Options += "--ieee=synopsys" - $Options += "--std=93c" + $Options += "--ieee=$VHDLFlavor" + $Options += "--std=$VHDLStandard" $Files = @( "$SourceDir\unimacro\unimacro_VCOMP.vhd") foreach ($File in $Files) { Write-Host "Analyzing package '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=unimacro " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } # compile unimacro macros if ((-not $StopCompiling) -and $Unimacro) { $Options = $GlobalOptions - $Options += "--ieee=synopsys" - $Options += "--std=93c" + $Options += "--ieee=$VHDLFlavor" + $Options += "--std=$VHDLStandard" $Files = dir "$SourceDir\unimacro\*_MACRO.vhd*" foreach ($File in $Files) { Write-Host "Analyzing primitive '$($File.FullName)'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=unimacro " + $File.FullName + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -205,8 +256,8 @@ if ((-not $StopCompiling) -and $Unimacro) if ((-not $StopCompiling) -and $Simprim) { Write-Host "Compiling library 'simprim' ..." -ForegroundColor Yellow $Options = $GlobalOptions - $Options += "--ieee=synopsys" - $Options += "--std=93c" + $Options += "--ieee=$VHDLFlavor" + $Options += "--std=$VHDLStandard" $Files = ( "$SourceDir\simprims\simprim_Vpackage.vhd", "$SourceDir\simprims\simprim_Vcomponents.vhd") @@ -214,8 +265,13 @@ if ((-not $StopCompiling) -and $Simprim) { Write-Host "Analyzing package '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=simprim " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -223,15 +279,20 @@ if ((-not $StopCompiling) -and $Simprim) if ((-not $StopCompiling) -and $Simprim) { Write-Host "Compiling library 'simprim' ..." -ForegroundColor Yellow $Options = $GlobalOptions - $Options += "--ieee=synopsys" - $Options += "--std=93c" + $Options += "--ieee=$VHDLFlavor" + $Options += "--std=$VHDLStandard" $Files = dir "$SourceDir\simprims\primitive\other\*.vhd*" foreach ($File in $Files) { Write-Host "Analyzing primitive '$($File.FullName)'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=simprim " + $File.FullName + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - #if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + # break + } + } } } @@ -239,21 +300,26 @@ if ((-not $StopCompiling) -and $Simprim) if ((-not $StopCompiling) -and $Simprim -and $SecureIP) { Write-Host "Compiling secureip primitives ..." -ForegroundColor Yellow $Options = $GlobalOptions - $Options += "--ieee=synopsys" - $Options += "--std=93c" + $Options += "--ieee=$VHDLFlavor" + $Options += "--std=$VHDLStandard" $Files = dir "$SourceDir\simprims\secureip\other\*.vhd*" foreach ($File in $Files) { Write-Host "Analyzing primitive '$($File.FullName)'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=simprim " + $File.FullName + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - #if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + # break + } + } } } Write-Host "--------------------------------------------------------------------------------" Write-Host "Compiling Xilinx ISE libraries " -NoNewline -if ($StopCompiling) +if ($ErrorCount -gt 0) { Write-Host "[FAILED]" -ForegroundColor Red } else { Write-Host "[SUCCESSFUL]" -ForegroundColor Green } diff --git a/libraries/vendors/compile-xilinx-ise.sh b/libraries/vendors/compile-xilinx-ise.sh index b3675289c..ffbfd96d2 100755 --- a/libraries/vendors/compile-xilinx-ise.sh +++ b/libraries/vendors/compile-xilinx-ise.sh @@ -92,6 +92,12 @@ while [[ $# > 0 ]]; do --secureip) SECUREIP=TRUE ;; + --vhdl93) + VHDL93=TRUE + ;; + --vhdl2008) + VHDL2008=TRUE + ;; *) # unknown option UNKNOWN_OPTION=TRUE ;; @@ -130,6 +136,8 @@ elif [ "$HELP" == "TRUE" ]; then echo " --secureip Compile the secureip 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 entities like DSP and PCIe primitives." echo " -H --halt-on-error Halt on error(s)." @@ -148,12 +156,24 @@ if [ "$ALL" == "TRUE" ]; then SECUREIP=TRUE fi +if [ "$VHDL93" == "TRUE" ]; then + VHDLStandard="93c" + VHDLFlavor="synopsys" +elif [ "$VHDL2008" == "TRUE" ]; then + VHDLStandard="08" + VHDLFlavor="standard" + echo -e "${ANSI_RED}Not all Xilinx primitives are VHDL-2008 compatible! Setting HALT_ON_ERROR to FALSE.${ANSI_RESET}" + HALT_ON_ERROR=FALSE +else + VHDLStandard="93c" + VHDLFlavor="synopsys" +fi + # extract data from configuration -InstallDir=${InstallationDirectory[XilinxISE]} -SourceDir="$InstallDir/ISE_DS/ISE/vhdl/src" +SourceDir=${SourceDirectory[XilinxISE]} DestinationDir=${DestinationDirectory[XilinxISE]} -if [ -z $InstallDir ] || [ -z $DestinationDir ]; then +if [ -z $DestinationDir ]; then echo -e "${COLORED_ERROR} Xilinx ISE is not configured in '$ScriptDir/config.sh'${ANSI_RESET}" exit -1 elif [ ! -d $SourceDir ]; then @@ -188,6 +208,7 @@ else fi STOPCOMPILING=FALSE +ERRORCOUNT=0 # Cleanup directory # ============================================================================== @@ -202,7 +223,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'unisim' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/unisims/unisim_VPKG.vhd $SourceDir/unisims/unisim_VCOMP.vhd @@ -214,9 +235,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing package '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=unisim "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -225,7 +249,7 @@ fi # compile unisim primitives if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ]; then GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files="$(LC_COLLATE=C ls $SourceDir/unisims/primitive/*.vhd)" for File in $Files; do FileName=$(basename "$File") @@ -238,9 +262,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing primitive '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=unisim "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -250,7 +277,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ] && [ "$SECUREIP" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library secureip primitives${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files="$(LC_COLLATE=C ls $SourceDir/unisims/secureip/*.vhd)" for File in $Files; do FileName=$(basename "$File") @@ -263,9 +290,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ] && [ "$SECUREIP" = else echo -e "${ANSI_CYAN}Analyzing primitive '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=secureip "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -277,7 +307,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNIMACRO" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'unimacro' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/unimacro/unimacro_VCOMP.vhd ) @@ -288,9 +318,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNIMACRO" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing package '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=unimacro "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -299,7 +332,7 @@ fi # compile unimacro macros if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNIMACRO" == "TRUE" ]; then GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files="$(LC_COLLATE=C ls $SourceDir/unimacro/*_MACRO.vhd)" for File in $Files; do FileName=$(basename "$File") @@ -308,9 +341,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNIMACRO" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing primitive '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=unimacro "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -322,7 +358,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$SIMPRIM" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'simprim' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/simprims/simprim_Vpackage.vhd $SourceDir/simprims/simprim_Vcomponents.vhd @@ -334,9 +370,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$SIMPRIM" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing package '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=simprim "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -345,7 +384,7 @@ fi # compile simprim primitives if [ "$STOPCOMPILING" == "FALSE" ] && [ "$SIMPRIM" == "TRUE" ]; then GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files="$(LC_COLLATE=C ls $SourceDir/simprims/primitive/other/*.vhd)" for File in $Files; do FileName=$(basename "$File") @@ -358,9 +397,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$SIMPRIM" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing primitive '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=simprim "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -369,7 +411,7 @@ fi # compile simprim secureip primitives if [ "$STOPCOMPILING" == "FALSE" ] && [ "$SIMPRIM" == "TRUE" ] && [ "$SECUREIP" == "TRUE" ]; then GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files="$(LC_COLLATE=C ls $SourceDir/simprims/secureip/other/*.vhd)" for File in $Files; do FileName=$(basename "$File") @@ -382,9 +424,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$SIMPRIM" == "TRUE" ] && [ "$SECUREIP" else echo -e "${ANSI_CYAN}Analyzing primitive '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=simprim "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -392,7 +437,7 @@ fi echo "--------------------------------------------------------------------------------" echo -n "Compiling Xilinx ISE libraries " -if [ "$STOPCOMPILING" == "TRUE" ]; then +if [ $ERRORCOUNT -gt 0 ]; then echo -e $COLORED_FAILED else echo -e $COLORED_SUCCESSFUL diff --git a/libraries/vendors/compile-xilinx-vivado.ps1 b/libraries/vendors/compile-xilinx-vivado.ps1 index 8e46825a8..8628b278f 100644 --- a/libraries/vendors/compile-xilinx-vivado.ps1 +++ b/libraries/vendors/compile-xilinx-vivado.ps1 @@ -46,22 +46,29 @@ [CmdletBinding()] param( # Compile all libraries and packages. - [switch]$All = $null, + [switch]$All = $false, # Compile the Xilinx simulation library. - [switch]$Unisim = $false, + [switch]$Unisim = $false, # Compile the Xilinx macro library. - [switch]$Unimacro = $false, + [switch]$Unimacro = $false, # Compile the Xilinx secureip library. - [switch]$SecureIP = $false, + [switch]$SecureIP = $false, + + # Set VHDL Standard to '93 + [switch]$VHDL93 = $false, + # Set VHDL Standard to '08 + [switch]$VHDL2008 = $false, # Clean up directory before analyzing. - [switch]$Clean = $false, + [switch]$Clean = $false, # Skip warning messages. (Show errors only.) [switch]$SuppressWarnings = $false, + # Halt on errors + [switch]$HaltOnError = $false, # Show the embedded help page(s) [switch]$Help = $false @@ -84,16 +91,33 @@ Import-Module $PSScriptRoot\shared.psm1 $SourceDir = $InstallationDirectory["XilinxVivado"] + "\data\vhdl\src" $DestinationDir = $DestinationDirectory["XilinxVivado"] -if (-not $All) -{ $All = $false } -elseif ($All -eq $true) +if ($All -eq $true) { $Unisim = $true $Simprim = $true $Unimacro = $true $SecureIP = $true } -$StopCompiling = $false +if ($VHDL93 -eq $true) +{ $VHDLStandard = "93c" + $VHDLFlavor = "synopsys" + $DestinationDir += ".v93" +} +elseif ($VHDL2008 -eq $true) +{ $VHDLStandard = "08" + $VHDLFlavor = "standard" + $DestinationDir += ".v08" + Write-Host "Not all Xilinx primitives are VHDL-2008 compatible! Setting HaltOnError to FALSE." -ForegroundColor Red + $HaltOnError = $false +} +else +{ $VHDLStandard = "93c" + $VHDLFlavor = "synopsys" + $DestinationDir += ".v93" +} + +$StopCompiling = $false +$ErrorCount = 0 # define global GHDL Options $GlobalOptions = ("-a", "-fexplicit", "-frelaxed-rules", "--warn-binding", "--mb-comments") @@ -117,8 +141,8 @@ if ((-not $StopCompiling) -and $Unisim) { Write-Host "Compiling library 'unisim' ..." -ForegroundColor Yellow $Options = $GlobalOptions $Options += "--no-vital-checks" - $Options += "--ieee=synopsys" - $Options += "--std=93c" + $Options += "--ieee=$VHDLFlavor" + $Options += "--std=$VHDLStandard" $Files = ( "$SourceDir\unisims\unisim_VPKG.vhd", "$SourceDir\unisims\unisim_VCOMP.vhd", @@ -128,8 +152,13 @@ if ((-not $StopCompiling) -and $Unisim) { Write-Host "Analyzing package '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=unisim " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -137,15 +166,20 @@ if ((-not $StopCompiling) -and $Unisim) if ((-not $StopCompiling) -and $Unisim) { $Options = $GlobalOptions $Options += "--no-vital-checks" - $Options += "--ieee=synopsys" - $Options += "--std=93c" + $Options += "--ieee=$VHDLFlavor" + $Options += "--std=$VHDLStandard" $Files = dir "$SourceDir\unisims\primitive\*.vhd*" foreach ($File in $Files) { Write-Host "Analyzing primitive '$($File.FullName)'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=unisim " + $File.FullName + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -153,15 +187,20 @@ if ((-not $StopCompiling) -and $Unisim) if ((-not $StopCompiling) -and $Unisim) { $Options = $GlobalOptions $Options += "--no-vital-checks" - $Options += "--ieee=synopsys" - $Options += "--std=93c" + $Options += "--ieee=$VHDLFlavor" + $Options += "--std=$VHDLStandard" $Files = dir "$SourceDir\unisims\retarget\*.vhd*" foreach ($File in $Files) { Write-Host "Analyzing retarget primitive '$($File.FullName)'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=unisim " + $File.FullName + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - #if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + # break + } + } } } @@ -169,15 +208,20 @@ if ((-not $StopCompiling) -and $Unisim) if ((-not $StopCompiling) -and $Unisim -and $SecureIP) { Write-Host "Compiling library secureip primitives ..." -ForegroundColor Yellow $Options = $GlobalOptions - $Options += "--ieee=synopsys" - $Options += "--std=93c" + $Options += "--ieee=$VHDLFlavor" + $Options += "--std=$VHDLStandard" $Files = dir "$SourceDir\unisims\secureip\*.vhd*" foreach ($File in $Files) { Write-Host "Analyzing primitive '$($File.FullName)'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=secureip " + $File.FullName + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -188,16 +232,21 @@ if ((-not $StopCompiling) -and $Unimacro) { Write-Host "Compiling library 'unimacro' ..." -ForegroundColor Yellow $Options = $GlobalOptions $Options += "--no-vital-checks" - $Options += "--ieee=synopsys" - $Options += "--std=93c" + $Options += "--ieee=$VHDLFlavor" + $Options += "--std=$VHDLStandard" $Files = @( "$SourceDir\unimacro\unimacro_VCOMP.vhd") foreach ($File in $Files) { Write-Host "Analyzing package '$File'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=unimacro " + $File + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + break + } + } } } @@ -205,15 +254,20 @@ if ((-not $StopCompiling) -and $Unimacro) if ((-not $StopCompiling) -and $Unimacro) { $Options = $GlobalOptions $Options += "--no-vital-checks" - $Options += "--ieee=synopsys" - $Options += "--std=93c" + $Options += "--ieee=$VHDLFlavor" + $Options += "--std=$VHDLStandard" $Files = dir "$SourceDir\unimacro\*_MACRO.vhd*" foreach ($File in $Files) { Write-Host "Analyzing primitive '$($File.FullName)'" -ForegroundColor Cyan $InvokeExpr = "ghdl.exe " + ($Options -join " ") + " --work=unimacro " + $File.FullName + " 2>&1" $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings - $StopCompiling = ($LastExitCode -ne 0) - #if ($StopCompiling) { break } + if ($LastExitCode -ne 0) + { $ErrorCount += 1 + if ($HaltOnError) + { $StopCompiling = $true + # break + } + } } } @@ -223,7 +277,7 @@ if ((-not $StopCompiling) -and $Unimacro) Write-Host "--------------------------------------------------------------------------------" Write-Host "Compiling Xilinx Vivado libraries " -NoNewline -if ($StopCompiling) +if ($ErrorCount -gt 0) { Write-Host "[FAILED]" -ForegroundColor Red } else { Write-Host "[SUCCESSFUL]" -ForegroundColor Green } diff --git a/libraries/vendors/compile-xilinx-vivado.sh b/libraries/vendors/compile-xilinx-vivado.sh index b47a66a08..3bc06b037 100755 --- a/libraries/vendors/compile-xilinx-vivado.sh +++ b/libraries/vendors/compile-xilinx-vivado.sh @@ -88,6 +88,12 @@ while [[ $# > 0 ]]; do --secureip) SECUREIP=TRUE ;; + --vhdl93) + VHDL93=TRUE + ;; + --vhdl2008) + VHDL2008=TRUE + ;; *) # unknown option UNKNOWN_OPTION=TRUE ;; @@ -125,6 +131,8 @@ elif [ "$HELP" == "TRUE" ]; then echo " --secureip Compile the secureip 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 entities like DSP and PCIe primitives." echo " -H --halt-on-error Halt on error(s)." @@ -142,12 +150,24 @@ if [ "$ALL" == "TRUE" ]; then SECUREIP=TRUE fi +if [ "$VHDL93" == "TRUE" ]; then + VHDLStandard="93c" + VHDLFlavor="synopsys" +elif [ "$VHDL2008" == "TRUE" ]; then + VHDLStandard="08" + VHDLFlavor="standard" + echo -e "${ANSI_RED}Not all Xilinx primitives are VHDL-2008 compatible! Setting HALT_ON_ERROR to FALSE.${ANSI_RESET}" + HALT_ON_ERROR=FALSE +else + VHDLStandard="93c" + VHDLFlavor="synopsys" +fi + # extract data from configuration -InstallDir=${InstallationDirectory[XilinxVivado]} -SourceDir="$InstallDir/data/vhdl/src" +SourceDir=${SourceDirectory[XilinxVivado]} DestinationDir=${DestinationDirectory[XilinxVivado]} -if [ -z $InstallDir ] || [ -z $DestinationDir ]; then +if [ -z $DestinationDir ]; then echo -e "${COLORED_ERROR} Xilinx Vivado is not configured in '$ScriptDir/config.sh'${ANSI_RESET}" exit -1 elif [ ! -d $SourceDir ]; then @@ -182,6 +202,7 @@ else fi STOPCOMPILING=FALSE +ERRORCOUNT=0 # Cleanup directory # ============================================================================== @@ -196,7 +217,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'unisim' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/unisims/unisim_VPKG.vhd $SourceDir/unisims/unisim_VCOMP.vhd @@ -211,9 +232,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing package '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=unisim "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -222,7 +246,7 @@ fi # compile unisim primitives if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ]; then GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files="$(LC_COLLATE=C ls $SourceDir/unisims/primitive/*.vhd)" for File in $Files; do FileName=$(basename "$File") @@ -235,9 +259,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing primitive '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=unisim "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -246,7 +273,7 @@ fi # compile unisim retarget primitives if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ]; then GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files="$(LC_COLLATE=C ls $SourceDir/unisims/retarget/*.vhd)" for File in $Files; do FileName=$(basename "$File") @@ -259,9 +286,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing primitive '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=unisim "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -271,7 +301,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ] && [ "$SECUREIP" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library secureip primitives${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files="$(LC_COLLATE=C ls $SourceDir/unisims/secureip/*.vhd)" for File in $Files; do FileName=$(basename "$File") @@ -284,9 +314,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNISIM" == "TRUE" ] && [ "$SECUREIP" = else echo -e "${ANSI_CYAN}Analyzing primitive '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=secureip "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -298,7 +331,7 @@ fi if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNIMACRO" == "TRUE" ]; then echo -e "${ANSI_YELLOW}Compiling library 'unimacro' ...${ANSI_RESET}" GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files=( $SourceDir/unimacro/unimacro_VCOMP.vhd ) @@ -309,9 +342,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNIMACRO" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing package '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=unimacro "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -320,7 +356,7 @@ fi # compile unimacro macros if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNIMACRO" == "TRUE" ]; then GHDL_PARAMS=(${GHDL_OPTIONS[@]}) - GHDL_PARAMS+=(--ieee=synopsys --std=93c) + GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard) Files="$(LC_COLLATE=C ls $SourceDir/unimacro/*_MACRO.vhd)" for File in $Files; do FileName=$(basename "$File") @@ -329,9 +365,12 @@ if [ "$STOPCOMPILING" == "FALSE" ] && [ "$UNIMACRO" == "TRUE" ]; then else echo -e "${ANSI_CYAN}Analyzing macro '$File'${ANSI_RESET}" ghdl -a ${GHDL_PARAMS[@]} --work=unimacro "$File" 2>&1 | $GRC_COMMAND - if [ $? -ne 0 ] && [ "$HALT_ON_ERROR" == "TRUE" ]; then - STOPCOMPILING=TRUE - break + if [ $? -ne 0 ]; then + let ERRORCOUNT++ + if [ "$HALT_ON_ERROR" == "TRUE" ]; then + STOPCOMPILING=TRUE + break + fi fi fi done @@ -343,7 +382,7 @@ fi echo "--------------------------------------------------------------------------------" echo -n "Compiling Xilinx Vivado libraries " -if [ "$STOPCOMPILING" == "TRUE" ]; then +if [ $ERRORCOUNT -gt 0 ]; then echo -e $COLORED_FAILED else echo -e $COLORED_SUCCESSFUL diff --git a/libraries/vendors/config.psm1 b/libraries/vendors/config.psm1 index 85fd100fa..3c228f3b1 100644 --- a/libraries/vendors/config.psm1 +++ b/libraries/vendors/config.psm1 @@ -34,17 +34,17 @@ # Configure your tools here. Use absolute paths, without trailing directory # delimiter. Empty strings indicate not installed tools $InstallationDirectory = @{ - "AlteraQuartusII" = "C:\Altera\15.0"; + "AlteraQuartusII" = "C:\Altera\15.1"; "XilinxISE" = "C:\Xilinx\14.7"; - "XilinxVivado" = "C:\Xilinx\Vivado\2015.3"; + "XilinxVivado" = "C:\Xilinx\Vivado\2016.1"; "OSVVM" = "D:\git\PoC\lib\osvvm"; "VUnit" = "D:\git\PoC\lib\vunit" } $DestinationDirectory = @{ "Altera" = "altera"; - "XilinxISE" = "xilinx"; - "XilinxVivado" = "vivado"; + "XilinxISE" = "xilinx-ise"; + "XilinxVivado" = "xilinx-vivado"; "OSVVM" = "osvvm"; "VUnit" = "vunit" } diff --git a/libraries/vendors/config.sh b/libraries/vendors/config.sh index 6640b4c5b..9395269b4 100644 --- a/libraries/vendors/config.sh +++ b/libraries/vendors/config.sh @@ -4,16 +4,16 @@ # kate: tab-width 2; replace-tabs off; indent-width 2; # # ============================================================================== -# Bash Script: Configurable directories to local installed tools -# # Authors: Patrick Lehmann # +# Bash Script: Configurable directories to local installed tools +# # Description: # ------------------------------------ # This Bash file exports variables containing the users local tool environment. # # ============================================================================== -# Copyright (C) 2015 Patrick Lehmann +# Copyright (C) 2015-2016 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 @@ -31,21 +31,40 @@ # 02111-1307, USA. # ============================================================================== + +# Configure +# - vendor tool chain installation paths or +# - library root directories +# in the following dictionary. +# +# These values are used if no command line argument (--src) is passed to a +# compile script. Empty strings means not configured. declare -A InstallationDirectory -InstallationDirectory[AlteraQuartusII]="/opt/Altera/15.0" +InstallationDirectory[AlteraQuartus]="/opt/Altera/15.1" InstallationDirectory[XilinxISE]="/opt/Xilinx/14.7" -InstallationDirectory[XilinxVivado]="/opt/Xilinx/Vivado/2014.4" -InstallationDirectory[LatticeDiamond]="/usr/local/diamond/3.6_x64" +InstallationDirectory[XilinxVivado]="/opt/Xilinx/Vivado/2016.1" +InstallationDirectory[LatticeDiamond]="/usr/local/diamond/3.7_x64" InstallationDirectory[OSVVM]="/home/paebbels/git/PoC/lib/osvvm" InstallationDirectory[VUnit]="/home/paebbels/git/PoC/lib/vunit" +# Configure preferred output directories for each library set: declare -A DestinationDirectory -DestinationDirectory[AlteraQuartusII]="altera" -DestinationDirectory[XilinxISE]="xilinx" -DestinationDirectory[XilinxVivado]="vivado" +DestinationDirectory[AlteraQuartus]="altera" +DestinationDirectory[XilinxISE]="xilinx-ise" +DestinationDirectory[XilinxVivado]="xilinx-vivado" DestinationDirectory[LatticeDiamond]="lattice" DestinationDirectory[OSVVM]="osvvm" DestinationDirectory[VUnit]="vuint" +# Declare source directories depending on the installation paths: +declare -A SourceDirectory +SourceDirectory[AlteraQuartus]="${InstallationDirectory[AlteraQuartus]}/quartus/eda/sim_lib" +SourceDirectory[XilinxISE]="${InstallationDirectory[XilinxISE]}/ISE_DS/ISE/vhdl/src" +SourceDirectory[XilinxVivado]="${InstallationDirectory[XilinxVivado]}/data/vhdl/src" +SourceDirectory[LatticeDiamond]="${InstallationDirectory[LatticeDiamond]}/cae_library/simulation/vhdl" +SourceDirectory[OSVVM]="${InstallationDirectory[OSVVM]}" +SourceDirectory[VUnit]="${InstallationDirectory[VUnit]}/vunit/vhdl" + # input files greater than $LARGE_FILESIZE are skipped if '--skip-largefiles' is set LARGE_FILESIZE=125000 + -- cgit v1.2.3