diff options
-rw-r--r-- | dist/mcode/winbuild.ps1 | 4 | ||||
-rw-r--r-- | libraries/vendors/compile-altera.ps1 | 55 | ||||
-rw-r--r-- | libraries/vendors/compile-lattice.ps1 | 35 | ||||
-rw-r--r-- | libraries/vendors/compile-osvvm.ps1 | 9 | ||||
-rw-r--r-- | libraries/vendors/compile-vunit.ps1 | 9 | ||||
-rw-r--r-- | libraries/vendors/compile-xilinx-ise.ps1 | 25 | ||||
-rw-r--r-- | libraries/vendors/compile-xilinx-vivado.ps1 | 19 | ||||
-rw-r--r-- | libraries/vendors/shared.psm1 | 34 | ||||
-rw-r--r-- | src/ghdldrv/ghdlrun.adb | 2 | ||||
-rw-r--r-- | src/name_table.adb | 23 | ||||
-rw-r--r-- | src/name_table.ads | 9 | ||||
-rw-r--r-- | src/std_names.adb | 2 |
12 files changed, 146 insertions, 80 deletions
diff --git a/dist/mcode/winbuild.ps1 b/dist/mcode/winbuild.ps1 index e18213a11..230213fcc 100644 --- a/dist/mcode/winbuild.ps1 +++ b/dist/mcode/winbuild.ps1 @@ -542,7 +542,7 @@ else # include files
Copy-Item "$GHDLRootDir\src\grt\vpi_user.h" "$InstallPath\include" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
# pre-compile scripts
- Copy-Item $GHDLVendorLibraryDir -Recurse "$InstallPath\lib\vendors" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
+ Copy-Item $GHDLVendorLibraryDir -Recurse "$InstallPath\lib" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
# pre-compiled libraries
Copy-Item $GHDLCompiledLibraryDir -Recurse "$InstallPath" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
@@ -617,7 +617,7 @@ else # include files
Copy-Item "$GHDLRootDir\src\grt\vpi_user.h" "$InstallPath\include" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
# pre-compile scripts
- Copy-Item $GHDLVendorLibraryDir -Recurse "$InstallPath\lib\vendors" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
+ Copy-Item $GHDLVendorLibraryDir -Recurse "$InstallPath\lib" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
# pre-compiled libraries
Copy-Item $GHDLCompiledLibraryDir -Recurse "$InstallPath" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
diff --git a/libraries/vendors/compile-altera.ps1 b/libraries/vendors/compile-altera.ps1 index 80f36637e..bcbbcba0d 100644 --- a/libraries/vendors/compile-altera.ps1 +++ b/libraries/vendors/compile-altera.ps1 @@ -102,6 +102,13 @@ param( # save working directory $WorkingDir = Get-Location +# set default values +$EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"] +$EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"] +if ($EnableVerbose -eq $null) { $EnableVerbose = $false } +if ($EnableDebug -eq $null) { $EnableDebug = $false } +if ($EnableDebug -eq $true) { $EnableVerbose = $true } + # load modules from GHDL's 'vendors' library directory Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -Debug:$false -ArgumentList "AlteraQuartus" Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -Debug:$false -ArgumentList @("Altera Quartus", "$WorkingDir") @@ -187,7 +194,7 @@ if ((-not $StopCompiling) -and $Altera) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -201,7 +208,7 @@ if ((-not $StopCompiling) -and $Altera) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -219,7 +226,7 @@ if ((-not $StopCompiling) -and $Altera) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -233,7 +240,7 @@ if ((-not $StopCompiling) -and $Altera) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -246,7 +253,7 @@ if ((-not $StopCompiling) -and $Altera) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -262,7 +269,7 @@ if ((-not $StopCompiling) -and $Max) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -276,7 +283,7 @@ if ((-not $StopCompiling) -and $Max) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -290,7 +297,7 @@ if ((-not $StopCompiling) -and $Max) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -306,7 +313,7 @@ if ((-not $StopCompiling) -and $Arria) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -320,7 +327,7 @@ if ((-not $StopCompiling) -and $Arria) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -335,7 +342,7 @@ if ((-not $StopCompiling) -and $Arria) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -351,7 +358,7 @@ if ((-not $StopCompiling) -and $Arria) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -367,7 +374,7 @@ if ((-not $StopCompiling) -and $Arria) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -381,7 +388,7 @@ if ((-not $StopCompiling) -and $Arria) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -397,7 +404,7 @@ if ((-not $StopCompiling) -and $Cyclone) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -411,7 +418,7 @@ if ((-not $StopCompiling) -and $Cyclone) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -425,7 +432,7 @@ if ((-not $StopCompiling) -and $Cyclone) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -441,7 +448,7 @@ if ((-not $StopCompiling) -and $Cyclone) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -457,7 +464,7 @@ if ((-not $StopCompiling) -and $Stratix) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -471,7 +478,7 @@ if ((-not $StopCompiling) -and $Stratix) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -487,7 +494,7 @@ if ((-not $StopCompiling) -and $Stratix) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -501,7 +508,7 @@ if ((-not $StopCompiling) -and $Stratix) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -515,7 +522,7 @@ if ((-not $StopCompiling) -and $Nanometer) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -533,7 +540,7 @@ if ((-not $StopCompiling) -and $Nanometer) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } diff --git a/libraries/vendors/compile-lattice.ps1 b/libraries/vendors/compile-lattice.ps1 index 991cb7012..b73787032 100644 --- a/libraries/vendors/compile-lattice.ps1 +++ b/libraries/vendors/compile-lattice.ps1 @@ -113,6 +113,13 @@ param( # save working directory $WorkingDir = Get-Location +# set default values +$EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"] +$EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"] +if ($EnableVerbose -eq $null) { $EnableVerbose = $false } +if ($EnableDebug -eq $null) { $EnableDebug = $false } +if ($EnableDebug -eq $true) { $EnableVerbose = $true } + # load modules from GHDL's 'vendors' library directory Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -Debug:$false -ArgumentList "LatticeDiamond" Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -Debug:$false -ArgumentList @("Lattice Diamond", "$WorkingDir") @@ -220,7 +227,7 @@ if ((-not $StopCompiling) -and $ec) $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -231,7 +238,7 @@ if ((-not $StopCompiling) -and $ecp) $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -242,7 +249,7 @@ if ((-not $StopCompiling) -and $ecp2) $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -253,7 +260,7 @@ if ((-not $StopCompiling) -and $ecp3) $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -264,7 +271,7 @@ if ((-not $StopCompiling) -and $ecp5u) $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -275,7 +282,7 @@ if ((-not $StopCompiling) -and $lptm) $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -286,7 +293,7 @@ if ((-not $StopCompiling) -and $lptm2) $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -297,7 +304,7 @@ if ((-not $StopCompiling) -and $MachXO) $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -308,7 +315,7 @@ if ((-not $StopCompiling) -and $MachXO2) $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -319,7 +326,7 @@ if ((-not $StopCompiling) -and $machxo3l) $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -330,7 +337,7 @@ if ((-not $StopCompiling) -and $sc) $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -341,7 +348,7 @@ if ((-not $StopCompiling) -and $scm) $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -352,7 +359,7 @@ if ((-not $StopCompiling) -and $xp) $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -363,7 +370,7 @@ if ((-not $StopCompiling) -and $xp2) $SourceFiles = $FileLists[$Library] | % { "$SourceDirectory\$Library\src\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } diff --git a/libraries/vendors/compile-osvvm.ps1 b/libraries/vendors/compile-osvvm.ps1 index 3d4a1b28d..b10b9f7aa 100644 --- a/libraries/vendors/compile-osvvm.ps1 +++ b/libraries/vendors/compile-osvvm.ps1 @@ -71,6 +71,13 @@ param( # save working directory
$WorkingDir = Get-Location
+# set default values
+$EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"]
+$EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"]
+if ($EnableVerbose -eq $null) { $EnableVerbose = $false }
+if ($EnableDebug -eq $null) { $EnableDebug = $false }
+if ($EnableDebug -eq $true) { $EnableVerbose = $true }
+
# load modules from GHDL's 'vendors' library directory
Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -Debug:$false -ArgumentList "OSVVM"
Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -Debug:$false -ArgumentList @("OSVVM", "$WorkingDir")
@@ -139,7 +146,7 @@ if ((-not $StopCompiling) -and $OSVVM) $SourceFiles = $Files | % { "$SourceDirectory\$_" }
$ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError
+ Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug
$StopCompiling = $HaltOnError -and ($ErrorCount -ne 0)
}
diff --git a/libraries/vendors/compile-vunit.ps1 b/libraries/vendors/compile-vunit.ps1 index 2f2732f31..0948dc5d0 100644 --- a/libraries/vendors/compile-vunit.ps1 +++ b/libraries/vendors/compile-vunit.ps1 @@ -71,6 +71,13 @@ param( # save working directory $WorkingDir = Get-Location +# set default values +$EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"] +$EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"] +if ($EnableVerbose -eq $null) { $EnableVerbose = $false } +if ($EnableDebug -eq $null) { $EnableDebug = $false } +if ($EnableDebug -eq $true) { $EnableVerbose = $true } + # load modules from GHDL's 'vendors' library directory Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -Debug:$false -ArgumentList "VUnit" Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -Debug:$false -ArgumentList @("VUnit", "$WorkingDir") @@ -165,7 +172,7 @@ if ((-not $StopCompiling) -and $VUnit) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } diff --git a/libraries/vendors/compile-xilinx-ise.ps1 b/libraries/vendors/compile-xilinx-ise.ps1 index 51680def9..39d680128 100644 --- a/libraries/vendors/compile-xilinx-ise.ps1 +++ b/libraries/vendors/compile-xilinx-ise.ps1 @@ -98,6 +98,13 @@ if ($Help) # save working directory $WorkingDir = Get-Location +# set default values +$EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"] +$EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"] +if ($EnableVerbose -eq $null) { $EnableVerbose = $false } +if ($EnableDebug -eq $null) { $EnableDebug = $false } +if ($EnableDebug -eq $true) { $EnableVerbose = $true } + # load modules from GHDL's 'vendors' library directory Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -Debug:$false -ArgumentList "XilinxISE" Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -Debug:$false -ArgumentList @("Xilinx ISE", "$WorkingDir") @@ -186,7 +193,7 @@ if ((-not $StopCompiling) -and $Unisim) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -196,7 +203,7 @@ if ((-not $StopCompiling) -and $Unisim) $SourceFiles = dir "$SourceDirectory\unisims\primitive\*.vhd*" $ErrorCount += 0 - Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -206,7 +213,7 @@ if ((-not $StopCompiling) -and $Unisim -and $SecureIP) $SourceFiles = dir "$SourceDirectory\unisims\secureip\*.vhd*" $ErrorCount += 0 - Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -221,7 +228,7 @@ if ((-not $StopCompiling) -and $Unimacro) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -231,7 +238,7 @@ if ((-not $StopCompiling) -and $Unimacro) $SourceFiles = dir "$SourceDirectory\unimacro\*_MACRO.vhd*" $ErrorCount += 0 - Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -247,7 +254,7 @@ if ((-not $StopCompiling) -and $Simprim) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -257,7 +264,7 @@ if ((-not $StopCompiling) -and $Simprim) $SourceFiles = dir "$SourceDirectory\simprims\primitive\other\*.vhd*" $ErrorCount += 0 - Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -267,7 +274,7 @@ if ((-not $StopCompiling) -and $Simprim -and $SecureIP) $SourceFiles = dir "$SourceDirectory\simprims\secureip\other\*.vhd*" $ErrorCount += 0 - Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -291,7 +298,7 @@ if ((-not $StopCompiling) -and $CoreLib) } $ErrorCount += 0 - Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } diff --git a/libraries/vendors/compile-xilinx-vivado.ps1 b/libraries/vendors/compile-xilinx-vivado.ps1 index f65f7560c..2627298db 100644 --- a/libraries/vendors/compile-xilinx-vivado.ps1 +++ b/libraries/vendors/compile-xilinx-vivado.ps1 @@ -85,6 +85,13 @@ param( # save working directory $WorkingDir = Get-Location +# set default values +$EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"] +$EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"] +if ($EnableVerbose -eq $null) { $EnableVerbose = $false } +if ($EnableDebug -eq $null) { $EnableDebug = $false } +if ($EnableDebug -eq $true) { $EnableVerbose = $true } + # load modules from GHDL's 'vendors' library directory Import-Module $PSScriptRoot\config.psm1 -Verbose:$false -ArgumentList "XilinxVivado" Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -ArgumentList @("Xilinx Vivado", "$WorkingDir") @@ -174,7 +181,7 @@ if ((-not $StopCompiling) -and $Unisim) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -184,7 +191,7 @@ if ((-not $StopCompiling) -and $Unisim) $SourceFiles = dir "$SourceDirectory\unisims\primitive\*.vhd*" $ErrorCount += 0 - Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -194,7 +201,7 @@ if ((-not $StopCompiling) -and $Unisim) $SourceFiles = dir "$SourceDirectory\unisims\retarget\*.vhd*" $ErrorCount += 0 - Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -204,7 +211,7 @@ if ((-not $StopCompiling) -and $Unisim -and $SecureIP) $SourceFiles = dir "$SourceDirectory\unisims\secureip\*.vhd*" $ErrorCount += 0 - Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -219,7 +226,7 @@ if ((-not $StopCompiling) -and $Unimacro) $SourceFiles = $Files | % { "$SourceDirectory\$_" } $ErrorCount += 0 - Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PackageCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } @@ -229,7 +236,7 @@ if ((-not $StopCompiling) -and $Unimacro) $SourceFiles = dir "$SourceDirectory\unimacro\*_MACRO.vhd*" $ErrorCount += 0 - Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError + Start-PrimitiveCompilation $GHDLBinary $GHDLOptions $DestinationDirectory $Library $VHDLVersion $SourceFiles $HaltOnError -Verbose:$EnableVerbose -Debug:$EnableDebug $StopCompiling = $HaltOnError -and ($ErrorCount -ne 0) } diff --git a/libraries/vendors/shared.psm1 b/libraries/vendors/shared.psm1 index 1c693af73..9cc31b375 100644 --- a/libraries/vendors/shared.psm1 +++ b/libraries/vendors/shared.psm1 @@ -91,9 +91,9 @@ function Get-SourceDirectory ) if ($Source -ne "") - { $SourceDirectory = $Source } # TODO: remove trailing backslashes + { $SourceDirectory = $Source.TrimEnd("\") } elseif ($EnvSource -ne "") - { $SourceDirectory = $EnvSource } + { $SourceDirectory = $EnvSource } else { $SourceDirectory = (Get-VendorToolInstallationDirectory) + "\" + (Get-VendorToolSourceDirectory) } @@ -126,7 +126,7 @@ function Get-DestinationDirectory [string]$Output ) if ($Output -ne "") - { $DestinationDirectory = $Output } # TODO: remove trailing backslashes + { $DestinationDirectory = $Output.TrimEnd("\") } else { $DestinationDirectory = Get-VendorToolDestinationDirectory } @@ -268,17 +268,25 @@ function Start-PackageCompilation [Parameter(Mandatory=$true)][string[]]$SourceFiles, [Parameter(Mandatory=$true)][bool]$HaltOnError ) + # set default values + $EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"] + $EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"] + if ($EnableVerbose -eq $null) { $EnableVerbose = $false } + if ($EnableDebug -eq $null) { $EnableDebug = $false } + if ($EnableDebug -eq $true) { $EnableVerbose = $true } + $LibraryDirectory="$DestinationDirectory/$Library/$VHDLVersion" + $EnableDebug -and (Write-Host " mkdir $LibraryDirectory" -ForegroundColor DarkGray ) | Out-Null mkdir $LibraryDirectory -ErrorAction SilentlyContinue | Out-Null - echo $LibraryDirectory + $EnableDebug -and (Write-Host " cd $LibraryDirectory" -ForegroundColor DarkGray ) | Out-Null cd $LibraryDirectory Write-Host "Compiling library '$Library' ..." -ForegroundColor Yellow $ErrorCount = 0 foreach ($File in $SourceFiles) { Write-Host "Analyzing package file '$File'" -ForegroundColor DarkCyan $InvokeExpr = "$GHDLBinary " + ($GHDLOptions -join " ") + " --work=$Library " + $File + " 2>&1" - # Write-Host " $InvokeExpr" -ForegroundColor DarkGray - $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null + $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " if ($LastExitCode -ne 0) { $ErrorCount += 1 if ($HaltOnError) @@ -319,17 +327,25 @@ function Start-PrimitiveCompilation [Parameter(Mandatory=$true)][string[]]$SourceFiles, [Parameter(Mandatory=$true)][bool]$HaltOnError ) + # set default values + $EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"] + $EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"] + if ($EnableVerbose -eq $null) { $EnableVerbose = $false } + if ($EnableDebug -eq $null) { $EnableDebug = $false } + if ($EnableDebug -eq $true) { $EnableVerbose = $true } + $LibraryDirectory="$DestinationDirectory/$Library/$VHDLVersion" + $EnableDebug -and (Write-Host " mkdir $LibraryDirectory" -ForegroundColor DarkGray ) | Out-Null mkdir $LibraryDirectory -ErrorAction SilentlyContinue | Out-Null - echo $LibraryDirectory + $EnableDebug -and (Write-Host " cd $LibraryDirectory" -ForegroundColor DarkGray ) | Out-Null cd $LibraryDirectory Write-Host "Compiling library '$Library' ..." -ForegroundColor Yellow $ErrorCount = 0 foreach ($File in $SourceFiles) { Write-Host "Analyzing primitive file '$File'" -ForegroundColor DarkCyan $InvokeExpr = "$GHDLBinary " + ($GHDLOptions -join " ") + " --work=$Library " + $File + " 2>&1" - # Write-Host " $InvokeExpr" -ForegroundColor DarkGray - $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null + $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " if ($LastExitCode -ne 0) { $ErrorCount += 1 if ($HaltOnError) diff --git a/src/ghdldrv/ghdlrun.adb b/src/ghdldrv/ghdlrun.adb index 94d760d63..725c16e30 100644 --- a/src/ghdldrv/ghdlrun.adb +++ b/src/ghdldrv/ghdlrun.adb @@ -604,7 +604,7 @@ package body Ghdlrun is Str_Table.Initialize; Nodes.Initialize; Files_Map.Initialize; - Name_Table.Initialize; + Name_Table.Finalize; if Flag_Verbose then Ada.Text_IO.Put_Line ("Starting simulation"); diff --git a/src/name_table.adb b/src/name_table.adb index b4bc24ca4..3d0010bce 100644 --- a/src/name_table.adb +++ b/src/name_table.adb @@ -1,5 +1,5 @@ -- Name table. --- Copyright (C) 2002, 2003, 2004, 2005 Tristan Gingold +-- Copyright (C) 2002 - 2016 Tristan Gingold -- -- 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 @@ -52,6 +52,9 @@ package body Name_Table is type Hash_Array is array (Hash_Value_Type range <>) of Name_Id; type Hash_Array_Acc is access Hash_Array; + procedure Deallocate is new Ada.Unchecked_Deallocation + (Hash_Array, Hash_Array_Acc); + -- Hash table. Lower bound is always 0, upper bound is always -- Hash_Table_Size - 1. Hash_Table: Hash_Array_Acc; @@ -107,7 +110,7 @@ package body Name_Table is Strings_Table.Append (NUL); - -- Reserve entry 0. + -- Reserve entry 0 for Null_Identifier. Strings_Table.Append (NUL); Names_Table.Append ((Hash => 0, Name => Strings_Table.Last, @@ -128,10 +131,19 @@ package body Name_Table is Append_Terminator; + -- Allocate the Hash_Table. + Hash_Table_Size := 1024; Hash_Table := new Hash_Array'(0 .. Hash_Table_Size - 1 => Null_Identifier); end Initialize; + procedure Finalize is + begin + Strings_Table.Free; + Names_Table.Free; + Deallocate (Hash_Table); + end Finalize; + -- Compute the hash value of a string. In case of algorithm change, check -- the performance using Disp_Stats. function Hash return Hash_Value_Type @@ -238,9 +250,6 @@ package body Name_Table is -- Expand the hash table (double the size). procedure Expand is - procedure Deallocate is new Ada.Unchecked_Deallocation - (Hash_Array, Hash_Array_Acc); - Old_Hash_Table : Hash_Array_Acc; Id : Name_Id; begin @@ -309,8 +318,6 @@ package body Name_Table is Hash_Table (Hash_Index) := Res; Append_Terminator; - --Put_Line ("created"); - return Res; end Get_Identifier; @@ -442,4 +449,6 @@ package body Name_Table is end loop; end; end Disp_Stats; +begin + Initialize; end Name_Table; diff --git a/src/name_table.ads b/src/name_table.ads index 5a6219f5e..000b98b2a 100644 --- a/src/name_table.ads +++ b/src/name_table.ads @@ -1,5 +1,5 @@ -- Name table. --- Copyright (C) 2002, 2003, 2004, 2005 Tristan Gingold +-- Copyright (C) 2002 - 2016 Tristan Gingold -- -- 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 @@ -26,9 +26,6 @@ with Types; use Types; -- doubled. package Name_Table is - -- Initialize the package, ie create tables. - procedure Initialize; - -- Get an entry in the name table for a character. -- (entries for characters are already built). Characters are put in the -- name table, but are always different from identifiers. They simply @@ -100,6 +97,10 @@ package Name_Table is -- The length of the name string. Nam_Length: Natural range 0 .. Max_Nam_Length; + -- Free all resources. The package cannot be used anymore after calling + -- this procedure. + procedure Finalize; + -- Disp statistics. -- Used for debugging. procedure Disp_Stats; diff --git a/src/std_names.adb b/src/std_names.adb index 253f844ad..5e8e4bae2 100644 --- a/src/std_names.adb +++ b/src/std_names.adb @@ -28,8 +28,6 @@ package body Std_Names is end if; end Def; begin - Name_Table.Initialize; - Def ("mod", Name_Mod); Def ("rem", Name_Rem); |