aboutsummaryrefslogtreecommitdiffstats
path: root/libraries/vendors/compile-xilinx-vivado.ps1
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/vendors/compile-xilinx-vivado.ps1')
-rw-r--r--libraries/vendors/compile-xilinx-vivado.ps1122
1 files changed, 88 insertions, 34 deletions
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 }