\input texinfo   @c -*-texinfo-*-
@c %**start of header
@setfilename GHDL.info
@documentencoding UTF-8
@ifinfo
@*Generated by Sphinx 1.8.2.@*
@end ifinfo
@settitle GHDL Documentation
@defindex ge
@paragraphindent 0
@exampleindent 4
@finalout
@dircategory Miscellaneous
@direntry
* GHDL: (GHDL.info). VHDL simulator.
@end direntry

@definfoenclose strong,`,'
@definfoenclose emph,`,'
@c %**end of header

@copying
@quotation
GHDL 0.37-dev, Sep 20, 2019

Tristan Gingold and contributors

Copyright @copyright{} 2002-2019, Tristan Gingold and contributors
@end quotation

@end copying

@titlepage
@title GHDL Documentation
@insertcopying
@end titlepage
@contents

@c %** start of user preamble

@c %** end of user preamble

@ifnottex
@node Top
@top GHDL Documentation
@insertcopying
@end ifnottex

@c %**start of body
@anchor{index doc}@anchor{0}
@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML



__________________________________________________________________


This manual is the user and reference manual for GHDL. It does not contain an
introduction to VHDL. Thus, the reader should have at least a basic knowledge
of VHDL. A good knowledge of VHDL language reference manual (usually called
LRM) is a plus.



This document was generated on Sep 20, 2019 - 03:55.

@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML


@menu
* About GHDL:: 
* Contributing:: 
* Copyrights | Licenses:: 
* Quick Start Guide:: 
* Invoking GHDL:: 
* Simulation and runtime:: 
* Interfacing to other languages:: 
* Releases and sources:: 
* Building GHDL from Sources:: 
* Precompile Vendor Primitives:: 
* Command Reference:: 
* Coding Style:: 
* Implementation of VHDL:: 
* Implementation of VITAL:: 
* Roadmap | Future Improvements:: 
* Meta:: 
* Index: Index<2>. 
* Index:: 

@detailmenu
 --- The Detailed Node Listing ---

About GHDL

* What is VHDL?:: 
* What is GHDL?:: 
* Who uses GHDL?:: 

Contributing

* Reporting bugs:: 
* Requesting enhancements:: 
* Improving the documentation:: 
* Fork@comma{} modify and pull-request: Fork modify and pull-request. 
* Related interesting projects:: 

Copyrights | Licenses

* GNU GPLv2:: 
* CC-BY-SA:: 
* List of Contributors:: 

Quick Start Guide

* The ‘Hello world’ program:: 
* The heartbeat program:: 
* A full adder:: 
* Starting with a design:: 
* Starting with your design:: 

Invoking GHDL

* Design building commands:: 
* Design rebuilding commands:: 
* Options:: 
* Warnings:: 
* Diagnostics Control:: 
* Library commands:: 
* VPI build commands:: 
* IEEE library pitfalls:: 

Design building commands

* Analysis [-a]:: 
* Elaboration [-e]:: 
* Run [-r]:: 
* Elaborate and run [--elab-run]:: 
* Check syntax [-s]:: 
* Analyze and elaborate [-c]:: 

Design rebuilding commands

* Import [-i]:: 
* Make [-m]:: 
* Generate Makefile [--gen-makefile]:: 
* Generate dependency file command [--gen-depends]:: 

Library commands

* Directory [--dir]:: 
* Clean [--clean]:: 
* Remove [--remove]:: 
* Copy [--copy]:: 

VPI build commands

* compile [--vpi-compile]:: 
* link [--vpi-link]:: 
* cflags [--vpi-cflags]:: 
* ldflags [--vpi-ldflags]:: 
* include dir [--vpi-include-dir]:: 
* library dir [--vpi-library-dir]:: 

Simulation and runtime

* Simulation options:: 
* Export waveforms:: 
* Export hierarchy and references:: 
* Debugging:: 

Debugging

* GNU Debugger (GDB): GNU Debugger GDB. 

Interfacing to other languages

* Foreign declarations:: 
* Linking foreign object files to GHDL:: 
* Wrapping and starting a GHDL simulation from a foreign program:: 
* Linking GHDL to Ada/C:: 
* Dynamically loading foreign objects from GHDL:: 
* Dynamically loading GHDL:: 
* Using GRT from Ada:: 

Foreign declarations

* Restrictions on foreign declarations:: 

Releases and sources

* Downloading pre-built packages:: 
* Downloading Source Files:: 

Building GHDL from Sources

* Directory structure:: 
* mcode backend:: 
* LLVM backend:: 
* GCC backend:: 

mcode backend

* GCC/GNAT; GNU/Linux or Windows (MinGW/MSYS2): GCC/GNAT GNU/Linux or Windows MinGW/MSYS2. 
* GNAT GPL; Windows: GNAT GPL Windows. 

LLVM backend

* GCC/GNAT; GNU/Linux or Windows (MinGW/MSYS2): GCC/GNAT GNU/Linux or Windows MinGW/MSYS2<2>. 

Precompile Vendor Primitives

* Supported Vendors Libraries:: 
* Supported Simulation and Verification Libraries:: 
* Script Configuration:: 
* Compiling on Linux:: 
* Compiling on Windows:: 
* Configuration Files:: 

Configuration Files

* For Linux; config.sh: For Linux config sh. 
* For Windows; config.psm1: For Windows config psm1. 
* Selectable Options for the Bash Scripts;: Selectable Options for the Bash Scripts. 
* Selectable Options for the PowerShell Scripts;: Selectable Options for the PowerShell Scripts. 

Command Reference

* Environment variables:: 
* Misc commands:: 
* File commands:: 
* GCC/LLVM only commands:: 
* Options: Options<2>. 
* Passing options to other programs:: 

Misc commands

* Help [-h]:: 
* Display config [--disp-config]:: 
* Display standard [--disp-standard]:: 
* Version [--version]:: 

File commands

* Pretty print [--pp-html]:: 
* Find [-f]:: 
* Chop [--chop]:: 
* Lines [--lines]:: 

GCC/LLVM only commands

* Bind [--bind]:: 
* Link [--link]:: 
* List link [--list-link]:: 

Implementation of VHDL

* VHDL standards:: 
* PSL implementation:: 
* Source representation:: 
* Library database:: 
* Top entity:: 
* Using vendor libraries:: 

Implementation of VITAL

* VITAL packages:: 
* VHDL restrictions for VITAL:: 
* Backannotation:: 
* Negative constraint calculation:: 

Meta

* General guidelines to edit the documentation:: 
* Guidelines to edit section ‘Building’:: 
* Documentation configuration:: 
* Dist:: 

@end detailmenu
@end menu

@node About GHDL,Contributing,Top,Top
@anchor{about doc}@anchor{1}@anchor{about about-ghdl}@anchor{2}@anchor{about ghdl-documentation}@anchor{3}
@chapter About GHDL


@menu
* What is VHDL?:: 
* What is GHDL?:: 
* Who uses GHDL?:: 

@end menu

@node What is VHDL?,What is GHDL?,,About GHDL
@anchor{about intro-vhdl}@anchor{4}@anchor{about what-is-vhdl}@anchor{5}
@section What is @cite{VHDL}?


VHDL@footnote{https://en.wikipedia.org/wiki/VHDL} is an acronym for Very High Speed Integrated Circuit (VHSIC@footnote{https://en.wikipedia.org/wiki/VHSIC}) Hardware Description Language (HDL@footnote{https://en.wikipedia.org/wiki/HDL}), which is a programming language used to describe a logic circuit by function, data flow behavior, or structure.

Although VHDL was not designed for writing general purpose programs, VHDL @emph{is} a programming language, and you can write any algorithm with it. If you are able to write programs, you will find in VHDL features similar to those found in procedural languages such as @cite{C}, @cite{Python}, or @cite{Ada}. Indeed, VHDL derives most of its syntax and semantics from Ada. Knowing @cite{Ada} is an advantage for learning VHDL (it is an advantage in general as well).

However, VHDL was not designed as a general purpose language but as an @cite{HDL}. As the name implies, VHDL aims at modeling or documenting electronics systems. Due to the nature of hardware components which are always running, VHDL is a highly concurrent language, built upon an event-based timing model.

Like a program written in any other language, a VHDL program can be executed. Since VHDL is used to model designs, the term @emph{simulation} is often used instead of @cite{execution}, with the same meaning. At the same time, like a design written in another @cite{HDL}, a set of VHDL sources can be transformed with a @emph{synthesis tool} into a netlist, that is, a detailed gate-level implementation.

The development of VHDL started in 1983 and the standard is named IEEE@footnote{https://www.ieee.org/} @cite{1076}. Four revisions exist: 1987@footnote{http://ieeexplore.ieee.org/document/26487/}, 1993@footnote{http://ieeexplore.ieee.org/document/392561/}, 2002@footnote{http://ieeexplore.ieee.org/document/1003477/} and 2008@footnote{http://ieeexplore.ieee.org/document/4772740/}. The standardization is handled by the VHDL Analysis and Standardization Group (VASG/P1076@footnote{http://www.eda-twiki.org/vasg/}).

@node What is GHDL?,Who uses GHDL?,What is VHDL?,About GHDL
@anchor{about intro-ghdl}@anchor{6}@anchor{about what-is-ghdl}@anchor{7}
@section What is GHDL?


@cite{GHDL} is a shorthand for @cite{G Hardware Design Language} (currently, @cite{G} has no meaning). It is a VHDL compiler that can execute (nearly) any VHDL program. GHDL is @emph{not} a synthesis tool: you cannot create a netlist with GHDL (yet).

Unlike some other simulators, GHDL is a compiler: it directly translates a VHDL file to machine code, without using an intermediary language such as @cite{C} or @cite{C++}. Therefore, the compiled code should be faster and the analysis time should be shorter than with a compiler using an intermediary language.

GHDL can use multiple back-ends, i.e. code generators, (GCC@footnote{http://gcc.gnu.org/}, LLVM@footnote{http://llvm.org/} or x86@footnote{https://en.wikipedia.org/wiki/X86-64}/i386@footnote{https://en.wikipedia.org/wiki/Intel_80386} only, a built-in one) and runs on GNU/Linux@footnote{https://en.wikipedia.org/wiki/Linux_distribution}, Windows@footnote{https://en.wikipedia.org/wiki/Microsoft_Windows} ™  and macOS@footnote{https://en.wikipedia.org/wiki/MacOS} ™ , both on x86 and on x86_64.

The current version of GHDL does not contain any graphical viewer: you cannot see signal waves. You can still check the behavior of your design with a test bench. Moreover, the current version can produce a GHW@footnote{http://ghdl.readthedocs.io/en/latest/using/Simulation.html?highlight=GHW#cmdoption-wave}, VCD@footnote{https://en.wikipedia.org/wiki/Value_change_dump} or @cite{FST} files which can be viewed with a waveform viewer@footnote{https://en.wikipedia.org/wiki/Waveform_viewer}, such as GtkWave@footnote{http://gtkwave.sourceforge.net/}.

GHDL aims at implementing VHDL as defined by IEEE 1076@footnote{http://ieeexplore.ieee.org/document/4772740/}. It supports the 1987@footnote{http://ieeexplore.ieee.org/document/26487/}, 1993@footnote{http://ieeexplore.ieee.org/document/392561/} and 2002@footnote{http://ieeexplore.ieee.org/document/1003477/} revisions and, partially, the latest, 2008@footnote{http://ieeexplore.ieee.org/document/4772740/}. PSL@footnote{https://en.wikipedia.org/wiki/Property_Specification_Language} is also partially supported.

Several third party projects are supported: VUnit@footnote{https://vunit.github.io/}, OSVVM@footnote{http://osvvm.org/}, cocotb@footnote{https://github.com/potentialventures/cocotb} (through the VPI interface@footnote{https://en.wikipedia.org/wiki/Verilog_Procedural_Interface}), …

@cartouche
@quotation Hint 
Although synthesis is not supported yet, there is some experimental feature to generate RTL netlists (VHDL or EDIF) from synthesisable code. For subcommand @code{--synth} to be available, GHDL must be configured/built with option @code{--enable-synth} (GCC 8.1>= required, due to some new GNAT features which are only available in recent releases). Since this is a proof-of-concept, the output is mostly a dump of an internal structure for now. Therefore, it is not very useful, except for debugging.

Moreover, ghdlsynth@footnote{https://github.com/tgingold/ghdlsynth-beta} is a complementary repository that lets GHDL to be loaded by yosys@footnote{http://www.clifford.at/yosys/} as a frontend plugin module, in order to generate bitstreams for some FPGA devices.
@end quotation
@end cartouche

@node Who uses GHDL?,,What is GHDL?,About GHDL
@anchor{about intro-who}@anchor{8}@anchor{about who-uses-ghdl}@anchor{9}
@section Who uses GHDL?



@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML


@node Contributing,Copyrights | Licenses,About GHDL,Top
@anchor{contribute doc}@anchor{a}@anchor{contribute contributing}@anchor{b}@anchor{contribute intro-contributing}@anchor{c}
@chapter Contributing


The first step might be to use GHDL and explore its possibilities in your own project. If you are new to VHDL, see the
@ref{d,,Quick Start Guide} for an introduction. Furthermore, we encourage you to read @ref{e,,Invoking GHDL}, where the most
commonly used options are explained. You can also check the complete @ref{f,,Command Reference}.

If you are more familiar with GHDL, you might start asking yourself how it works internally. If so, you might find
@ref{10,,Implementation of VHDL} and @ref{11,,Implementation of VITAL} interesting.

While using GHDL, you might find flaws, such as bugs, missing features, typos in the documentation, or topics which still are
not covered. In order to improve GHDL, we welcome bug reports, suggestions, and contributions for any aspect of
GHDL. Whether it’s a bug or an enhancement, have a look at the 
@image{/Users/gingold/devel/ghdl/doc/build/doctrees/images/75d23ce669cbc7993d4d057361ad0c2a3d5d5271/ghdl,,,Open issues,svg}
 and 
@image{/Users/gingold/devel/ghdl/doc/build/doctrees/images/e1c1423669df5839910ed47f754b67708d362d8b/ghdl,,,Closed issues,svg}
 to see
if someone already told us about it. You might find a solution there.

If you found no information on your topic, please, report so that we are aware! You can reach us through various ways:

@image{/Users/gingold/devel/ghdl/doc/build/doctrees/images/16176de4998e1a71b2f57993443202b2d81671f4/chat-on%20gitter-4db797,,,Talk to us on Gitter,svg}
 or open a 
@image{/Users/gingold/devel/ghdl/doc/build/doctrees/images/dfb2204df41464917807ba7d4295bf10566f1193/new-issue-yellowgreen,,,Open new issue at GitHub,svg}
.

@cartouche
@quotation Hint 
Since the development of GHDL started fifteen years ago, multiple platforms have been used as a support for both distribution and getting feedback. However, the development is now centralized in github.
@end quotation
@end cartouche

@cartouche
@quotation Tip 
How To Ask Questions The Smart Way@footnote{www.catb.org/~esr/faqs/smart-questions.html}
@end quotation
@end cartouche

@menu
* Reporting bugs:: 
* Requesting enhancements:: 
* Improving the documentation:: 
* Fork@comma{} modify and pull-request: Fork modify and pull-request. 
* Related interesting projects:: 

@end menu

@node Reporting bugs,Requesting enhancements,,Contributing
@anchor{contribute id1}@anchor{12}@anchor{contribute reporting-bugs}@anchor{13}
@section Reporting bugs


@cartouche
@quotation Tip 

@itemize *

@item 
If the compiler crashes, this is a bug. Reliable tools never crash.

@item 
If the compiler emits an error message for a perfectly valid input or does not emit an error message for an invalid input, this may be a bug.

@item 
If the executable created from your VHDL sources crashes, this may be a bug at runtime or the code itself may be wrong. However, since VHDL has a notion of pointers, an erroneous VHDL program (using invalid pointers for example) may crash.

@item 
If a compiler message is not clear enough, please tell us. The error messages can be improved, but we do not have enough experience with them.
@end itemize
@end quotation
@end cartouche

Please, report issues of this kind through 
@image{/Users/gingold/devel/ghdl/doc/build/doctrees/images/bac95e4b3b8c2d7bfbc31a7ce9892272a524ef30/new-bug--report-yellowgreen,,,Open new bug report at GitHub,svg}
, as this allows us to categorize issues into groups and
to assign developers to them. You can track the issue’s state and see how it’s getting solved.

@cartouche
@quotation Important 
As suggested in the bug report template, please elaborate a @cite{Minimal (non) Working Example} (MWE@footnote{https://en.wikipedia.org/wiki/Minimal_Working_Example}) prior to sending the report, so that the possible bug source is isolated. Should it fulfill the format requirements of issue-runner@footnote{https://github.com/1138-4EB/issue-runner}, you would be able to test your bug with the latest GHDL version. Please do so in order to ensure that the bug is not solved already.

Also, please include enough information in the bug report, for the maintainers to reproduce the problem. The template includes:


@itemize *

@item 
Operating system and version of GHDL (you can get it with @code{ghdl --version}).

@item 
Whether you have built GHDL from sources (provide short SHA of the used commit) or used the binary distribution (note which release/tag).


@itemize *

@item 
If you cannot compile, please report which compiler you are using and the version.
@end itemize

@item 
Content of the input files which comprise the MWE

@item 
Description of the problem:


@itemize *

@item 
Comment explaining whether the MWE should compile or not; if yes, whether or not is should run until the assertion.

@item 
What you expect to happen and what you actually get. If you know the LRM well enough, please specify which paragraph might not be implemented well.

@item 
Samples of any log.

@item 
Anything else that you think would be helpful.
@end itemize
@end itemize
@end quotation
@end cartouche

@cartouche
@quotation Note 
If you don’t know the LRM, be aware that an issue claimed as a bug report may be rejected because there is no bug according to it. GHDL aims at implementing VHDL as defined in IEEE 1076@footnote{http://ieeexplore.ieee.org/document/4772740/}. However, some other tools allow constructs which do not fully follow the standard revisions. Therefore, comparisons with other VHDL is not a solid argument. Some of them are supported by GHDL (see @ref{14,,IEEE library pitfalls}), but any such enhancement will have very low priority.
@end quotation
@end cartouche

@node Requesting enhancements,Improving the documentation,Reporting bugs,Contributing
@anchor{contribute id2}@anchor{15}@anchor{contribute requesting-enhancements}@anchor{16}
@section Requesting enhancements



@image{/Users/gingold/devel/ghdl/doc/build/doctrees/images/89dd2439936c60b66feb51ba1c0d6a38facef2d8/1561565e8455e49d1382462c9afb48178cccd06f,,,Open new feature request at GitHub,svg?logo=github&style=flat-square&longCache=true}
 
@image{/Users/gingold/devel/ghdl/doc/build/doctrees/images/16176de4998e1a71b2f57993443202b2d81671f4/chat-on%20gitter-4db797,,,Talk to us on Gitter,svg}


All enhancements and feature requests are welcome. Please open a new issue@footnote{https://github.com/ghdl/ghdl/issues/new} to report any, so you can track the request’s status and implementation. Depending on the complexity of the request, you may want to chat on Gitter@footnote{https://gitter.im/ghdl/ghdl1}, to polish it before opening an issue.

@node Improving the documentation,Fork modify and pull-request,Requesting enhancements,Contributing
@anchor{contribute improving-the-documentation}@anchor{17}
@section Improving the documentation


If you found a mistake in the documentation, please send a comment. If you didn’t understand some parts of this manual,
please tell us. English is not our mother tongue, so this documentation may not be well-written.

Likewise, rewriting part of the documentation or missing content (such as examples) is a good way to improve it. Since
it automatically is built from @cite{reStructuredText} and @cite{Markdown} sources, you can fork, modify and request the
maintainers to pull your copy. See @ref{18,,Fork@comma{} modify and pull-request}.

@node Fork modify and pull-request,Related interesting projects,Improving the documentation,Contributing
@anchor{contribute fork-modify-and-pull-request}@anchor{19}@anchor{contribute pull-request}@anchor{18}
@section Fork, modify and pull-request


@cartouche
@quotation Tip 

@itemize *

@item 
Before starting any modification, you might want to have a look at 
@image{/Users/gingold/devel/ghdl/doc/build/doctrees/images/c3a4692a25333d57bb8c1ce54f97f15c6846ba63/ghdl,,,Open pull requests,svg}
 and 
@image{/Users/gingold/devel/ghdl/doc/build/doctrees/images/6497f995f9ef9e87d1fe97a236cebe38959dc915/ghdl,,,Closed pull requests,svg}
, to check which other contributions are being made or have been made. If you observe that the modifications you are about to start might conflict with any other, please 
@image{/Users/gingold/devel/ghdl/doc/build/doctrees/images/16176de4998e1a71b2f57993443202b2d81671f4/chat-on%20gitter-4db797,,,Talk to us on Gitter,svg}
 or open a 
@image{/Users/gingold/devel/ghdl/doc/build/doctrees/images/82b759af84cd517081b3c031dfbe444f16595fb9/f125673efc1475d3e54f355fd17e00e44587099a,,,Open new Pull Request (PR) at GitHub,svg?logo=github&style=flat-square&longCache=true}
 to coordinate.

@item 
See section @ref{1a,,Directory structure} to faster find the location of the sources you need to modify, and/or to know where to place new ones.
@end itemize
@end quotation
@end cartouche

Contributing source code/documentation via Git@footnote{https://git-scm.com/} is very easy. Although we don’t provide direct
write access to our repositories, the project is hosted at GitHub, which follows a fork, edit and pull-request
flow@footnote{https://help.github.com/articles/github-flow/} . That is:


@enumerate 

@item 
Make a copy (fork@footnote{https://help.github.com/articles/fork-a-repo/}) of the project.

@item 
Do the changes you wish (edit, add, rename, move and/or delete).

@item 
When you think that the changes are ready to be merged, notify the maintainers by opening a Pull Request@footnote{https://help.github.com/articles/creating-a-pull-request/} (PR).

@item 
The maintainers will review the proposed changes and will reply in the corresponding thread if any further modification is required. If so, you can keep adding commits to the same branch, and the PR will be automatically updated.

@item 
Last, the maintainers will merge your branch. You will be notified, the PR will be closed, and you’ll be allowed to delete the branch, if you want.
@end enumerate

@cartouche
@quotation Tip 

@itemize *

@item 
It is recommended to read A successful Git branching model@footnote{http://nvie.com/posts/a-successful-git-branching-model/} for a reference on how maintainers expect to handle multiple branches. However, our actual model is not as exhaustive as explained there.

@item 
Some commit messages can automatically close@footnote{https://help.github.com/articles/closing-issues-via-commit-messages/} issues. This is a very useful feature, which you are not required to use. However beware that using @cite{fix} anywhere in the commit message can have side effects. If you closed any issue unexpectedly, just reply to it (even if it’s closed) so that maintainers can check it.

@item 
It is recommended to read @ref{1b,,Coding Style} before contributing modifications to Ada sources.
@end itemize
@end quotation
@end cartouche

@node Related interesting projects,,Fork modify and pull-request,Contributing
@anchor{contribute related-interesting-projects}@anchor{1c}
@section Related interesting projects


If you have an interesting project, please send us feedback or get listed on our @ref{8,,Who uses GHDL?} page.

@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML

@node Copyrights | Licenses,Quick Start Guide,Contributing,Top
@anchor{licenses doc}@anchor{1d}@anchor{licenses copyrights-licenses}@anchor{1e}@anchor{licenses intro-copyrights}@anchor{1f}
@chapter Copyrights | Licenses



@itemize -

@item 
The GHDL front-end package @code{std.textio}, and the runtime library @code{grt} are given under @ref{20,,GNU GPLv2}.

@item 
The documentation is given under @ref{21,,CC-BY-SA}.
@end itemize

@cartouche
@quotation Warning 
As a consequence of the runtime copyright, you are not allowed to distribute an executable produced by GHDL without the VHDL sources. To my mind, this is not a real restriction, since it is pointless to distribute VHDL executable. Please, send a comment (@ref{16,,Requesting enhancements}) if you don’t like this policy.
@end quotation
@end cartouche


@itemize -

@item 
The following packages are copyrighted by third parties (see corresponding sources for more information):

@quotation


@itemize -

@item 
These from library @code{ieee} are copyrighted by Institute of Electrical and Electronics Engineers (IEEE)@footnote{https://www.ieee.org} :

@quotation


@itemize -

@item 
@code{numeric_bit} and @code{numeric_std}: the source files may be distributed without change, except as permitted by the standard; these may not be sold or distributed for profit. [see also IEEE 1076.3@footnote{http://ieeexplore.ieee.org/document/592543/} ]

@item 
@code{std_logic_1164}, @code{Math_Real} and @code{Math_Complex}

@item 
@code{VITAL_Primitives}, @code{VITAL_Timing} and @code{VITAL_Memory} [see also IEEE 1076.4@footnote{http://ieeexplore.ieee.org/document/954750/} ]
@end itemize
@end quotation

@item 
The following sources may be used and distributed without restriction, provided that the copyright statements are not removed from the files and that any derivative work contains the copyright notice.

@quotation


@itemize -

@item 
@code{synopsys} directory: @code{std_logic_arith}, @code{std_logic_signed}, @code{std_logic_unsigned} and @code{std_logic_textio} are copyrighted by Synopsys@comma{} Inc.@footnote{https://www.synopsys.com/}

@item 
@code{mentor} directory: @code{std_logic_arith} is copyrighted by Mentor Graphics@footnote{https://www.mentor.com}
@end itemize
@end quotation
@end itemize
@end quotation
@end itemize

@menu
* GNU GPLv2:: 
* CC-BY-SA:: 
* List of Contributors:: 

@end menu

@node GNU GPLv2,CC-BY-SA,,Copyrights | Licenses
@anchor{licenses gnu-gplv2}@anchor{22}@anchor{licenses lic-gplv2}@anchor{20}
@section GNU GPLv2


GHDL is copyright © 2002 - 2019 Tristan Gingold.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but @strong{WITHOUT ANY WARRANTY}; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License@footnote{https://www.gnu.org/licenses/old-licenses/gpl-2.0.html} for more details.

@node CC-BY-SA,List of Contributors,GNU GPLv2,Copyrights | Licenses
@anchor{licenses cc-by-sa}@anchor{23}@anchor{licenses lic-cc-by-sa}@anchor{21}
@section CC-BY-SA


This is a free documentation; you can redistribute it and/or modify it under the terms of the Creative Commons Attribution-ShareAlike 4.0@footnote{https://creativecommons.org/licenses/by-sa/4.0/} license. You are free to @strong{share} (copy and redistribute the material in any medium or format) and/or @strong{adapt} (remix, transform, and build upon the material for any purpose, even commercially). We cannot revoke these freedoms as long as you follow the these terms:


@itemize -

@item 
@strong{Attribution}: you must provide the name of the creator and attribution parties (more info@footnote{https://wiki.creativecommons.org/wiki/License_Versions#Detailed_attribution_comparison_chart}), a copyright notice, a license notice, a disclaimer notice, a link to the material, a link to the license and indicate if changes were made (see marking guide@footnote{https://wiki.creativecommons.org/wiki/Best_practices_for_attribution#This_is_a_good_attribution_for_material_you_modified_slightly} and more info@footnote{https://wiki.creativecommons.org/wiki/License_Versions#Modifications_and_adaptations_must_be_marked_as_such}). You may do so in any reasonable manner, but not in any way that suggests we endorse you or your use.

@item 
@strong{ShareAlike}: if you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.

@item 
@strong{No additional restrictions}: you may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
@end itemize

See CC-BY-SA-4.0 Legal Code@footnote{https://creativecommons.org/licenses/by-sa/4.0/legalcode.txt} for more details.

@node List of Contributors,,CC-BY-SA,Copyrights | Licenses
@anchor{licenses lic-contributors}@anchor{24}@anchor{licenses list-of-contributors}@anchor{25}
@section List of Contributors



@multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
@headitem

Contributor @footnote{
In alphabetical order
}

@tab

Role

@item

Baggett, Jonas

@tab

signal selection

@item

Bertram, Felix

@tab

VPI interface

@item

Davis, Brian

@tab

Windows Mcode builds

@item

Drummond, Brian

@tab

GCC 4.8.2 update, OSVVM port, some bugfixes

@item

Gingold, Tristan @footnote{
Maintainer
}

@tab

@strong{Sole author of GHDL as a whole}

@item

Jensen, Adam

@tab

FreeBSD builds

@item

Koch, Markus

@tab

vendor pre-compile script for Lattice (GNU/Linux)

@item

Koontz, David

@tab

Mac OSX builds, LRM compliance work, bugfix analyses

@item

Lehmann, Patrick

@tab

Windows compile scripts, vendor library pre-compile scripts (win+lin), building in MinGW, AppVeyor integration.

@item

Martinez-Corral, Unai

@tab

Docker builds, Travis-CI & Docker, adapt/fix RTD theme

@item

van Rantwijk, Joris

@tab

Debian packaging

@end multitable



Only those who made substantial contributions are shown in the table above, but many others contributed with minor patches. You can find a list at 
@image{/Users/gingold/devel/ghdl/doc/build/doctrees/images/6f8cd1a5e6840820b92af0cbdd95adc63019ebd5/ghdl,,,Contributors,svg}


With apologies to anyone who ought to be either on this table or in the GitHub contributor list, but isn’t. Thanks also to all those who have reported bugs and support issues, and often patches and testcases to either the late gna! website or sourceforge.net/p/ghdl-updates/tickets@footnote{https://sourceforge.net/p/ghdl-updates/tickets/}.


__________________________________________________________________


@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML

@node Quick Start Guide,Invoking GHDL,Copyrights | Licenses,Top
@anchor{using/QuickStartGuide doc}@anchor{26}@anchor{using/QuickStartGuide quick-start-guide}@anchor{27}@anchor{using/QuickStartGuide using-quickstart}@anchor{d}
@chapter Quick Start Guide


In this chapter, you will learn how to use @cite{GHDL} by working on a few examples.

@menu
* The ‘Hello world’ program:: 
* The heartbeat program:: 
* A full adder:: 
* Starting with a design:: 
* Starting with your design:: 

@end menu

@node The ‘Hello world’ program,The heartbeat program,,Quick Start Guide
@anchor{using/QuickStartGuide the-hello-world-program}@anchor{28}
@section The @cite{‘Hello world’} program


To illustrate the general purpose of @cite{VHDL}, here is a commented @cite{‘Hello world’} program which is saved in a file named @code{hello.vhdl}:

@example
--  Hello world program
use std.textio.all; -- Imports the standard textio package.

--  Defines a design entity, without any ports.
entity hello_world is
end hello_world;

architecture behaviour of hello_world is
begin
  process
    variable l : line;
  begin
    write (l, String'("Hello world!"));
    writeline (output, l);
    wait;
  end process;
end behaviour;
@end example

@cartouche
@quotation Tip 

@itemize *

@item 
Both @code{.vhdl} and @code{.vhd} extensions are used for VHDL source files, while @code{.v} is used for Verilog.

@item 
Unless you use especial characters, either @cite{UTF-8} or @cite{ISO-8859-1} encodings can be used. However, if you do, the latter should be used. The standard defines ASCII (7-bit encoding) or ISO Latin-1 (ISO-8859-1) as default. However, GHDL has a relaxing option, @ref{29,,--mb-comments} (multi byte), to allow UTF-8 or other encodings in comments.
@end itemize
@end quotation
@end cartouche


@itemize -

@item 
First, you have to compile the file; this is called @cite{analysis} of a design file in @cite{VHDL} terms. Run @code{ghdl -a hello.vhdl} in the @cite{shell}. This command creates or updates a file @code{work-obj93.cf}, which describes the library @code{work}.

@item 
Then, run @code{ghdl -e hello_world} in the @cite{shell}. Option @ref{2a,,-e} means @emph{elaborate}, which is used to build a design, with the @code{hello_world} entity at the top of the hierarchy.

@item 
Last, you can directly launch the simulation running @code{ghdl -r hello_world} in the @cite{shell}. The result of the simulation will be shown on screen:
@end itemize

@example
Hello world!
@end example

@cartouche
@quotation Hint 
If a GCC/LLVM variant of @cite{GHDL} is used:


@itemize *

@item 
@cite{Analysis} generates a file, @code{hello.o}, which is the object file corresponding to your @cite{VHDL} program. This is not created with mcode.

@item 
The elaboration step is mandatory after running the analysis and prior to launching the simulation. This will generate an executable binary named @code{hello_world}.

@item 
As a result, @ref{2b,,-r} is just a passthrough to the binary generated in the @cite{elaboration}. Therefore, the executable can be run directly, @code{./hello_world}. See @ref{2b,,-r} for more informartion.
@end itemize
@end quotation
@end cartouche

@cartouche
@quotation Hint 
@ref{2a,,-e} can be bypassed with mcode, since @ref{2b,,-r} actually elaborates the design and saves it on memory before running the simulation. But you can still use it to check for some elaboration problems.
@end quotation
@end cartouche

@node The heartbeat program,A full adder,The ‘Hello world’ program,Quick Start Guide
@anchor{using/QuickStartGuide the-heartbeat-program}@anchor{2c}
@section The @cite{heartbeat} program


@example
library ieee;
use ieee.std_logic_1164.all;

entity heartbeat is
  port ( clk: out std_logic);
end heartbeat;

architecture behaviour of heartbeat
is
  constant clk_period : time := 10 ns;
begin
  -- Clock process definition
  clk_process: process
  begin
    clk <= '0';
    wait for clk_period/2;
    clk <= '1';
    wait for clk_period/2;
  end process;
end behaviour;
@end example

@node A full adder,Starting with a design,The heartbeat program,Quick Start Guide
@anchor{using/QuickStartGuide a-full-adder}@anchor{2d}
@section A full adder


VHDL is generally used for hardware design. This example starts with a full adder@footnote{https://en.wikipedia.org/wiki/Adder_(electronics)#Full_adder} described in a file named @code{adder.vhdl}:

@example
entity adder is
  -- `i0`, `i1`, and the carry-in `ci` are inputs of the adder.
  -- `s` is the sum output, `co` is the carry-out.
  port (i0, i1 : in bit; ci : in bit; s : out bit; co : out bit);
end adder;

architecture rtl of adder is
begin
  --  This full-adder architecture contains two concurrent assignments.
  --  Compute the sum.
  s <= i0 xor i1 xor ci;
  --  Compute the carry.
  co <= (i0 and i1) or (i0 and ci) or (i1 and ci);
end rtl;
@end example

You can analyze this design file, @code{ghdl -a adder.vhdl}, and try to execute the @cite{adder} design. But this is useless, since nothing externally visible will happen. In order to check this full adder, a @emph{testbench} has to be run. This testbench is very simple, since the adder is also simple: it checks exhaustively all inputs. Note that only the behaviour is tested, timing constraints are not checked. A file named @code{adder_tb.vhdl} contains the testbench for the adder:

@example
--  A testbench has no ports.
entity adder_tb is
end adder_tb;

architecture behav of adder_tb is
  --  Declaration of the component that will be instantiated.
  component adder
    port (i0, i1 : in bit; ci : in bit; s : out bit; co : out bit);
  end component;

  --  Specifies which entity is bound with the component.
  for adder_0: adder use entity work.adder;
  signal i0, i1, ci, s, co : bit;
begin
  --  Component instantiation.
  adder_0: adder port map (i0 => i0, i1 => i1, ci => ci,
                           s => s, co => co);

  --  This process does the real job.
  process
    type pattern_type is record
      --  The inputs of the adder.
      i0, i1, ci : bit;
      --  The expected outputs of the adder.
      s, co : bit;
    end record;
    --  The patterns to apply.
    type pattern_array is array (natural range <>) of pattern_type;
    constant patterns : pattern_array :=
      (('0', '0', '0', '0', '0'),
       ('0', '0', '1', '1', '0'),
       ('0', '1', '0', '1', '0'),
       ('0', '1', '1', '0', '1'),
       ('1', '0', '0', '1', '0'),
       ('1', '0', '1', '0', '1'),
       ('1', '1', '0', '0', '1'),
       ('1', '1', '1', '1', '1'));
  begin
    --  Check each pattern.
    for i in patterns'range loop
      --  Set the inputs.
      i0 <= patterns(i).i0;
      i1 <= patterns(i).i1;
      ci <= patterns(i).ci;
      --  Wait for the results.
      wait for 1 ns;
      --  Check the outputs.
      assert s = patterns(i).s
        report "bad sum value" severity error;
      assert co = patterns(i).co
        report "bad carry out value" severity error;
    end loop;
    assert false report "end of test" severity note;
    --  Wait forever; this will finish the simulation.
    wait;
  end process;
end behav;
@end example

As usual, you should analyze the design, @code{ghdl -a adder_tb.vhdl}.

@cartouche
@quotation Hint 
Then, if required, elaborate the testbench: @code{ghdl -e adder_tb}. You do not need to specify which object files are required, since GHDL knows them and automatically adds them.
@end quotation
@end cartouche

Now, it is time to run the testbench, @code{ghdl -r adder_tb}, and check the result on screen:

@example
adder_tb.vhdl:52:7:(assertion note): end of test
@end example

If your design is rather complex, you’d like to inspect signals. Signal values can be dumped using multiple formats (see section @ref{2e,,Export waveforms} for more information). The resulting file can be read with a wave viewer such as GtkWave@footnote{http://gtkwave.sourceforge.net/}.

As explained in the manual@footnote{http://gtkwave.sourceforge.net/gtkwave.pdf}, GtkWave @emph{‘relies on a post-mortem approach through the use of dumpfiles’}. Therefore, you should first simulate your design and dump a waveform file, say VCD: @code{ghdl -r adder_tb --vcd=adder.vcd}. Then, you can view the dump: @code{gtkwave adder.vcd}.

See section @ref{2f,,Simulation options}, for more details on other runtime options.

@node Starting with a design,Starting with your design,A full adder,Quick Start Guide
@anchor{using/QuickStartGuide starting-with-a-design}@anchor{30}
@section Starting with a design


Unless you are only studying VHDL, you will work with larger designs than the ones of the previous examples. Let’s see how to analyze and run a bigger design, such as the DLX model suite written by Peter Ashenden which is distributed under the terms of the GNU General Public License. A copy is kept on ghdl.free.fr/dlx.tar.gz@footnote{http://ghdl.free.fr/dlx.tar.gz} .


@itemize -

@item 
First, untar the sources: @code{tar zxvf dlx.tar.gz}.
@end itemize

@cartouche
@quotation Hint 
In order not to pollute the sources with the library, it is a good idea to create a @code{work/} subdirectory for the @cite{WORK} library. To any GHDL commands, we will add the @code{--workdir=work} option, so that all files generated by the compiler (except the executable) will be placed in this directory.

@example
$ cd dlx
$ mkdir work
@end example
@end quotation
@end cartouche


@itemize *

@item 
Then, we will run the @code{dlx_test_behaviour} design. We need to analyze all the design units for the design hierarchy, in the correct order. GHDL provides an easy way to do this, by importing the sources, @code{ghdl -i --workdir=work *.vhdl}.

@item 
GHDL knows all the design units of the DLX, but none of them has been analyzed. Run the make option, @code{ghdl -m --workdir=work dlx_test_behaviour}, which analyzes and elaborates a design. This creates many files in the @code{work/} directory, and (GCC/LLVM only) the @code{dlx_test_behaviour} executable in the current directory.
@end itemize

@cartouche
@quotation Hint 
The simulation needs to have a DLX program contained in the file @code{dlx.out}. This memory image will be loaded in the DLX memory. Just take one sample: @code{cp test_loop.out dlx.out}.
@end quotation
@end cartouche


@itemize *

@item 
Now, you can run the test suite: @code{ghdl -r --workdir=work dlx_test_behaviour}. The test bench monitors the bus and displays each instruction executed. It finishes with an assertion of severity level note:

@example
dlx-behaviour.vhdl:395:11:(assertion note): TRAP instruction
 encountered, execution halted
@end example

@item 
Lastly, since the clock is still running, you have to manually stop the program with the @code{C-c} key sequence. This behavior prevents you from running the test bench in batch mode. However, you may force the simulator to stop when an assertion above or equal a certain severity level occurs. To do so, call run with this option instead: @code{ghdl -r --workdir=work dlx_test_behaviour --assert-level=note`}. With this option, the program stops just after the previous message:

@example
dlx-behaviour.vhdl:395:11:(assertion note): TRAP instruction
 encountered, execution halted
error: assertion failed
@end example
@end itemize

@cartouche
@quotation Tip 
If you want to make room on your hard drive, you can either:


@itemize *

@item 
Clean the design library with the GHDL command @code{ghdl --clean --workdir=work}. This removes the executable and all the object files. If you want to rebuild the design at this point, just do the make command as shown above.

@item 
Remove the design library with the GHDL command @code{ghdl --remove --workdir=work}. This removes the executable, all the object files and the library file. If you want to rebuild the design, you have to import the sources again and make the design.

@item 
Remove the @code{work/} directory: @code{rm -rf work}. Only the executable is kept. If you want to rebuild the design, create the @code{work/} directory, import the sources, and make the design.
@end itemize
@end quotation
@end cartouche

@cartouche
@quotation Warning 
Sometimes, a design does not fully follow the VHDL standards. For example it might use the badly engineered @code{std_logic_unsigned} package. GHDL supports this VHDL dialect through some options: @code{--ieee=synopsys -fexplicit}. See section @ref{14,,IEEE library pitfalls}, for more details.
@end quotation
@end cartouche

@node Starting with your design,,Starting with a design,Quick Start Guide
@anchor{using/QuickStartGuide starting-with-your-design}@anchor{31}
@section Starting with your design


Usually your design is more complex than the previous ones.  The main
tips are:


@itemize *

@item 
Don’t forget to select the VHDL standard you want to use.  The
default is @code{--std=93c} which means VHDL-93 with some relaxed
rules.  Use @code{--std=08} for VHDL-2008 (albeit not fully
implemented).  All the units must be analyzed with the same standard.

@item 
Use @code{--work=LIB_NAME} to analyze files into the @code{LIB_NAME} library.
If you analyze other files from a different directory, give the path
of the @code{LIB_NAME} library using @code{-P/path/to/name/directory/}.

@item 
Use @code{--ieee=synopsys} if your design depends on the non-standard
ieee library.

@item 
Use @code{-fexplicit} if needed.

@item 
Use the same options for elaboration.
@end itemize

So, to analyze a file: @code{ghdl -a --std=08 --work=mylib myfile.vhdl}
To elaborate and run: @code{ghdl --elab-run --std=08 top}.

@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML

@node Invoking GHDL,Simulation and runtime,Quick Start Guide,Top
@anchor{using/InvokingGHDL doc}@anchor{32}@anchor{using/InvokingGHDL invoking-ghdl}@anchor{33}@anchor{using/InvokingGHDL using-invoking}@anchor{e}
@chapter Invoking GHDL


The form of the @code{ghdl} command is @code{ghdl command [options...]}. There are multiple available commands, but these general rules apply:


@itemize *

@item 
The first argument selects the command. The options are used to slightly modify the action.

@item 
No option is allowed before the command. Except for the run command, no option is allowed after a filename or a unit name.
@end itemize

@cartouche
@quotation Hint 
If the number of options is large and the command line length is beyond the system limit, you can use a response file. An argument that starts with a @code{@@} is considered as a response file; it is replaced by arguments read from the file (separated by blanks and end of line).
@end quotation
@end cartouche

@cartouche
@quotation Hint 
Only the most common commands and options are shown here. For the most advanced and experimental features see section @ref{f,,Command Reference}.
@end quotation
@end cartouche

@cartouche
@quotation Warning 
During analysis and elaboration GHDL may read the @code{std} and @code{ieee} files. The location of these files is based on the prefix, which is (in order of priority):

@quotation


@itemize *

@item 
the @code{--PREFIX} command line option

@item 
the 
@geindex GHDL_PREFIX
@geindex environment variable; GHDL_PREFIX
@ref{34,,GHDL_PREFIX} environment variable

@item 
a built-in default path. It is a hard-coded path on GNU/Linux, and it corresponds to the value of the @code{HKLM\Software\Ghdl\Install_Dir} registry entry on Windows.
@end itemize

You should use the @ref{35,,--disp-config} command to display and debug installation problems.
@end quotation
@end quotation
@end cartouche

@menu
* Design building commands:: 
* Design rebuilding commands:: 
* Options:: 
* Warnings:: 
* Diagnostics Control:: 
* Library commands:: 
* VPI build commands:: 
* IEEE library pitfalls:: 

@end menu

@node Design building commands,Design rebuilding commands,,Invoking GHDL
@anchor{using/InvokingGHDL design-building-commands}@anchor{36}
@section Design building commands


The most commonly used commands of GHDL are those to analyze and elaborate a design.

@geindex cmd analysis

@menu
* Analysis [-a]:: 
* Elaboration [-e]:: 
* Run [-r]:: 
* Elaborate and run [--elab-run]:: 
* Check syntax [-s]:: 
* Analyze and elaborate [-c]:: 

@end menu

@node Analysis [-a],Elaboration [-e],,Design building commands
@anchor{using/InvokingGHDL analysis-a}@anchor{37}
@subsection Analysis [@code{-a}]


@geindex ghdl command line option; -a <[options...] file...>
@anchor{using/InvokingGHDL cmdoption-ghdl-a}@anchor{38}
@deffn {Option} @w{-}a <[options...] file...>
@end deffn

Analyzes/compiles one or more files, and creates an object file for each source file. Any argument starting with a dash is an option, the others are filenames. No options are allowed after a filename argument. GHDL analyzes each filename in the given order, and stops the analysis in case of error (remaining files are not analyzed).

See @ref{39,,Options}, for details on the GHDL options. For example, to produce debugging information such as line numbers, use: @code{ghdl -a -g my_design.vhdl}.

@geindex cmd elaboration

@node Elaboration [-e],Run [-r],Analysis [-a],Design building commands
@anchor{using/InvokingGHDL elaboration-command}@anchor{3a}@anchor{using/InvokingGHDL elaboration-e}@anchor{3b}
@subsection Elaboration [@code{-e}]


@geindex ghdl command line option; -e <[options...] primary_unit [secondary_unit]>
@anchor{using/InvokingGHDL cmdoption-ghdl-e}@anchor{2a}
@deffn {Option} @w{-}e <[options...] primary_unit [secondary_unit]>
@end deffn

Re-analyzes all the configurations, entities, architectures and package declarations, and creates the default configurations and the default binding indications according to the LRM rules. It also generates the list of object files required for the executable. Then, it links all these files with the runtime library.


@itemize *

@item 
The elaboration command, @ref{2a,,-e}, must be followed by a name of either:

@quotation


@itemize *

@item 
a configuration unit

@item 
an entity unit

@item 
an entity unit followed by a name of an architecture unit
@end itemize
@end quotation
@end itemize

Name of the units must be a simple name, without any dot. You can select the name of the @cite{WORK} library with the @code{--work=NAME} option, as described in @ref{39,,Options}. See section @ref{3c,,Top entity}, for the restrictions on the root design of a hierarchy.


@itemize *

@item 
If the GCC/LLVM backend was enabled during the compilation of GHDL, the elaboration command creates an executable containing the code of the VHDL sources, the elaboration code and simulation code to execute a design hierarchy. The executable is created in the current directory and the the filename is the name of the primary unit, or for the latter case, the concatenation of the name of the primary unit, a dash, and the name of the secondary unit (or architecture). Option @code{-o} followed by a filename can override the default executable filename.

@item 
If mcode is used, this command elaborates the design but does not generate anything. Since the run command also elaborates the design, this can be skipped.

@cartouche
@quotation Warning 
This elaboration command is not a complete elaboration in terms of the VHDL standard. The actual elaboration is performed at runtime. Therefore, in order to get a complete VHDL elaboration without running the simulation, @code{ghdl --elab-run --no-run} is required.
@end quotation
@end cartouche
@end itemize

@geindex cmd run

@node Run [-r],Elaborate and run [--elab-run],Elaboration [-e],Design building commands
@anchor{using/InvokingGHDL run-r}@anchor{3d}
@subsection Run [@code{-r}]


@geindex ghdl command line option; -r <[options...] primary_unit [secondary_unit] [simulation_options...]>
@anchor{using/InvokingGHDL cmdoption-ghdl-r}@anchor{2b}
@deffn {Option} @w{-}r <[options...] primary_unit [secondary_unit] [simulation_options...]>
@end deffn

Runs/simulates a design. The options and arguments are the same as for the elaboration command.


@itemize *

@item 
GGC/LLVM: simply, the filename of the executable is determined and it is executed. Options are ignored. You may also directly execute the program. The executable must be in the current directory.

@item 
mcode: the design is elaborated and the simulation is launched. As a consequence, you must use the same options used during analysis.
@end itemize

This command exists for three reasons:


@itemize *

@item 
You are using GCC/LLVM, but you don’t need to create the executable program name.

@item 
It is coherent with the @ref{38,,-a} and @ref{2a,,-e} commands.

@item 
It works with mcode implementation, where the executable code is generated in memory.
@end itemize

See section @ref{3e,,Simulation and runtime}, for details on options.

@geindex cmd elaborate and run

@node Elaborate and run [--elab-run],Check syntax [-s],Run [-r],Design building commands
@anchor{using/InvokingGHDL elaborate-and-run-elab-run}@anchor{3f}
@subsection Elaborate and run [@code{--elab-run}]


@geindex ghdl command line option; --elab-run <[elab_options...] primary_unit [secondary_unit] [run_options...]>
@anchor{using/InvokingGHDL cmdoption-ghdl-elab-run}@anchor{40}
@deffn {Option} @w{-}@w{-}elab@w{-}run <[elab_options...] primary_unit [secondary_unit] [run_options...]>
@end deffn

Acts like the elaboration command (see @ref{2a,,-e}) followed by the run command (see @ref{2b,,-r}).

@geindex cmd checking syntax

@node Check syntax [-s],Analyze and elaborate [-c],Elaborate and run [--elab-run],Design building commands
@anchor{using/InvokingGHDL check-syntax-s}@anchor{41}
@subsection Check syntax [@code{-s}]


@geindex ghdl command line option; -s <[options] files>
@anchor{using/InvokingGHDL cmdoption-ghdl-s}@anchor{42}
@deffn {Option} @w{-}s <[options] files>
@end deffn

Analyze files but do not generate code. This command may be used to check the syntax of files. It does not update the library.

@geindex cmd analyze and elaborate

@node Analyze and elaborate [-c],,Check syntax [-s],Design building commands
@anchor{using/InvokingGHDL analyze-and-elaborate-c}@anchor{43}
@subsection Analyze and elaborate [@code{-c}]


@geindex ghdl command line option; -c <[options] file... -<e|r> primary_unit [secondary_unit]>
@anchor{using/InvokingGHDL cmdoption-ghdl-c}@anchor{44}
@deffn {Option} @w{-}c <[options] file... @w{-}<e|r> primary_unit [secondary_unit]>
@end deffn

@cartouche
@quotation Hint 
With GCC/LLVM, @ref{2a,,-e} should be used, and @ref{2b,,-r} with mcode.
@end quotation
@end cartouche

The files are first parsed, and then a elaboration is performed, which drives an analysis. Effectively, analysis and elaboration are combined, but there is no explicit call to @ref{38,,-a}. With GCC/LLVM, code is generated during the elaboration. With mcode, the simulation is launched after the elaboration.

All the units of the files are put into the @cite{work} library. But, the work library is neither read from disk nor saved. Therefore, you must give all the files of the @cite{work} library your design needs.

The advantages over the traditional approach (analyze and then elaborate) are:


@itemize *

@item 
The compilation cycle is achieved in one command.

@item 
Since the files are only parsed once, the compilation cycle may be faster.

@item 
You don’t need to know an analysis order.

@item 
This command produces a smaller executable, since unused units and subprograms do not generate code.
@end itemize

@cartouche
@quotation Hint 
However, you should know that most of the time is spent in code generation and the analyze and elaborate command generates code for all units needed, even units of @code{std} and @code{ieee} libraries. Therefore, according to the design, the time for this command may be higher than the time for the analyze command followed by the elaborate command.
@end quotation
@end cartouche

@cartouche
@quotation Warning 
This command is still under development. In case of problems, you should go back to the traditional way.
@end quotation
@end cartouche

@node Design rebuilding commands,Options,Design building commands,Invoking GHDL
@anchor{using/InvokingGHDL design-rebuilding-commands}@anchor{45}
@section Design rebuilding commands


Analyzing and elaborating a design consisting of several files can be tricky, due to dependencies. GHDL has a few commands to rebuild a design.

@geindex cmd importing files

@menu
* Import [-i]:: 
* Make [-m]:: 
* Generate Makefile [--gen-makefile]:: 
* Generate dependency file command [--gen-depends]:: 

@end menu

@node Import [-i],Make [-m],,Design rebuilding commands
@anchor{using/InvokingGHDL import-i}@anchor{46}
@subsection Import [@code{-i}]


@geindex ghdl command line option; -i <[options] file...>
@anchor{using/InvokingGHDL cmdoption-ghdl-i}@anchor{47}
@deffn {Option} @w{-}i <[options] file...>
@end deffn

All the files specified in the command line are scanned, parsed and added into the libraries but as not yet analyzed. No object files are created. Its purpose is to localize design units in the design files. The make command will then be able to recursively build a hierarchy from an entity name or a configuration name.

@cartouche
@quotation Hint 

@itemize *

@item 
Note that all the files are added to the work library. If you have many libraries, you must use the command for each library.

@item 
Since the files are parsed, there must be correct files. However, since they are not analyzed, many errors are tolerated by this command.
@end itemize
@end quotation
@end cartouche

See @ref{48,,-m}, to actually build the design.

@geindex cmd make

@node Make [-m],Generate Makefile [--gen-makefile],Import [-i],Design rebuilding commands
@anchor{using/InvokingGHDL make-m}@anchor{49}
@subsection Make [@code{-m}]


@geindex ghdl command line option; -m <[options] primary [secondary]>
@anchor{using/InvokingGHDL cmdoption-ghdl-m}@anchor{48}
@deffn {Option} @w{-}m <[options] primary [secondary]>
@end deffn

Analyze automatically outdated files and elaborate a design. The primary unit denoted by the @code{primary} argument must already be known by the system, either because you have already analyzed it (even if you have modified it) or because you have imported it. A file may be outdated because it has been modified (e.g. you have just edited it), or because a design unit contained in the file depends on a unit which is outdated. This rule is of course recursive.


@itemize *

@item 
With option @ref{4a,,--bind}, GHDL will stop before the final linking step. This is useful when the main entry point is not GHDL and you’re linking GHDL object files into a foreign program.

@item 
With option @ref{4b,,-f} (force), GHDL analyzes all the units of the work library needed to create the design hierarchy. Outdated units are recompiled. This is useful if you want to compile a design hierarchy with new compilation flags (for example, to add the @emph{-g} debugging option).
@end itemize

The make command will only re-analyze design units in the work library. GHDL fails if it has to analyze an outdated unit from another library.

The purpose of this command is to be able to compile a design without prior knowledge of file order. In the VHDL model, some units must be analyzed before others (e.g. an entity before its architecture). It might be a nightmare to analyze a full design of several files if you don’t have the ordered list of files. This command computes an analysis order.

The make command fails when a unit was not previously parsed. For example, if you split a file containing several design units into several files, you must either import these new files or analyze them so that GHDL knows in which file these units are.

The make command imports files which have been modified. Then, a design hierarchy is internally built as if no units are outdated. Then, all outdated design units, using the dependencies of the design hierarchy, are analyzed. If necessary, the design hierarchy is elaborated.

This is not perfect, since the default architecture (the most recently analyzed one) may change while outdated design files are analyzed. In such a case, re-run the make command of GHDL.

@geindex cmd generate makefile

@node Generate Makefile [--gen-makefile],Generate dependency file command [--gen-depends],Make [-m],Design rebuilding commands
@anchor{using/InvokingGHDL generate-makefile-gen-makefile}@anchor{4c}
@subsection Generate Makefile [@code{--gen-makefile}]


@geindex ghdl command line option; --gen-makefile <[options] primary [secondary]>
@anchor{using/InvokingGHDL cmdoption-ghdl-gen-makefile}@anchor{4d}
@deffn {Option} @w{-}@w{-}gen@w{-}makefile <[options] primary [secondary]>
@end deffn

This command works like the make command (see @ref{48,,-m}), but only a makefile is generated on the standard output.

@geindex --gen-depends command

@node Generate dependency file command [--gen-depends],,Generate Makefile [--gen-makefile],Design rebuilding commands
@anchor{using/InvokingGHDL generate-dependency-file-command-gen-depends}@anchor{4e}
@subsection Generate dependency file command [@code{--gen-depends}]


@geindex ghdl command line option; --gen-depends <[options] primary [secondary]>
@anchor{using/InvokingGHDL cmdoption-ghdl-gen-depends}@anchor{4f}
@deffn {Option} @w{-}@w{-}gen@w{-}depends <[options] primary [secondary]>
@end deffn

Generate a Makefile containing only dependencies to build a design unit.

This command works like the make and gen-makefile commands (see @ref{48,,-m}), but instead of a full makefile only dependencies without rules are generated on the standard output.
Theses rules can then be integrated in another Makefile.

@node Options,Warnings,Design rebuilding commands,Invoking GHDL
@anchor{using/InvokingGHDL ghdl-options}@anchor{39}@anchor{using/InvokingGHDL options}@anchor{50}
@section Options


@geindex IEEE 1164

@geindex 1164

@geindex IEEE 1076.3

@geindex 1076.3

@cartouche
@quotation Hint 
Besides the options described below, @cite{GHDL} passes any debugging options (those that begin with @code{-g}) and optimizations options (those that begin with -O@footnote{https://docs.python.org/3.6/using/cmdline.html#cmdoption-o} or @ref{4b,,-f}) to @cite{GCC}. Refer to the @cite{GCC} manual for details.
@end quotation
@end cartouche

@geindex WORK library

@geindex ghdl command line option; --work=<LIB_NAME>
@anchor{using/InvokingGHDL cmdoption-ghdl-work}@anchor{51}
@deffn {Option} @w{-}@w{-}work=<LIB_NAME>

Specify the name of the @code{WORK} library. Analyzed units are always placed in the library logically named @code{WORK}. With this option, you can set its name. By default, the name is @code{work}.

@cite{GHDL} checks whether @code{WORK} is a valid identifier. Although being more or less supported, the @code{WORK} identifier should not be an extended identifier, since the filesystem may prevent it from working correctly (due to case sensitivity or forbidden characters in filenames).

@cite{VHDL} rules forbid you from adding units to the @code{std} library. Furthermore, you should not put units in the @code{ieee} library.
@end deffn

@geindex ghdl command line option; --workdir=<DIR>
@anchor{using/InvokingGHDL cmdoption-ghdl-workdir}@anchor{52}
@deffn {Option} @w{-}@w{-}workdir=<DIR>

Specify the directory where the @code{WORK} library is located. When this option is not present, the @code{WORK} library is in the current directory. The object files created by the compiler are always placed in the same directory as the @code{WORK} library.

Use option @code{-P} to specify where libraries other than @code{WORK} are placed.
@end deffn

@geindex ghdl command line option; --std=<STANDARD>
@anchor{using/InvokingGHDL cmdoption-ghdl-std}@anchor{53}
@deffn {Option} @w{-}@w{-}std=<STANDARD>

Specify the standard to use. By default, the standard is @code{93c}, which means VHDL-93 accepting VHDL-87 syntax. For details on @code{STANDARD} values see section @ref{54,,VHDL standards}.
@end deffn

@geindex ghdl command line option; --ieee=<IEEE_VAR>
@anchor{using/InvokingGHDL cmdoption-ghdl-ieee}@anchor{55}
@deffn {Option} @w{-}@w{-}ieee=<IEEE_VAR>

@geindex ieee library

@geindex synopsys library

@geindex mentor library

Select the @code{IEEE} library to use. @code{IEEE_VAR} must be one of:


@table @asis

@item none

Do not supply an @cite{IEEE} library. Any library clause with the @code{IEEE}
identifier will fail, unless you have created your own library with
the @cite{IEEE} name.

@item standard

Supply an @cite{IEEE} library containing only packages defined by
@code{ieee} standards. Currently, there are the multivalue logic system
package @code{std_logic_1164} defined by IEEE 1164, the synthesis
packages @code{numeric_bit} and @code{numeric_std} defined by IEEE
1076.3, and the @code{vital} packages @code{vital_timing} and
@code{vital_primitives}, defined by IEEE 1076.4. The version of these
packages is defined by the VHDL standard used. See section @ref{56,,VITAL packages},
for more details.

@item synopsys

Supply the former packages and the following additional packages:
@code{std_logic_arith}, @code{std_logic_signed},
@code{std_logic_unsigned}, @code{std_logic_textio}.

These packages were created by some companies, and are popular. However
they are not standard packages, and have been placed in the @cite{IEEE}
library without the permission from the @code{ieee}.

@item mentor

Supply the standard packages and the following additional package:
@code{std_logic_arith}. This package is a slight variation of a definitely
not standard but widely misused package.
@end table

To avoid errors, you must use the same @cite{IEEE} library for all units of
your design, and during elaboration.
@end deffn

@geindex ghdl command line option; -P<DIRECTORY>
@anchor{using/InvokingGHDL cmdoption-ghdl-p-directory}@anchor{57}
@deffn {Option} @w{-}P<DIRECTORY>

Add @cite{DIRECTORY} to the end of the list of directories to be searched for
library files. A library is searched in @cite{DIRECTORY} and also in
@cite{DIRECTORY/LIB/vVV} (where @cite{LIB} is the name of the library and @cite{VV}
the vhdl standard).

The @cite{WORK} library is always searched in the path specified by the
@ref{52,,--workdir} option, or in the current directory if the latter
option is not specified.
@end deffn

@geindex ghdl command line option; -fexplicit
@anchor{using/InvokingGHDL cmdoption-ghdl-fexplicit}@anchor{58}
@deffn {Option} @w{-}fexplicit

When two operators are overloaded, give preference to the explicit declaration.
This may be used to avoid the most common pitfall of the @code{std_logic_arith}
package. See section @ref{14,,IEEE library pitfalls}, for an example.
@end deffn

@cartouche
@quotation Warning 
This option is not set by default. I don’t think this option is a good feature, because it breaks the encapsulation rule. When set, an operator can be silently overridden in another package. You’d do better to fix your design and use the @code{numeric_std} package.
@end quotation
@end cartouche

@geindex ghdl command line option; -frelaxed-rules
@anchor{using/InvokingGHDL cmdoption-ghdl-frelaxed-rules}@anchor{59}
@deffn {Option} @w{-}frelaxed@w{-}rules

Within an object declaration, allow references to the name (which references the hidden declaration). This ignores the error in the following code:

@example
package pkg1 is
  type state is (state1, state2, state3);
end pkg1;

use work.pkg1.all;
package pkg2 is
  constant state1 : state := state1;
end pkg2;
@end example

Some code (such as Xilinx packages) have such constructs, which are valid.

(The scope of the @code{state1} constant starts at the @cite{constant} keyword. Because the constant @code{state1} and the enumeration literal @code{state1} are homographs, the enumeration literal is hidden in the immediate scope of the constant).

This option also relaxes the rules about pure functions. Violations result in warnings instead of errors.
@end deffn

@geindex ghdl command line option; -fpsl
@anchor{using/InvokingGHDL cmdoption-ghdl-fpsl}@anchor{5a}
@deffn {Option} @w{-}fpsl

Enable parsing of PSL assertions within comments. See section @ref{5b,,PSL implementation} for more details.
@end deffn

@geindex ghdl command line option; --no-vital-checks
@anchor{using/InvokingGHDL cmdoption-ghdl-no-vital-checks}@anchor{5c}
@deffn {Option} @w{-}@w{-}no@w{-}vital@w{-}checks
@end deffn

@geindex ghdl command line option; --vital-checks
@anchor{using/InvokingGHDL cmdoption-ghdl-vital-checks}@anchor{5d}
@deffn {Option} @w{-}@w{-}vital@w{-}checks

Disable or enable checks of restriction on VITAL units. Checks are enabled by default.

Checks are performed only when a design unit is decorated by a VITAL attribute. The VITAL attributes are @code{VITAL_Level0} and @code{VITAL_Level1}, both declared in the @code{ieee.VITAL_Timing} package.

Currently, VITAL checks are only partially implemented. See section @ref{5e,,VHDL restrictions for VITAL} for more details.
@end deffn

@geindex ghdl command line option; --PREFIX<=PATH>
@anchor{using/InvokingGHDL cmdoption-ghdl-prefix}@anchor{5f}
@deffn {Option} @w{-}@w{-}PREFIX<=PATH>

Use @code{PATH} as the prefix path to find commands and pre-installed (@code{std} and @code{ieee}) libraries.
@end deffn

@geindex ghdl command line option; -v
@anchor{using/InvokingGHDL cmdoption-ghdl-v}@anchor{60}
@deffn {Option} @w{-}v

Be verbose. For example, for analysis, elaboration and make commands, GHDL displays the commands executed.
@end deffn

@node Warnings,Diagnostics Control,Options,Invoking GHDL
@anchor{using/InvokingGHDL warnings}@anchor{61}
@section Warnings


Some constructions are not erroneous but dubious. Warnings are diagnostic messages that report such constructions. Some warnings are reported only during analysis, others during elaboration.

@cartouche
@quotation Hint 
You could disable a warning by using the @code{--warn-no-XXX} or @code{-Wno-XXX} instead of @code{--warn-XXX} or @code{-WXXX}.
@end quotation
@end cartouche

@cartouche
@quotation Hint 
The warnings @code{-Wbinding}, @code{-Wlibrary}, @code{-Wshared},
@code{-Wpure}, @code{-Wspecs}, @code{-Whide}, @code{-Wport} are enabled by
default.
@end quotation
@end cartouche

@geindex ghdl command line option; --warn-library
@anchor{using/InvokingGHDL cmdoption-ghdl-warn-library}@anchor{62}
@deffn {Option} @w{-}@w{-}warn@w{-}library

Warns if a design unit replaces another design unit with the same name.
@end deffn

@geindex ghdl command line option; --warn-default-binding
@anchor{using/InvokingGHDL cmdoption-ghdl-warn-default-binding}@anchor{63}
@deffn {Option} @w{-}@w{-}warn@w{-}default@w{-}binding

During analyze, warns if a component instantiation has neither configuration specification nor default binding. This may be useful if you want to detect during analyze possibly unbound components if you don’t use configuration. See section @ref{54,,VHDL standards} for more details about default binding rules.
@end deffn

@geindex ghdl command line option; --warn-binding
@anchor{using/InvokingGHDL cmdoption-ghdl-warn-binding}@anchor{64}
@deffn {Option} @w{-}@w{-}warn@w{-}binding

During elaboration, warns if a component instantiation is not bound (and not explicitly left unbound). Also warns if a port of an entity is not bound in a configuration specification or in a component configuration. This warning is enabled by default, since default binding rules are somewhat complex and an unbound component is most often unexpected.

However, warnings are still emitted if a component instantiation is inside a generate statement. As a consequence, if you use the conditional generate statement to select a component according to the implementation, you will certainly get warnings.
@end deffn

@geindex ghdl command line option; --warn-reserved
@anchor{using/InvokingGHDL cmdoption-ghdl-warn-reserved}@anchor{65}
@deffn {Option} @w{-}@w{-}warn@w{-}reserved

Emit a warning if an identifier is a reserved word in a later VHDL standard.
@end deffn

@geindex ghdl command line option; --warn-nested-comment
@anchor{using/InvokingGHDL cmdoption-ghdl-warn-nested-comment}@anchor{66}
@deffn {Option} @w{-}@w{-}warn@w{-}nested@w{-}comment

Emit a warning if a @code{/*} appears within a block comment (vhdl 2008).
@end deffn

@geindex ghdl command line option; --warn-parenthesis
@anchor{using/InvokingGHDL cmdoption-ghdl-warn-parenthesis}@anchor{67}
@deffn {Option} @w{-}@w{-}warn@w{-}parenthesis

Emit a warning in case of weird use of parentheses.
@end deffn

@geindex ghdl command line option; --warn-vital-generic
@anchor{using/InvokingGHDL cmdoption-ghdl-warn-vital-generic}@anchor{68}
@deffn {Option} @w{-}@w{-}warn@w{-}vital@w{-}generic

Warns if a generic name of a vital entity is not a vital generic name. This
is set by default.
@end deffn

@geindex ghdl command line option; --warn-delayed-checks
@anchor{using/InvokingGHDL cmdoption-ghdl-warn-delayed-checks}@anchor{69}
@deffn {Option} @w{-}@w{-}warn@w{-}delayed@w{-}checks

Warns for checks that cannot be done during analysis time and are postponed to elaboration time. This is because not all procedure bodies are available during analysis (either because a package body has not yet been analysed or because @cite{GHDL} doesn’t read not required package bodies).

These are checks for no wait statements in a procedure called in a sensitized process and checks for pure rules of a function.
@end deffn

@geindex ghdl command line option; --warn-body
@anchor{using/InvokingGHDL cmdoption-ghdl-warn-body}@anchor{6a}
@deffn {Option} @w{-}@w{-}warn@w{-}body

Emit a warning if a package body which is not required is analyzed. If a package does not declare a subprogram or a deferred constant, the package does not require a body.
@end deffn

@geindex ghdl command line option; --warn-specs
@anchor{using/InvokingGHDL cmdoption-ghdl-warn-specs}@anchor{6b}
@deffn {Option} @w{-}@w{-}warn@w{-}specs

Emit a warning if an all or others specification does not apply.
@end deffn

@geindex ghdl command line option; --warn-runtime-error
@anchor{using/InvokingGHDL cmdoption-ghdl-warn-runtime-error}@anchor{6c}
@deffn {Option} @w{-}@w{-}warn@w{-}runtime@w{-}error

Emit a warning in case of runtime error that is detected during
analysis.
@end deffn

@geindex ghdl command line option; --warn-shared
@anchor{using/InvokingGHDL cmdoption-ghdl-warn-shared}@anchor{6d}
@deffn {Option} @w{-}@w{-}warn@w{-}shared

Emit a warning when a shared variable is declared and its type it
not a protected type.
@end deffn

@geindex ghdl command line option; --warn-hide
@anchor{using/InvokingGHDL cmdoption-ghdl-warn-hide}@anchor{6e}
@deffn {Option} @w{-}@w{-}warn@w{-}hide

Emit a warning when a declaration hides a previous hide.
@end deffn

@geindex ghdl command line option; --warn-unused
@anchor{using/InvokingGHDL cmdoption-ghdl-warn-unused}@anchor{6f}
@deffn {Option} @w{-}@w{-}warn@w{-}unused

Emit a warning when a subprogram is never used.
@end deffn

@geindex ghdl command line option; --warn-others
@anchor{using/InvokingGHDL cmdoption-ghdl-warn-others}@anchor{70}
@deffn {Option} @w{-}@w{-}warn@w{-}others

Emit a warning is an @cite{others} choice is not required because all the
choices have been explicitly covered.
@end deffn

@geindex ghdl command line option; --warn-pure
@anchor{using/InvokingGHDL cmdoption-ghdl-warn-pure}@anchor{71}
@deffn {Option} @w{-}@w{-}warn@w{-}pure

Emit a warning when a pure rules is violated (like declaring a pure
function with access parameters).
@end deffn

@geindex ghdl command line option; --warn-static
@anchor{using/InvokingGHDL cmdoption-ghdl-warn-static}@anchor{72}
@deffn {Option} @w{-}@w{-}warn@w{-}static

Emit a warning when a non-static expression is used at a place where
the standard requires a static expression.
@end deffn

@geindex ghdl command line option; --warn-error
@anchor{using/InvokingGHDL cmdoption-ghdl-warn-error}@anchor{73}
@deffn {Option} @w{-}@w{-}warn@w{-}error

When this option is set, warnings are considered as errors.
@end deffn

@node Diagnostics Control,Library commands,Warnings,Invoking GHDL
@anchor{using/InvokingGHDL diagnostics-control}@anchor{74}
@section Diagnostics Control


@geindex ghdl command line option; -fcolor-diagnostics
@anchor{using/InvokingGHDL cmdoption-ghdl-fcolor-diagnostics}@anchor{75}
@deffn {Option} @w{-}fcolor@w{-}diagnostics
@end deffn

@geindex ghdl command line option; -fno-color-diagnostics
@anchor{using/InvokingGHDL cmdoption-ghdl-fno-color-diagnostics}@anchor{76}
@deffn {Option} @w{-}fno@w{-}color@w{-}diagnostics

Control whether diagnostic messages are displayed in color. The default is on when the standard output is a terminal.
@end deffn

@geindex ghdl command line option; -fdiagnostics-show-option
@anchor{using/InvokingGHDL cmdoption-ghdl-fdiagnostics-show-option}@anchor{77}
@deffn {Option} @w{-}fdiagnostics@w{-}show@w{-}option
@end deffn

@geindex ghdl command line option; -fno-diagnostics-show-option
@anchor{using/InvokingGHDL cmdoption-ghdl-fno-diagnostics-show-option}@anchor{78}
@deffn {Option} @w{-}fno@w{-}diagnostics@w{-}show@w{-}option

Control whether the warning option is displayed at the end of warning messages, so that the user can easily know how to disable it.
@end deffn

@geindex ghdl command line option; -fcaret-diagnostics
@anchor{using/InvokingGHDL cmdoption-ghdl-fcaret-diagnostics}@anchor{79}
@deffn {Option} @w{-}fcaret@w{-}diagnostics
@end deffn

@geindex ghdl command line option; -fno-caret-diagnostics
@anchor{using/InvokingGHDL cmdoption-ghdl-fno-caret-diagnostics}@anchor{7a}
@deffn {Option} @w{-}fno@w{-}caret@w{-}diagnostics

Control whether the source line of the error is displayed with a
caret indicating the column of the error.
@end deffn

@node Library commands,VPI build commands,Diagnostics Control,Invoking GHDL
@anchor{using/InvokingGHDL library-commands}@anchor{7b}
@section Library commands

@anchor{using/InvokingGHDL create-a-library}@anchor{7c}
@geindex create your own library

A new library is created implicitly, by compiling entities (packages etc.) into it: @code{ghdl -a --work=my_custom_lib my_file.vhd}.

A library’s source code is usually stored and compiled into its own directory, that you specify with the @ref{52,,--workdir} option: @code{ghdl -a --work=my_custom_lib --workdir=my_custom_libdir my_custom_lib_srcdir/my_file.vhd}. See also the @code{-P} command line option.

Furthermore, GHDL provides a few commands which act on a library:

@geindex cmd library directory

@menu
* Directory [--dir]:: 
* Clean [--clean]:: 
* Remove [--remove]:: 
* Copy [--copy]:: 

@end menu

@node Directory [--dir],Clean [--clean],,Library commands
@anchor{using/InvokingGHDL directory-dir}@anchor{7d}
@subsection Directory [@code{--dir}]


@geindex ghdl command line option; --dir <[options] [libs]>
@anchor{using/InvokingGHDL cmdoption-ghdl-dir}@anchor{7e}
@deffn {Option} @w{-}@w{-}dir <[options] [libs]>
@end deffn

Displays the content of the design libraries (by default the @code{work} library). All options are allowed, but only a few are meaningful: @ref{51,,--work}, @ref{52,,--workdir} and @ref{53,,--std}.

@geindex cmd library clean

@node Clean [--clean],Remove [--remove],Directory [--dir],Library commands
@anchor{using/InvokingGHDL clean-clean}@anchor{7f}
@subsection Clean [@code{--clean}]


@geindex ghdl command line option; --clean <[options]>
@anchor{using/InvokingGHDL cmdoption-ghdl-clean}@anchor{80}
@deffn {Option} @w{-}@w{-}clean <[options]>
@end deffn

Try to remove any object, executable or temporary file it could have created. Source files are not removed. The library is kept.

@geindex cmd library remove

@node Remove [--remove],Copy [--copy],Clean [--clean],Library commands
@anchor{using/InvokingGHDL remove-remove}@anchor{81}
@subsection Remove [@code{--remove}]


@geindex ghdl command line option; --remove <[options]>
@anchor{using/InvokingGHDL cmdoption-ghdl-remove}@anchor{82}
@deffn {Option} @w{-}@w{-}remove <[options]>
@end deffn

Acts like the clean command but removes the library too. Note that after removing a design library, the files are not
known anymore by GHDL.

@geindex cmd library copy

@node Copy [--copy],,Remove [--remove],Library commands
@anchor{using/InvokingGHDL copy-copy}@anchor{83}
@subsection Copy [@code{--copy}]


@geindex ghdl command line option; --copy <--work=name [options]>
@anchor{using/InvokingGHDL cmdoption-ghdl-copy}@anchor{84}
@deffn {Option} @w{-}@w{-}copy <@w{-}@w{-}work=name [options]>
@end deffn

Make a local copy of an existing library. This is very useful if you want to add units to the @code{ieee} library:

@example
ghdl --copy --work=ieee --ieee=synopsys
ghdl -a --work=ieee numeric_unsigned.vhd
@end example

@node VPI build commands,IEEE library pitfalls,Library commands,Invoking GHDL
@anchor{using/InvokingGHDL id1}@anchor{85}@anchor{using/InvokingGHDL vpi-build-commands}@anchor{86}
@section VPI build commands


These commands simplify the compile and the link of a user vpi module. They are all wrappers: the arguments are in fact a whole command line that is executed with additional switches. Currently a unix-like compiler (like @cite{cc}, @cite{gcc} or @cite{clang}) is expected: the additional switches use their syntax. The only option is @cite{-v} which displays the
command before its execution.

@geindex cmd VPI compile

@menu
* compile [--vpi-compile]:: 
* link [--vpi-link]:: 
* cflags [--vpi-cflags]:: 
* ldflags [--vpi-ldflags]:: 
* include dir [--vpi-include-dir]:: 
* library dir [--vpi-library-dir]:: 

@end menu

@node compile [--vpi-compile],link [--vpi-link],,VPI build commands
@anchor{using/InvokingGHDL compile-vpi-compile}@anchor{87}
@subsection compile [@code{--vpi-compile}]


@geindex ghdl command line option; --vpi-compile <command>
@anchor{using/InvokingGHDL cmdoption-ghdl-vpi-compile}@anchor{88}
@deffn {Option} @w{-}@w{-}vpi@w{-}compile <command>
@end deffn

Add an include path to the command and execute it:

@example
ghdl --vpi-compile command
@end example

This will execute:

@example
command -Ixxx/include
@end example

For example:

@example
ghdl --vpi-compile gcc -c vpi1.c
@end example

executes:

@example
gcc -c vpi1.c -fPIC -Ixxx/include
@end example
@anchor{using/InvokingGHDL vpi-link-command}@anchor{89}
@geindex cmd VPI link

@node link [--vpi-link],cflags [--vpi-cflags],compile [--vpi-compile],VPI build commands
@anchor{using/InvokingGHDL link-vpi-link}@anchor{8a}
@subsection link [@code{--vpi-link}]


@geindex ghdl command line option; --vpi-link <command>
@anchor{using/InvokingGHDL cmdoption-ghdl-vpi-link}@anchor{8b}
@deffn {Option} @w{-}@w{-}vpi@w{-}link <command>
@end deffn

Add a library path and name to the command and execute it:

@example
ghdl --vpi-link command
@end example

This will execute:

@example
command -Lxxx/lib -lghdlvpi
@end example

For example:

@example
ghdl --vpi-link gcc -o vpi1.vpi vpi1.o
@end example

executes:

@example
gcc -o vpi1.vpi vpi1.o --shared -Lxxx/lib -lghdlvpi
@end example
@anchor{using/InvokingGHDL vpi-cflags-command}@anchor{8c}
@geindex cmd VPI cflags

@node cflags [--vpi-cflags],ldflags [--vpi-ldflags],link [--vpi-link],VPI build commands
@anchor{using/InvokingGHDL cflags-vpi-cflags}@anchor{8d}
@subsection cflags [@code{--vpi-cflags}]


@geindex ghdl command line option; --vpi-cflags
@anchor{using/InvokingGHDL cmdoption-ghdl-vpi-cflags}@anchor{8e}
@deffn {Option} @w{-}@w{-}vpi@w{-}cflags
@end deffn

Display flags added by @ref{88,,--vpi-compile}.

@geindex cmd VPI ldflags

@node ldflags [--vpi-ldflags],include dir [--vpi-include-dir],cflags [--vpi-cflags],VPI build commands
@anchor{using/InvokingGHDL ldflags-vpi-ldflags}@anchor{8f}
@subsection ldflags [@code{--vpi-ldflags}]


@geindex ghdl command line option; --vpi-ldflags
@anchor{using/InvokingGHDL cmdoption-ghdl-vpi-ldflags}@anchor{90}
@deffn {Option} @w{-}@w{-}vpi@w{-}ldflags
@end deffn

Display flags added by @ref{8b,,--vpi-link}.

@geindex cmd VPI include dir

@node include dir [--vpi-include-dir],library dir [--vpi-library-dir],ldflags [--vpi-ldflags],VPI build commands
@anchor{using/InvokingGHDL include-dir-vpi-include-dir}@anchor{91}
@subsection include dir [@code{--vpi-include-dir}]


@geindex ghdl command line option; --vpi-include-dir
@anchor{using/InvokingGHDL cmdoption-ghdl-vpi-include-dir}@anchor{92}
@deffn {Option} @w{-}@w{-}vpi@w{-}include@w{-}dir
@end deffn

Display the include directory added by the compile flags.

@geindex cmd VPI library dir

@node library dir [--vpi-library-dir],,include dir [--vpi-include-dir],VPI build commands
@anchor{using/InvokingGHDL library-dir-vpi-library-dir}@anchor{93}
@subsection library dir [@code{--vpi-library-dir}]


@geindex ghdl command line option; --vpi-library-dir
@anchor{using/InvokingGHDL cmdoption-ghdl-vpi-library-dir}@anchor{94}
@deffn {Option} @w{-}@w{-}vpi@w{-}library@w{-}dir
@end deffn

Display the library directory added by the link flags.

@node IEEE library pitfalls,,VPI build commands,Invoking GHDL
@anchor{using/InvokingGHDL id2}@anchor{95}@anchor{using/InvokingGHDL ieee-library-pitfalls}@anchor{14}
@section IEEE library pitfalls


When you use options @code{--ieee=synopsys} or @code{--ieee=mentor}, the @code{ieee} library contains non standard packages such as @code{std_logic_arith}. These packages are not standard because there are not described by an IEEE standard, even if they have been put in the @cite{IEEE} library. Furthermore, they are not really de-facto standard, because there are slight differences between the packages of Mentor and those of Synopsys. Furthermore, since they are not well thought out, their use has pitfalls. For example, this description has an error during compilation:

@example
library ieee;
use ieee.std_logic_1164.all;

--  A counter from 0 to 10.
entity counter is
  port (val : out std_logic_vector (3 downto 0);
        ck : std_logic;
        rst : std_logic);
end counter;

library ieee;
use ieee.std_logic_unsigned.all;

architecture bad of counter
is
  signal v : std_logic_vector (3 downto 0);
begin
  process (ck, rst)
  begin
    if rst = '1' then
      v <= x"0";
    elsif rising_edge (ck) then
      if v = "1010" then -- Error
        v <= x"0";
      else
        v <= v + 1;
      end if;
    end if;
  end process;

  val <= v;
end bad;
@end example

When you analyze this design, GHDL does not accept it (two long lines have been split for readability):

@example
ghdl -a --ieee=synopsys bad_counter.vhdl
bad_counter.vhdl:13:14: operator "=" is overloaded
bad_counter.vhdl:13:14: possible interpretations are:
../../libraries/ieee/std_logic_1164.v93:69:5: implicit function "="
    [std_logic_vector, std_logic_vector return boolean]
../../libraries/synopsys/std_logic_unsigned.vhdl:64:5: function "="
    [std_logic_vector, std_logic_vector return boolean]
../translate/ghdldrv/ghdl: compilation error
@end example

Indeed, the @cite{“=”} operator is defined in both packages, and both are visible at the place it is used. The first declaration is an implicit one, which occurs when the @cite{std_logic_vector} type is declared and is an element to element comparison. The second one is an explicit declared function, with the semantics of an unsigned comparison.

With some analysers, the explicit declaration has priority over the implicit declaration, and this design can be analyzed without error. However, this is not the rule given by the VHDL LRM, and since GHDL follows these rules,
it emits an error.

You can force GHDL to use this rule with the @emph{-fexplicit} option (see @ref{39,,Options} for further details). However it is easy to fix this error, by using a selected name:

@example
library ieee;
use ieee.std_logic_unsigned.all;

architecture fixed_bad of counter
is
  signal v : std_logic_vector (3 downto 0);
begin
  process (ck, rst)
  begin
    if rst = '1' then
      v <= x"0";
    elsif rising_edge (ck) then
      if ieee.std_logic_unsigned."=" (v, "1010") then
        v <= x"0";
      else
        v <= v + 1;
      end if;
    end if;
  end process;

  val <= v;
end fixed_bad;
@end example

It is better to only use the standard packages defined by IEEE, which provide the same functionalities:

@example
library ieee;
use ieee.numeric_std.all;

architecture good of counter
is
  signal v : unsigned (3 downto 0);
begin
  process (ck, rst)
  begin
    if rst = '1' then
      v <= x"0";
    elsif rising_edge (ck) then
      if v = "1010" then
        v <= x"0";
      else
        v <= v + 1;
      end if;
    end if;
  end process;

  val <= std_logic_vector (v);
end good;
@end example

@geindex Math_Real

@geindex Math_Complex

@cartouche
@quotation Hint 
The @code{ieee} math packages (@code{math_real} and @code{math_complex}) provided with @cite{GHDL} are fully compliant with the @cite{IEEE} standard.
@end quotation
@end cartouche

@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML

@node Simulation and runtime,Interfacing to other languages,Invoking GHDL,Top
@anchor{using/Simulation doc}@anchor{96}@anchor{using/Simulation simulation-and-runtime}@anchor{97}@anchor{using/Simulation using-simulation}@anchor{3e}
@chapter Simulation and runtime


@menu
* Simulation options:: 
* Export waveforms:: 
* Export hierarchy and references:: 
* Debugging:: 

@end menu

@node Simulation options,Export waveforms,,Simulation and runtime
@anchor{using/Simulation id1}@anchor{98}@anchor{using/Simulation simulation-options}@anchor{2f}
@section Simulation options


In most system environments, it is possible to pass options while
invoking a program. Contrary to most programming languages, there is no
standard method in VHDL to obtain the arguments or to set the exit
status.

However, the GHDL runtime behaviour can be modified with some options. For
example, it is possible to pass parameters to your design through the generic
interfaces of the top entity. It is also possible to stop simulation after a
certain time.

The exit status of the simulation is @code{EXIT_SUCCESS} (0) if the
simulation completes, or @code{EXIT_FAILURE} (1) in case of error
(assertion failure, overflow or any constraint error).

Here is the list of the most useful options. Some debugging options are
also available, but not described here. The @ref{99,,--help} option lists
all options available, including the debugging ones.

@geindex ghdl command line option; -gGENERIC=VALUE
@anchor{using/Simulation cmdoption-ghdl-ggeneric}@anchor{9a}
@deffn {Option} @w{-}gGENERIC=VALUE

Set value @cite{VALUE} to generic with name @cite{GENERIC}.

@cartouche
@quotation Warning 
This is currently a run option; but in the future it will be deprecated to
become an elaboration option only.
@end quotation
@end cartouche
@end deffn

@geindex ghdl command line option; --assert-level<=LEVEL>
@anchor{using/Simulation cmdoption-ghdl-assert-level}@anchor{9b}
@deffn {Option} @w{-}@w{-}assert@w{-}level<=LEVEL>

Select the assertion level at which an assertion violation stops the
simulation. @cite{LEVEL} is the name from the @cite{severity_level}
enumerated type defined in the @cite{standard} package or the
@code{none} name.

By default, only assertion violation of severity level @code{failure}
stops the simulation.

For example, if @cite{LEVEL} was @code{warning}, any assertion violation
with severity level @code{warning}, @code{error} or @code{failure} would
stop simulation, but the assertion violation at the @code{note} severity
level would only display a message.

Option @code{--assert-level=none} prevents any assertion violation from stopping
simulation.
@end deffn

@geindex ghdl command line option; --ieee-asserts<=POLICY>
@anchor{using/Simulation cmdoption-ghdl-ieee-asserts}@anchor{9c}
@deffn {Option} @w{-}@w{-}ieee@w{-}asserts<=POLICY>

Select how the assertions from @code{ieee} units are
handled. @cite{POLICY} can be @code{enable} (the default),
@code{disable} which disables all assertions from @code{ieee} packages
and @code{disable-at-0} which disables only at the start of simulation.

This option can be useful to avoid assertion messages from
@code{ieee.numeric_std} (and other @code{ieee} packages).
@end deffn

@geindex ghdl command line option; --stop-time<=TIME>
@anchor{using/Simulation cmdoption-ghdl-stop-time}@anchor{9d}
@deffn {Option} @w{-}@w{-}stop@w{-}time<=TIME>

Stop the simulation after @code{TIME}. @code{TIME} is expressed as a time
value, @emph{without} any space. The time is the simulation time, not
the real clock time.

For example:

@example
$ ./my_design --stop-time=10ns
$ ./my_design --stop-time=ps
@end example
@end deffn

@geindex ghdl command line option; --stop-delta<=N>
@anchor{using/Simulation cmdoption-ghdl-stop-delta}@anchor{9e}
@deffn {Option} @w{-}@w{-}stop@w{-}delta<=N>

Stop the simulation after @cite{N} delta cycles in the same current
time.  The default is 5000.

@geindex display time
@end deffn

@geindex ghdl command line option; --disp-time
@anchor{using/Simulation cmdoption-ghdl-disp-time}@anchor{9f}
@deffn {Option} @w{-}@w{-}disp@w{-}time

Display the time and delta cycle number as simulation advances.
@end deffn

@geindex ghdl command line option; --unbuffered
@anchor{using/Simulation cmdoption-ghdl-unbuffered}@anchor{a0}
@deffn {Option} @w{-}@w{-}unbuffered

Disable buffering on stdout, stderr and files opened in write or append mode (TEXTIO).
@end deffn

@geindex ghdl command line option; --max-stack-alloc<=N>
@anchor{using/Simulation cmdoption-ghdl-max-stack-alloc}@anchor{a1}
@deffn {Option} @w{-}@w{-}max@w{-}stack@w{-}alloc<=N>

Emit an error message in case of allocation on the stack of an
object larger than @cite{N} KB.  Use 0 to disable these checks.
@end deffn

@geindex ghdl command line option; --sdf<=PATH=FILENAME>
@anchor{using/Simulation cmdoption-ghdl-sdf}@anchor{a2}
@deffn {Option} @w{-}@w{-}sdf<=PATH=FILENAME>

Do VITAL annotation on @cite{PATH} with SDF file @code{FILENAME}.

@cite{PATH} is a path of instances, separated with @code{.} or @code{/}.
Any separator can be used. Instances are component instantiation labels,
generate labels or block labels. Currently, you cannot use an indexed name.

Specifying a delay:

@example
--sdf=min=PATH=FILENAME
--sdf=typ=PATH=FILENAME
--sdf=max=PATH=FILENAME
@end example

If the option contains a type of delay, that is @code{min=},
@code{typ=} or @code{max=}, the annotator use respectively minimum,
typical or maximum values. If the option does not contain a type of delay,
the annotator uses the typical delay.

See section @ref{a3,,Backannotation}, for more details.
@end deffn

@geindex ghdl command line option; --vpi<=FILENAME>
@anchor{using/Simulation cmdoption-ghdl-vpi}@anchor{a4}
@deffn {Option} @w{-}@w{-}vpi<=FILENAME>

Load VPI module.
@end deffn

@geindex ghdl command line option; --vpi-trace<=FILE>
@anchor{using/Simulation cmdoption-ghdl-vpi-trace}@anchor{a5}
@deffn {Option} @w{-}@w{-}vpi@w{-}trace<=FILE>

Trace vpi calls to FILE.
@end deffn

@geindex ghdl command line option; --help
@anchor{using/Simulation cmdoption-ghdl-help}@anchor{99}
@deffn {Option} @w{-}@w{-}help

Display a short description of the options accepted by the runtime library.
@end deffn

@node Export waveforms,Export hierarchy and references,Simulation options,Simulation and runtime
@anchor{using/Simulation export-waveforms}@anchor{a6}@anchor{using/Simulation export-waves}@anchor{2e}
@section Export waveforms


@geindex ghdl command line option; --read-wave-opt=<FILENAME>
@anchor{using/Simulation cmdoption-ghdl-read-wave-opt}@anchor{a7}
@deffn {Option} @w{-}@w{-}read@w{-}wave@w{-}opt=<FILENAME>

Filter signals to be dumped to the wave file according to the wave option
file provided.

Here is a description of the wave option file format currently supported

@example
$ version = 1.1  # Optional

# Path format for signals in packages :
my_pkg.global_signal_a

# Path format for signals in entities :
/top/sub/clk

# Dump every signal named reset in first level sub entities of top
/top/*/reset

# Dump every signal named reset in recursive sub entities of top
/top/**/reset

# Dump every signal of sub2 which could be anywhere in the design except
# on the top level
/**/sub2/*

# Dump every signal of sub3 which must be a first level sub entity of the
# top level
/*/sub3/*

# Dump every signal of the first level sub entities of sub3 (but not
# those of sub3)
/**/sub3/*/*
@end example
@end deffn

@geindex ghdl command line option; --write-wave-opt=<FILENAME>
@anchor{using/Simulation cmdoption-ghdl-write-wave-opt}@anchor{a8}
@deffn {Option} @w{-}@w{-}write@w{-}wave@w{-}opt=<FILENAME>

If the wave option file doesn’t exist, creates it with all the signals of
the design. Otherwise throws an error, because it won’t erase an existing
file.
@end deffn

@geindex ghdl command line option; --vcd<=FILENAME>
@anchor{using/Simulation cmdoption-ghdl-vcd}@anchor{a9}
@deffn {Option} @w{-}@w{-}vcd<=FILENAME>
@end deffn

@geindex ghdl command line option; --vcdgz<=FILENAME>
@anchor{using/Simulation cmdoption-ghdl-vcdgz}@anchor{aa}
@deffn {Option} @w{-}@w{-}vcdgz<=FILENAME>

@geindex vcd

@geindex value change dump

@geindex dump of signals

Option @code{--vcd} dumps into the VCD file @cite{FILENAME} the signal
values before each non-delta cycle. If @cite{FILENAME} is @code{-},
then the standard output is used, otherwise a file is created or
overwritten.

The @code{--vcdgz} option is the same as the @emph{–vcd} option,
but the output is compressed using the @cite{zlib} (@cite{gzip}
compression). However, you can’t use the @code{-} filename.
Furthermore, only one VCD file can be written.

@emph{VCD} (value change dump) is a file format defined
by the @cite{verilog} standard and used by virtually any wave viewer.

Since it comes from @cite{verilog}, only a few VHDL types can be dumped. GHDL
dumps only signals whose base type is of the following:


@itemize *

@item 
types defined in the @code{std.standard} package:


@itemize *

@item 
@code{bit}

@item 
@code{bit_vector}
@end itemize

@item 
types defined in the @code{ieee.std_logic_1164} package:


@itemize *

@item 
@code{std_ulogic}

@item 
@code{std_logic} (because it is a subtype of @code{std_ulogic})

@item 
@code{std_ulogic_vector}

@item 
@code{std_logic_vector}
@end itemize

@item 
any integer type
@end itemize

I have successfully used @cite{gtkwave} to view VCD files.

Currently, there is no way to select signals to be dumped: all signals are
dumped, which can generate big files.

It is very unfortunate there is no standard or well-known wave file
format supporting VHDL types. If you are aware of such a free format,
please mail me (@ref{13,,Reporting bugs}).
@end deffn

@geindex ghdl command line option; --vcd-nodate
@anchor{using/Simulation cmdoption-ghdl-vcd-nodate}@anchor{ab}
@deffn {Option} @w{-}@w{-}vcd@w{-}nodate

Do not write date in the VCD file.
@end deffn

@geindex ghdl command line option; --fst<=FILENAME>
@anchor{using/Simulation cmdoption-ghdl-fst}@anchor{ac}
@deffn {Option} @w{-}@w{-}fst<=FILENAME>

Write the waveforms into an @cite{fst} file that can be displayed by
@cite{gtkwave}. The @cite{fst} files are much smaller than VCD or
@cite{GHW} files, but it handles only the same signals as the VCD format.
@end deffn

@geindex ghdl command line option; --wave<=FILENAME>
@anchor{using/Simulation cmdoption-ghdl-wave}@anchor{ad}
@deffn {Option} @w{-}@w{-}wave<=FILENAME>

Write the waveforms into a @cite{ghw} (GHdl Waveform) file. Currently, all
the signals are dumped into the waveform file, you cannot select a hierarchy
of signals to be dumped.

The format of this file was defined by myself and is not yet completely fixed.
It may change slightly. The @code{gtkwave} tool can read the GHW files.

Contrary to VCD files, any VHDL type can be dumped into a GHW file.
@end deffn

@node Export hierarchy and references,Debugging,Export waveforms,Simulation and runtime
@anchor{using/Simulation export-hierarchy-and-references}@anchor{ae}
@section Export hierarchy and references


@geindex ghdl command line option; --disp-tree<[=KIND]>
@anchor{using/Simulation cmdoption-ghdl-disp-tree}@anchor{af}
@deffn {Option} @w{-}@w{-}disp@w{-}tree<[=KIND]>

@geindex display design hierarchy

Display the design hierarchy as a tree of instantiated design entities.
This may be useful to understand the structure of a complex
design. @cite{KIND} is optional, but if set must be one of:


@itemize *

@item 
@code{none} Do not display hierarchy. Same as if the option was not present.

@item 
@code{inst} Display entities, architectures, instances, blocks and generates statements.

@item 
@code{proc} Like @code{inst} but also display processes.

@item 
@code{port} Like @code{proc} but display ports and signals too.
If @cite{KIND} is not specified, the hierarchy is displayed with the
@code{port} mode.
@end itemize
@end deffn

@geindex ghdl command line option; --no-run
@anchor{using/Simulation cmdoption-ghdl-no-run}@anchor{b0}
@deffn {Option} @w{-}@w{-}no@w{-}run

Stop the simulation before the first cycle. This may be used with @code{--disp-tree} to display the tree without simulating the whole design. This option actually elaborates the design, so it will catch any bound error in port maps.
@end deffn

@geindex ghdl command line option; --xref-html <[options] file...>
@anchor{using/Simulation cmdoption-ghdl-xref-html}@anchor{b1}
@deffn {Option} @w{-}@w{-}xref@w{-}html <[options] file...>

To easily navigate through your sources, you may generate cross-references. This command generates an html file for each @code{file} given in the command line, with syntax highlighting and full cross-reference: every identifier is a link to its declaration. An index of the files is created too.

The set of @code{file} are analyzed, and then, if the analysis is successful, html files are generated in the directory specified by the @code{-o} option, or @code{html/} directory by default.


@itemize *

@item 
If the option @code{--format=html2} is specified, then the generated html files follow the HTML 2.0 standard, and colours are specified with @cite{<FONT>} tags. However, colours are hard-coded.

@item 
If the option @code{--format=css} is specified, then the generated html files follow the HTML 4.0 standard, and use the CSS-1 file @code{ghdl.css} to specify colours. This file is generated only if it does not already exist (it is never overwritten) and can be customized by the user to change colours or appearance. Refer to a generated file and its comments for more information.
@end itemize
@end deffn

@geindex ghdl command line option; --psl-report<=FILENAME>
@anchor{using/Simulation cmdoption-ghdl-psl-report}@anchor{b2}
@deffn {Option} @w{-}@w{-}psl@w{-}report<=FILENAME>

Write a report for PSL at the end of simulation. For each PSL cover and assert statements, the name, source location and whether it passed or failed is reported. The file is written using the JSON format, but is still human readable.
@end deffn

@geindex ghdl command line option; --file-to-xml
@anchor{using/Simulation cmdoption-ghdl-file-to-xml}@anchor{b3}
@deffn {Option} @w{-}@w{-}file@w{-}to@w{-}xml

Outputs an XML representation of the decorated syntax tree for the input file and its dependencies. It can be used for VHDL tooling using semantic information, like style checkers, documentation extraction, complexity estimation, etc.
@end deffn

@cartouche
@quotation Warning 

@itemize *

@item 
The AST slightly changes from time to time (particularly when new nodes are added for new language features), so be liberal in what is allowed by your tool. Also, the XML can be quite large so consider it only during prototyping.

@item 
Note that at this time there is no XML dump of the elaborated design.
@end itemize
@end quotation
@end cartouche

@geindex debugging

@node Debugging,,Export hierarchy and references,Simulation and runtime
@anchor{using/Simulation debugging}@anchor{b4}
@section Debugging


@geindex ghdl command line option; --trace-signals
@anchor{using/Simulation cmdoption-ghdl-trace-signals}@anchor{b5}
@deffn {Option} @w{-}@w{-}trace@w{-}signals

Display signals after each cycle.
@end deffn

@geindex ghdl command line option; --trace-processes
@anchor{using/Simulation cmdoption-ghdl-trace-processes}@anchor{b6}
@deffn {Option} @w{-}@w{-}trace@w{-}processes

Display process name before each cycle.
@end deffn

@geindex ghdl command line option; --stats
@anchor{using/Simulation cmdoption-ghdl-stats}@anchor{b7}
@deffn {Option} @w{-}@w{-}stats

Display run-time statistics.
@end deffn

@geindex ghdl command line option; --disp-order
@anchor{using/Simulation cmdoption-ghdl-disp-order}@anchor{b8}
@deffn {Option} @w{-}@w{-}disp@w{-}order

Display signals order.
@end deffn

@geindex ghdl command line option; --disp-sources
@anchor{using/Simulation cmdoption-ghdl-disp-sources}@anchor{b9}
@deffn {Option} @w{-}@w{-}disp@w{-}sources

Display sources while displaying signals.
@end deffn

@geindex ghdl command line option; --disp-sig-types
@anchor{using/Simulation cmdoption-ghdl-disp-sig-types}@anchor{ba}
@deffn {Option} @w{-}@w{-}disp@w{-}sig@w{-}types

Display signal types.
@end deffn

@geindex ghdl command line option; --disp-signals-map
@anchor{using/Simulation cmdoption-ghdl-disp-signals-map}@anchor{bb}
@deffn {Option} @w{-}@w{-}disp@w{-}signals@w{-}map

Display map bw declared signals and internal signals.
@end deffn

@geindex ghdl command line option; --disp-signals-table
@anchor{using/Simulation cmdoption-ghdl-disp-signals-table}@anchor{bc}
@deffn {Option} @w{-}@w{-}disp@w{-}signals@w{-}table

Display internal signals.
@end deffn

@geindex ghdl command line option; --checks
@anchor{using/Simulation cmdoption-ghdl-checks}@anchor{bd}
@deffn {Option} @w{-}@w{-}checks

Do internal checks after each process run.
@end deffn

@geindex ghdl command line option; --activity<=LEVEL>
@anchor{using/Simulation cmdoption-ghdl-activity}@anchor{be}
@deffn {Option} @w{-}@w{-}activity<=LEVEL>

Watch activity of LEVEL signals: LEVEL is @code{all}, @code{min} (default) or @code{none} (unsafe).
@end deffn

@geindex ghdl command line option; --dump-rti
@anchor{using/Simulation cmdoption-ghdl-dump-rti}@anchor{bf}
@deffn {Option} @w{-}@w{-}dump@w{-}rti

Dump Run Time Information (RTI).
@end deffn

@geindex ghdl command line option; --bootstrap
@anchor{using/Simulation cmdoption-ghdl-bootstrap}@anchor{c0}
@deffn {Option} @w{-}@w{-}bootstrap

Allow @code{--work=std}
@end deffn

@menu
* GNU Debugger (GDB): GNU Debugger GDB. 

@end menu

@node GNU Debugger GDB,,,Debugging
@anchor{using/Simulation gnu-debugger-gdb}@anchor{c1}
@subsection GNU Debugger (GDB)


@geindex `__ghdl_fatal`

@cartouche
@quotation Warning 
Debugging VHDL programs using @cite{GDB} is possible only with GCC/LLVM.
@end quotation
@end cartouche

GDB is a general purpose debugger for programs compiled by GCC. Currently, there is no VHDL support for GDB. It may be difficult to inspect variables or signals in GDB. However, it is still able to display the stack frame in case of error or to set a breakpoint at a specified line.

GDB can be useful to catch a runtime error, such as indexing an array beyond its bounds. All error check subprograms call the @code{__ghdl_fatal} procedure. Therefore, to a catch runtime error, set a breakpoint like this:

@example
(gdb) break __ghdl_fatal
@end example

When the breakpoint is hit, use the @code{where} or @code{bt} command to display the stack frames.

@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML

@c FOREIGN:

@node Interfacing to other languages,Releases and sources,Simulation and runtime,Top
@anchor{using/Foreign doc}@anchor{c2}@anchor{using/Foreign interfacing-to-other-languages}@anchor{c3}
@chapter Interfacing to other languages


@geindex interfacing

@geindex other languages

@geindex foreign

@geindex VHPI

@geindex VHPIDIRECT

Interfacing with foreign languages through VHPIDIRECT is possible any platform.
You can define a subprogram in a foreign language (such as @cite{C} or
@cite{Ada}) and import it into a VHDL design.

@cartouche
@quotation Hint 
VHPIDIRECT is the simplest way to call C code from VHDL. VHPI is a complex API to interface C and VHDL, which allows to
inspect the hierarchy, set callbacks and/or assign signals. GHDL does not support VHPI. For these kind of features, it is
suggested to use VPI instead (see @ref{86,,VPI build commands}).
@end quotation
@end cartouche

@menu
* Foreign declarations:: 
* Linking foreign object files to GHDL:: 
* Wrapping and starting a GHDL simulation from a foreign program:: 
* Linking GHDL to Ada/C:: 
* Dynamically loading foreign objects from GHDL:: 
* Dynamically loading GHDL:: 
* Using GRT from Ada:: 

@end menu

@node Foreign declarations,Linking foreign object files to GHDL,,Interfacing to other languages
@anchor{using/Foreign foreign-declarations}@anchor{c4}
@section Foreign declarations


Only subprograms (functions or procedures) can be imported, using the foreign
attribute. In this example, the @cite{sin} function is imported:

@example
package math is
  function sin (v : real) return real;
  attribute foreign of sin : function is "VHPIDIRECT sin";
end math;

package body math is
  function sin (v : real) return real is
  begin
    assert false severity failure;
  end sin;
end math;
@end example

A subprogram is made foreign if the @cite{foreign} attribute decorates
it. This attribute is declared in the 1993 revision of the
@code{std.standard} package. Therefore, you cannot use this feature in
VHDL 1987.

The decoration is achieved through an attribute specification. The
attribute specification must be in the same declarative part as the
subprogram and must be after it. This is a general rule for specifications.
The value of the specification must be a locally static string.

Even when a subprogram is foreign, its body must be present. However, since
it won’t be called, you can make it empty or simply put an assertion.

The value of the attribute must start with @code{VHPIDIRECT} (an
upper-case keyword followed by one or more blanks). The linkage name of the
subprogram follows.

@menu
* Restrictions on foreign declarations:: 

@end menu

@node Restrictions on foreign declarations,,,Foreign declarations
@anchor{using/Foreign id1}@anchor{c5}@anchor{using/Foreign restrictions-on-foreign-declarations}@anchor{c6}
@subsection Restrictions on foreign declarations


Any subprogram can be imported. GHDL puts no restrictions on foreign
subprograms. However, the representation of a type or of an interface in a
foreign language may be obscure. Most non-composite types are easily imported:


@table @asis

@item @emph{integer types}

They are represented by a 32 bit word. This generally corresponds to
@cite{int} for @cite{C} or @cite{Integer} for @cite{Ada}.

@item @emph{physical types}

They are represented by a 64 bit word. This generally corresponds to the
@cite{long long} for @cite{C} or @cite{Long_Long_Integer} for @cite{Ada}.

@item @emph{floating point types}

They are represented by a 64 bit floating point word. This generally
corresponds to @cite{double} for @cite{C} or @cite{Long_Float} for @cite{Ada}.

@item @emph{enumeration types}

They are represented by an 8 bit word, or, if the number of literals is
greater than 256, by a 32 bit word. There is no corresponding C type, since arguments are
not promoted.
@end table

Non-composite types are passed by value. For the @cite{in} mode, this
corresponds to the @cite{C} or @cite{Ada} mechanism. The @cite{out} and
@cite{inout} interfaces of non-composite types are gathered in a record
and this record is passed by reference as the first argument to the
subprogram. As a consequence, you shouldn’t use @cite{in} and
@cite{inout} modes in foreign subprograms, since they are not portable.

Records are represented like a @cite{C} structure and are passed by reference
to subprograms.

Arrays with static bounds are represented like a @cite{C} array, whose
length is the number of elements, and are passed by reference to subprograms.

Unconstrained arrays are represented by a fat pointer. Do not use unconstrained
arrays in foreign subprograms.

Accesses to an unconstrained array are fat pointers. Other accesses correspond to an address and are passed to a subprogram like other non-composite types.

Files are represented by a 32 bit word, which corresponds to an index
in a table.

@node Linking foreign object files to GHDL,Wrapping and starting a GHDL simulation from a foreign program,Foreign declarations,Interfacing to other languages
@anchor{using/Foreign linking-foreign-object-files-to-ghdl}@anchor{c7}@anchor{using/Foreign linking-with-foreign-object-files}@anchor{c8}
@section Linking foreign object files to GHDL


You may add additional files or options during the link of @cite{GHDL} using
@code{-Wl,} as described in @ref{c9,,Passing options to other programs}.
For example:

@example
ghdl -e -Wl,-lm math_tb
@end example

will create the @code{math_tb} executable with the @code{lm} (mathematical)
library.

Note the @code{c} library is always linked with an executable.

@node Wrapping and starting a GHDL simulation from a foreign program,Linking GHDL to Ada/C,Linking foreign object files to GHDL,Interfacing to other languages
@anchor{using/Foreign starting-a-simulation-from-a-foreign-program}@anchor{ca}@anchor{using/Foreign wrapping-and-starting-a-ghdl-simulation-from-a-foreign-program}@anchor{cb}
@section Wrapping and starting a GHDL simulation from a foreign program


You may run your design from an external program. You just have to call
the @code{ghdl_main} function which can be defined:

in C:

@example
extern int ghdl_main (int argc, char **argv);
@end example

in Ada:

@example
with System;
...
function Ghdl_Main (Argc : Integer; Argv : System.Address)
  return Integer;
pragma import (C, Ghdl_Main, "ghdl_main");
@end example

This function must be called once, and returns 0 at the end of the simulation.

@node Linking GHDL to Ada/C,Dynamically loading foreign objects from GHDL,Wrapping and starting a GHDL simulation from a foreign program,Interfacing to other languages
@anchor{using/Foreign linking-ghdl-to-ada-c}@anchor{cc}@anchor{using/Foreign linking-with-ada}@anchor{cd}
@section Linking GHDL to Ada/C


As explained previously in @ref{ca,,Wrapping and starting a GHDL simulation from a foreign program},
you can start a simulation from an @cite{Ada} or @cite{C} program. However the build
process is not trivial: you have to elaborate your program and your
@cite{VHDL} design.

@cartouche
@quotation Hint 
If the foreign language is C, this procedure is equivalent to the one described in
@ref{c8,,Linking foreign object files to GHDL}, which is easier. Thus, this procedure is
explained for didactic purposes. When suitable, we suggest to use @code{-e} instead
of @code{--bind} and @code{--list-link}.
@end quotation
@end cartouche

First, you have to analyze all your design files. In this example, we
suppose there is only one design file, @code{design.vhdl}.

@example
$ ghdl -a design.vhdl
@end example

Then, bind your design. In this example, we suppose the entity at the
design apex is @code{design}.

@example
$ ghdl --bind design
@end example

Finally, compile/bind your program and link it with your @cite{VHDL}
design:

in C:

@example
gcc my_prog.c -Wl,`ghdl --list-link design`
@end example

in Ada:

@example
$ gnatmake my_prog -largs `ghdl --list-link design`
@end example

See @ref{ce,,GCC/LLVM only commands} for further details about @code{--bind} and @code{--list-link}.

@node Dynamically loading foreign objects from GHDL,Dynamically loading GHDL,Linking GHDL to Ada/C,Interfacing to other languages
@anchor{using/Foreign dynamically-loading-foreign-objects-from-ghdl}@anchor{cf}
@section Dynamically loading foreign objects from GHDL


Instead of linking and building foreign objects along with GHDL, it is also possible to load foreign resources dinamically.
In order to do so, provide the path and name of the shared library where the resource is to be loaded from. For example:

@example
attribute foreign of get_rand: function is "VHPIDIRECT ./getrand.so get_rand";
@end example

@node Dynamically loading GHDL,Using GRT from Ada,Dynamically loading foreign objects from GHDL,Interfacing to other languages
@anchor{using/Foreign dynamically-loading-ghdl}@anchor{d0}
@section Dynamically loading GHDL


In order to generate a position independent executable (PIE), be it an executable binary
or a shared library, GHDL must be built with config option @code{--default-pic}. This will ensure
that all the libraries and sources analyzed by GHDL generate position independent code (PIC).
Furthermore, when the binary is built, argument @code{-Wl,-pie} needs to be provided.

PIE binaries can be loaded and executed from any language that supports C-alike signatures and types
(C, C++, golang, Python, Rust, etc.). For example:

@example
import ctypes
gbin = ctypes.CDLL(bin_path)

args = ['-gGENA="value"', 'gGENB="value"']

xargs = (ctypes.POINTER(ctypes.c_char) * (len(args) + 1))()
for i, arg in enumerate(args):
    xargs[i] = ctypes.create_string_buffer(arg.encode('utf-8'))
return args[0], xargs

gbin.main(len(xargv)-1, xargv)

import _ctypes
# On GNU/Linux
_ctypes.dlclose(gbin._handle)
# On Windows
#_ctypes.FreeLibrary(gbin._handle)
@end example

This allows seamless co-simulation using concurrent/parallel execution features available in each language:
pthreads, goroutines/gochannels, multiprocessing/queues, etc. Moreover, it provides a mechanism to execute multiple
GHDL simulations in parallel.

@node Using GRT from Ada,,Dynamically loading GHDL,Interfacing to other languages
@anchor{using/Foreign using-grt-from-ada}@anchor{d1}
@section Using GRT from Ada


@cartouche
@quotation Warning 
This topic is only for advanced users who know how to use @cite{Ada}
and @cite{GNAT}. This is provided only for reference; we have tested
this once before releasing @cite{GHDL} 0.19, but this is not checked at
each release.
@end quotation
@end cartouche

The simulator kernel of @cite{GHDL} named @emph{GRT} is written in
@cite{Ada95} and contains a very light and slightly adapted version
of @cite{VHPI}. Since it is an @cite{Ada} implementation it is
called @emph{AVHPI}. Although being tough, you may interface to @cite{AVHPI}.

For using @cite{AVHPI}, you need the sources of @cite{GHDL} and to recompile
them (at least the @cite{GRT} library). This library is usually compiled with
a @cite{No_Run_Time} pragma, so that the user does not need to install the
@cite{GNAT} runtime library. However, you certainly want to use the usual
runtime library and want to avoid this pragma. For this, reset the
@cite{GRT_PRAGMA_FLAG} variable.

@example
$ make GRT_PRAGMA_FLAG= grt-all
@end example

Since @cite{GRT} is a self-contained library, you don’t want
@cite{gnatlink} to fetch individual object files (furthermore this
doesn’t always work due to tricks used in @cite{GRT}). For this,
remove all the object files and make the @code{.ali} files read-only.

@example
$ rm *.o
$ chmod -w *.ali
@end example

You may then install the sources files and the @code{.ali} files. I have never
tested this step.

You are now ready to use it.

Here is an example, @code{test_grt.adb} which displays the top
level design name.

@example
with System; use System;
with Grt.Avhpi; use Grt.Avhpi;
with Ada.Text_IO; use Ada.Text_IO;
with Ghdl_Main;

procedure Test_Grt is
  --  VHPI handle.
  H : VhpiHandleT;
  Status : Integer;

  --  Name.
  Name : String (1 .. 64);
  Name_Len : Integer;
begin
  --  Elaborate and run the design.
  Status := Ghdl_Main (0, Null_Address);

  --  Display the status of the simulation.
  Put_Line ("Status is " & Integer'Image (Status));

  --  Get the root instance.
  Get_Root_Inst(H);

  --  Disp its name using vhpi API.
  Vhpi_Get_Str (VhpiNameP, H, Name, Name_Len);
  Put_Line ("Root instance name: " & Name (1 .. Name_Len));
end Test_Grt;
@end example

First, analyze and bind your design:

@example
$ ghdl -a counter.vhdl
$ ghdl --bind counter
@end example

Then build the whole:

@example
$ gnatmake test_grt -aL`grt_ali_path` -aI`grt_src_path` -largs
 `ghdl --list-link counter`
@end example

Finally, run your design:

@example
$ ./test_grt
Status is  0
Root instance name: counter
@end example

@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML

@node Releases and sources,Building GHDL from Sources,Interfacing to other languages,Top
@anchor{getting/Releases doc}@anchor{d2}@anchor{getting/Releases release}@anchor{d3}@anchor{getting/Releases releases-and-sources}@anchor{d4}
@chapter Releases and sources


@menu
* Downloading pre-built packages:: 
* Downloading Source Files:: 

@end menu

@node Downloading pre-built packages,Downloading Source Files,,Releases and sources
@anchor{getting/Releases downloading-pre-built-packages}@anchor{d5}@anchor{getting/Releases release-packages}@anchor{d6}
@section Downloading pre-built packages


@c TODO How to extend this directive to use `.. only:: html` and `.. only:: html` in the python code passed to it?

@cartouche
@quotation Error 
Unable to execute python code at Releases.rst:108:

<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1051)>
@end quotation
@end cartouche



@subsubheading Pre-built packages of older releases




@node Downloading Source Files,,Downloading pre-built packages,Releases and sources
@anchor{getting/Releases downloading-source-files}@anchor{d7}@anchor{getting/Releases release-sources}@anchor{d8}
@section Downloading Source Files


@cartouche
@quotation Hint 
All the following procedures will retrieve the latest development version of GHDL, i.e., the @cite{master} branch at github.com/ghdl/ghdl@footnote{https://github.com/ghdl/ghdl}.
We do our best to keep it stable, but bugs can seldom be published. See @cite{HINT} boxes below for instructions to get older releases.
@end quotation
@end cartouche
@anchor{getting/Releases release-sources-zip}@anchor{d9}
@subsubheading Tarball/zip-file


GHDL can be downloaded as a zip-file or tarball from GitHub. See the following table, to
choose your desired format/version:


@cartouche
@quotation Hint 
To download a specific version of GHDL, use this alternative URL, where @code{<format>} is @code{tar.gz} or @code{zip}: @code{https://codeload.github.com/ghdl/ghdl/<format>/<tag>}.
@end quotation
@end cartouche
@anchor{getting/Releases release-sources-gitclone}@anchor{da}
@subsubheading git clone


GHDL can be downloaded (cloned) with @code{git clone} from GitHub. GitHub offers
the transfer protocols HTTPS and SSH. You should use SSH if you have a GitHub
account and have already uploaded an OpenSSH public key to GitHub, otherwise
use HTTPS if you have no account or you want to use login credentials.


@multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
@headitem

Protocol

@tab

GitHub Repository URL

@item

HTTPS

@tab

@indicateurl{https://github.com/ghdl/ghdl.git}

@item

SSH

@tab

@indicateurl{ssh://git@@github.com:ghdl/ghdl.git}

@end multitable


@cartouche
@quotation Hint 
Execute @code{git checkout -b stable <tag>} after @code{git clone}, to checkout a specific version of GHDL.
@end quotation
@end cartouche

Command line instructions to clone GHDL with HTTPS protocol:

@example
cd GitRoot
git clone "https://github.com/ghdl/ghdl.git" ghdl
cd ghdl
git remote rename origin github
@end example

Command line instructions to clone GHDL with SSH protocol:

@example
cd GitRoot
git clone "ssh://git@@github.com:ghdl/ghdl.git" ghdl
cd ghdl
git remote rename origin github
@end example

@cartouche
@quotation Note 
Executing the following instructions in Windows Command Prompt (@code{cmd.exe})
won’t function or will result in errors! All Windows command line instructions are
intended for @code{Windows PowerShell}, if not marked otherwise. @code{Windows PowerShell}
can be installed or upgraded to v5.1 by installing the Windows Management Framework@footnote{https://docs.microsoft.com/en-us/powershell/wmf/5.1/install-configure}.
@end quotation
@end cartouche

@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML

@node Building GHDL from Sources,Precompile Vendor Primitives,Releases and sources,Top
@anchor{getting/index doc}@anchor{db}@anchor{getting/index build}@anchor{dc}@anchor{getting/index building-ghdl-from-sources}@anchor{dd}
@chapter Building GHDL from Sources


@subheading Download


GHDL can be downloaded as a zip-file@footnote{https://github.com/ghdl/ghdl/archive/master.zip}/tar-file@footnote{https://github.com/ghdl/ghdl/archive/master.tar.gz}
(latest ‘master’ branch) or cloned with @code{git clone} from GitHub. GitHub
offers HTTPS and SSH as transfer protocols. See the @ref{d8,,Downloading Source Files}
page for further details.

@cartouche
@quotation Important 
Since GHDL is written in @cite{Ada}, independently of the code generator you use,
the a compiler is required. Most GNU/Linux package managers provide a package
named @code{gcc-ada} or @code{gcc-gnat}. Alternatively, @cite{GNU Ada compiler}, @cite{GNAT GPL},
can be downloaded anonymously from libre.adacore.com@footnote{http://libre.adacore.com/tools/gnat-gpl-edition/} (2014, or later; for x86, 32 or 64 bits).
Then, untar and run the doinstall script.
@end quotation
@end cartouche

@subheading Available back-ends


GHDL currently supports three different back-ends (code generators):


@itemize *

@item 
mcode - built-in x86 (or x86_64) code generator

@item 
GCC - Gnu Compiler Collection (gcc.gnu.org@footnote{http://gcc.gnu.org/})

@item 
LLVM - Low-Level Virtual Machine (llvm.org@footnote{http://llvm.org/})
@end itemize

Here is a short comparison, so that you can choose the one you want to use:


@multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
@headitem

Back-end

@tab

Pros

@tab

Cons

@item

@ref{de,,mcode}

@tab


@itemize *

@item 
Very easy to build

@item 
Very quick analysis

@item 
Can handle very large designs
@end itemize

@tab


@itemize *

@item 
Simulation is slower

@item 
x86_64/i386 only
@end itemize

@item

@ref{df,,LLVM}

@tab


@itemize *

@item 
Generated code is faster

@item 
Generated code can be debugged (with @code{-g})

@item 
Easier to build than GCC

@item 
Ported to many platforms (x86, x86_64, armv7/aarch64)
@end itemize

@tab


@itemize *

@item 
Build is more complex than mcode
@end itemize

@item

@ref{e0,,GCC}

@tab


@itemize *

@item 
Generated code is faster (particularly with @code{-O} or @code{-O2})

@item 
Generated code can be debugged (with @code{-g})

@item 
Ported to many platforms (x86, x86_64, PowerPC, SPARC)
@end itemize

@tab


@itemize *

@item 
Build is even more complex

@item 
Analysis can take time (particularly for large units)

@item 
Code coverage collection (@code{gcov}) is unique to GCC
@end itemize

@end multitable


@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML

@menu
* Directory structure:: 
* mcode backend:: 
* LLVM backend:: 
* GCC backend:: 

@end menu

@node Directory structure,mcode backend,,Building GHDL from Sources
@anchor{getting/Directories doc}@anchor{e1}@anchor{getting/Directories build-dir-structure}@anchor{1a}@anchor{getting/Directories directory-structure}@anchor{e2}
@section Directory structure



@itemize *

@item 
@code{src}: sources of GHDL, all of them in Ada.

@item 
@code{libraries}: mostly third party libraries such as, @cite{ieee}, @cite{mentor},
@cite{std}, @cite{synopsys} and @cite{vital}. Except for a few shell and @cite{Python} scripts, all
the content is written in VHDL.


@itemize *

@item 
Vendors like Altera, Lattice and Xilinx have their own simulation libraries,
especially for FPGA primitives, soft and hard macros. These libraries cannot
be shipped with GHDL, but we offer prepared compile scripts to
pre-compile the vendor libraries, if the vendor tool is present on the
computer. These are located in @code{libraries/vendor}.
See @ref{e3,,Precompile Vendor Primitives} for information on how to
use them.
@end itemize

@item 
@code{dist}: scripts and auxiliary files to build GHDL in different
environments:


@itemize *

@item 
@code{gcc}: header and configuration files to build GHDL with GCC (all
platforms).

@item 
@code{linux}: build and test script written in shell, and other auxiliary
files used to i) launch docker containers and ii) automate multiple builds
in Travis CI@footnote{https://travis-ci.org/}.

@item 
@code{windows}:


@itemize *

@item 
@code{mcode}:

@item 
@code{appveyor}:
@end itemize
@end itemize

@item 
@code{doc}: @cite{Markdown} and @cite{reStructuredText} sources and auxiliary files to
build the documentation with Sphinx@footnote{http://www.sphinx-doc.org}. In fact,
Read the Docs@footnote{http://readthedocs.org} (RTD) is used to automatically build
and deploy this site and/or PDF you are reading.

@item 
@code{testsuite}: files used for testing.

@item 
@cite{.yml} configuration files for CI environments (@code{readthedocs},
@code{travis}, and @code{appveyor}) and @cite{ignore} files for source control
management tools (@code{git} and @code{.hg}).

@item 
Files for building GHDL: @code{configure} and @code{Makefile.in}.

@item 
Auxiliary files for development: @code{.gdbinit} and @code{ghdl.gpr.in}
(GNAT project file).

@item 
Text files: @code{COPYING.md}, @code{NEWS.md}, and @code{README.md}.
@end itemize

@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML

@node mcode backend,LLVM backend,Directory structure,Building GHDL from Sources
@anchor{getting/mcode doc}@anchor{e4}@anchor{getting/mcode build-mcode}@anchor{de}@anchor{getting/mcode mcode-backend}@anchor{e5}
@section mcode backend


The mcode backend is available for all supported platforms and is also the
simplest procedure, because it requires the fewest dependencies and configuration
options.

@menu
* GCC/GNAT; GNU/Linux or Windows (MinGW/MSYS2): GCC/GNAT GNU/Linux or Windows MinGW/MSYS2. 
* GNAT GPL; Windows: GNAT GPL Windows. 

@end menu

@node GCC/GNAT GNU/Linux or Windows MinGW/MSYS2,GNAT GPL Windows,,mcode backend
@anchor{getting/mcode build-mcode-gnat}@anchor{e6}@anchor{getting/mcode gcc-gnat-gnu-linux-or-windows-mingw-msys2}@anchor{e7}
@subsection GCC/GNAT: GNU/Linux or Windows (MinGW/MSYS2)


@subsubheading Requirements



@itemize *

@item 
GCC (Gnu Compiler Collection)

@item 
GNAT (Ada compiler for GCC)
@end itemize

GHDL is configured by @code{configure} and built by @code{make}.


@itemize *

@item 
First, GHDL needs to be configured. It is common to specify a @code{PREFIX}
(installation directory like @code{/usr/local} or @code{/opt/ghdl}). Without any
other option, @code{configure} selects @cite{mcode} as the backend.

@item 
Next, @code{make} starts the compilation process.

@item 
Finally, @code{make install} installs GHDL into the installation directory
specified by @code{PREFIX}.
@end itemize

@cartouche
@quotation Hint 
ON GNU/Linux, you may need super user privileges (@code{sudo ...}).
@end quotation
@end cartouche

@subsubheading Example:


@example
$ cd <ghdl>
$ mkdir build
$ cd build
$ ../configure --prefix=PREFIX
$ make
$ make install
@end example

@node GNAT GPL Windows,,GCC/GNAT GNU/Linux or Windows MinGW/MSYS2,mcode backend
@anchor{getting/mcode build-mcode-gnatgpl-windows}@anchor{e8}@anchor{getting/mcode gnat-gpl-windows}@anchor{e9}
@subsection GNAT GPL: Windows


@subsubheading Requirements



@itemize *

@item 
GNAT GPL from @indicateurl{http://libre.adacore.com}

@item 
PowerShell 4

@item 
PowerShell Community Extensions (PSCX)
@end itemize

@subsubheading @cite{compile.ps1}


@example
Commands          Description
--------------------------------------------------------------------
-Help             Display the integrated help pages
-Clean            Clean up all files and directories
-Compile          Compile GHDL
-Install          Install all files into a directory (xcopy deployment)
-Uninstall        Uninstall all files from a directory
-Update           Update files in the installation directory
-CreatePackage    create an installer package

Install options:
-InstallPath      Installation directory

CreatePackage options:
-Zip              Create a zip-file for xcopy deployment
@end example

@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML

@node LLVM backend,GCC backend,mcode backend,Building GHDL from Sources
@anchor{getting/LLVM doc}@anchor{ea}@anchor{getting/LLVM build-llvm}@anchor{df}@anchor{getting/LLVM llvm-backend}@anchor{eb}
@section LLVM backend


@subsubheading Requirements



@itemize *

@item 
GCC (Gnu Compiler Collection)

@item 
GNAT (Ada compiler for GCC)

@item 
LLVM (Low-Level-Virtual Machine) and CLANG (Compiler front-end for LLVM): 3.5, 3.8, 3.9, 4.0, 5.0, 6.0, 7.0 or 8.0
@end itemize

@menu
* GCC/GNAT; GNU/Linux or Windows (MinGW/MSYS2): GCC/GNAT GNU/Linux or Windows MinGW/MSYS2<2>. 

@end menu

@node GCC/GNAT GNU/Linux or Windows MinGW/MSYS2<2>,,,LLVM backend
@anchor{getting/LLVM build-llvm-gnat}@anchor{ec}@anchor{getting/LLVM gcc-gnat-gnu-linux-or-windows-mingw-msys2}@anchor{ed}
@subsection GCC/GNAT: GNU/Linux or Windows (MinGW/MSYS2)


@cartouche
@quotation Hint 
You need to install LLVM (usually depends on @code{libedit}, see #29@footnote{https://github.com/ghdl/ghdl/issues/29}). Debugging is only supported with LLVM 3.5.
@end quotation
@end cartouche

GHDL is configured by @code{configure} and built by @code{make}.


@itemize *

@item 
First, GHDL needs to be configured. It is common to specify a @code{PREFIX}
(installation directory like @code{/usr/local} or @code{/opt/ghdl}). Set the proper
arg, @code{./configure --with-llvm-config}, to select LLVM backend. If
@code{llvm-config} is not in your path, you can specify it:
@code{./configure --with-llvm-config=LLVM_INSTALL/bin/llvm-config}.

@item 
Next, @code{make} starts the compilation process.

@item 
Finally, @code{make install} installs GHDL into the installation directory
specified by @code{PREFIX}.
@end itemize

@subsubheading Example:


@example
$ cd <ghdl>
$ mkdir build
$ cd build
$ ../configure --with-llvm-config --prefix=PREFIX
$ make
$ make install
@end example

@cartouche
@quotation Hint 
If you want to have stack backtraces on errors (like assert failure or index of out bounds), you need to configure and build @code{libbacktrace} from GCC (you don’t need to configure GCC). Then add the following arg to configure: @code{--with-backtrace-lib=/path-to-gcc-build/libbacktrace/.libs/libbacktrace.a}
@end quotation
@end cartouche

@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML

@node GCC backend,,LLVM backend,Building GHDL from Sources
@anchor{getting/GCC doc}@anchor{ee}@anchor{getting/GCC build-gcc}@anchor{e0}@anchor{getting/GCC gcc-backend}@anchor{ef}
@section GCC backend


@cartouche
@quotation Todo 
Instructions to build GHDL with GCC backend on Windows are not available yet.
@end quotation
@end cartouche

@subsubheading Requirements



@itemize *

@item 
GCC (Gnu Compiler Collection)

@item 
GNAT (Ada compiler for GCC)

@item 
GCC source files. Download and untar the sources of version 4.9.x, 5.x, 6.x or 7.x.
@end itemize

@cartouche
@quotation Hint 
There are some dependencies for building GCC (@code{gmp}, @code{mpfr} and @code{mpc}). If you have not installed them on your system, you can either build them manually or use the @code{download_prerequisites} script provided in the GCC source tree (recommended): @code{cd /path/to/gcc/source/dir && ./contrib/download_prerequisites}.
@end quotation
@end cartouche


@itemize *

@item 
First configure GHDL, specify GCC source directory and installation prefix (like  @code{/usr/local} or @code{/opt/ghdl}).

@item 
Next, invoke @code{make copy-sources} to copy GHDL sources in the source directory.

@item 
Then, configure GCC. The list of @code{--disable} configure options can be adjusted to your needs. GHDL does not require all these optional libraries and disabling them will speed up the build.

@item 
Now, build and install GCC with @code{make}.

@item 
Last, build and install GHDL libraries.
@end itemize

@subsubheading Example:


@example
$ cd <ghdl>
$ mkdir build
$ cd build
$ ../configure --with-gcc=/path/to/gcc/source/dir --prefix=/usr/local
$ make copy-sources
$ mkdir gcc-objs; cd gcc-objs
$ /path/to/gcc/source/dir/configure --prefix=/usr/local --enable-languages=c,vhdl \
--disable-bootstrap --disable-lto --disable-multilib --disable-libssp \
--disable-libgomp --disable-libquadmath
$ make -j2 && make install
$ cd /path/to/ghdl/source/dir/build
$ make ghdllib
$ make install
@end example

@cartouche
@quotation Hint 
Note that the prefix directory to configure @code{gcc} must be the same as the one used to configure GHDL. If you have manually built @code{gmp}/@code{mpfr}/@code{mpc} (without using the script in @code{contrib}), and, if you have installed them in a non-standard directory, you may need to add @code{--with-gmp=GMP_INSTALL_DIR}.
@end quotation
@end cartouche

@cartouche
@quotation Hint 
If your system gcc was configured with @code{--enable-default-pie} (check if that option appears in the output of @code{gcc -v}), you should also add it.
@end quotation
@end cartouche

@cartouche
@quotation Hint 
If you don’t want to install @code{makeinfo}, do @code{make install MAKEINFO=true} instead.
@end quotation
@end cartouche

@cartouche
@quotation Hint 
Once GCC (with GHDL) has been built once, it is possible to work on the GHDL source tree without copying it in the GCC tree. Commands are:

@example
$ make ghdl1-gcc           # Build the compiler
$ make ghdl_gcc            # Build the driver
$ make libs.vhdl.local_gcc # Compile the vhdl libraries
$ make grt-all             # Build the GHDL runtime
$ make install.vpi.local   # Locally install vpi files
@end example

In @code{src/ortho/gcc}, create a @code{Makefile.conf} file that sets the following
variables:

@example
AGCC_GCCSRC_DIR=/path/to/gcc/sources
AGCC_GCCOBJ_DIR=/path/to/gcc/build
@end example

If your system gcc was built with @code{--enable-default-pie}, add
@code{-no-pie} option for linking.
@end quotation
@end cartouche

@cartouche
@quotation Hint 
For ppc64 (and AIX ?) platform, the object file format contains an identifier for the source language. Because gcc doesn’t know about VHDL, gcc crashes very early. This could be fixed with a very simple change in @code{gcc/config/rs6000/rs6000.c}, @code{function rs6000_output_function_epilogue} (as of gcc 4.8):

@example
          || ! strcmp (language_string, "GNU GIMPLE")
          || ! strcmp (language_string, "GNU Go")
          || ! strcmp (language_string, "GNU D")
-         || ! strcmp (language_string, "libgccjit"))
+         || ! strcmp (language_string, "libgccjit")
+         || ! strcmp (language_string, "vhdl"))
        i = 0;
@end example
@end quotation
@end cartouche

@cartouche
@quotation Hint 
The output of both GCC and LLVM is an executable file, but @cite{mcode} does not
generate any. Therefore, if using GCC/LLVM, the call with argument @code{-r} can
be replaced with direct execution of the binary. See section @ref{d,,Quick Start Guide}.
@end quotation
@end cartouche

After making your choice, you can jump to the corresponding section.
However, we suggest you to read @ref{1a,,Directory structure} first, so that you
know where the content will be placed and which files are expected to be
created.

@cartouche
@quotation Hint 
In these instructions, the configure script is executed in the source directory; but you can execute in a different
directory too, like this:

@quotation

@example
$ mkdir ghdl-objs
$ cd ghdl-objs
$ ../path/to/ghdl/configure ...
@end example
@end quotation
@end quotation
@end cartouche

@cartouche
@quotation Hint 
On Windows, building GHDL with mcode backend and GNAT GPL 32 bit seems to be the only way to get a standalone native executable.


@itemize *

@item 
MINGW/MSYS2 builds depend on the environment/runtime.

@item 
For 64 bit, no native compiler exists from AdaCore.

@item 
That Ada to .NET compiler, which might work for 32 or 64 bit. is not up-to-date.
@end itemize
@end quotation
@end cartouche

@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML

@node Precompile Vendor Primitives,Command Reference,Building GHDL from Sources,Top
@anchor{getting/PrecompileVendorPrimitives doc}@anchor{f0}@anchor{getting/PrecompileVendorPrimitives getting-precompvendor}@anchor{e3}@anchor{getting/PrecompileVendorPrimitives precompile-vendor-primitives}@anchor{f1}
@chapter Precompile Vendor Primitives


Vendors like Altera, Lattice and Xilinx have their own simulation libraries,
especially for FPGA primitives, soft and hard macros. These libraries cannot
be shipped with @emph{GHDL}, but we offer prepared compile scripts to pre-compile
the vendor libraries, if the vendor tool is present on the computer. There are
also popular simulation and verification libraries like OSVVM @footnote{
OSVVM @indicateurl{http://github.com/OSVVM/OSVVM}
} or
UVVM @footnote{
UVVM @indicateurl{https://github.com/UVVM/UVVM_All}
}, which can be pre-compiled, too.

The compilation scripts are writen in the shell languages: @emph{PowerShell} for
@emph{Windows} ™ and @emph{Bash} for @emph{GNU/Linux}. The compile scripts can colorize
the GHDL warning and error lines with the help of @cite{grc/grcat} @footnote{
Generic Colourizer @indicateurl{http://kassiopeia.juls.savba.sk/~garabik/software/grc.html}
}.

@menu
* Supported Vendors Libraries:: 
* Supported Simulation and Verification Libraries:: 
* Script Configuration:: 
* Compiling on Linux:: 
* Compiling on Windows:: 
* Configuration Files:: 

@end menu

@node Supported Vendors Libraries,Supported Simulation and Verification Libraries,,Precompile Vendor Primitives
@anchor{getting/PrecompileVendorPrimitives supported-vendors-libraries}@anchor{f2}
@section Supported Vendors Libraries



@itemize *

@item 
Altera/Intel Quartus (13.0 or later):


@itemize *

@item 
@cite{lpm}, @cite{sgate}

@item 
@cite{altera}, @cite{altera_mf}, @cite{altera_lnsim}

@item 
@cite{arriaii}, @cite{arriaii_pcie_hip}, @cite{arriaiigz}

@item 
@cite{arriav}, @cite{arriavgz}, @cite{arriavgz_pcie_hip}

@item 
@cite{cycloneiv}, @cite{cycloneiv_pcie_hip}, @cite{cycloneive}

@item 
@cite{cyclonev}

@item 
@cite{max}, @cite{maxii}, @cite{maxv}

@item 
@cite{stratixiv}, @cite{stratixiv_pcie_hip}

@item 
@cite{stratixv}, @cite{stratixv_pcie_hip}

@item 
@cite{fiftyfivenm}, @cite{twentynm}
@end itemize

@item 
Lattice (3.6 or later):


@itemize *

@item 
@cite{ec}

@item 
@cite{ecp}, @cite{ecp2}, @cite{ecp3}, @cite{ecp5u}

@item 
@cite{lptm}, @cite{lptm2}

@item 
@cite{machxo}, @cite{machxo2}, @cite{machxo3l}

@item 
@cite{sc}, @cite{scm}

@item 
@cite{xp}, @cite{xp2}
@end itemize

@item 
Xilinx ISE (14.0 or later):


@itemize *

@item 
@cite{unisim} (incl. @cite{secureip})

@item 
@cite{unimacro}

@item 
@cite{simprim} (incl. @cite{secureip})

@item 
@cite{xilinxcorelib}
@end itemize

@item 
Xilinx Vivado (2014.1 or later):


@itemize *

@item 
@cite{unisim} (incl. @cite{secureip})

@item 
@cite{unimacro}
@end itemize
@end itemize

@node Supported Simulation and Verification Libraries,Script Configuration,Supported Vendors Libraries,Precompile Vendor Primitives
@anchor{getting/PrecompileVendorPrimitives supported-simulation-and-verification-libraries}@anchor{f3}
@section Supported Simulation and Verification Libraries



@itemize *

@item 
OSVVM (for VHDL-2008)


@itemize *

@item 
osvvm
@end itemize

@item 
UVVM (for VHDL-2008)


@itemize *

@item 
uvvm-utilities

@item 
uvvm-vvc-framework

@item 
uvvm-vip-avalon_mm

@item 
uvvm-vip-axi_lite

@item 
uvvm-vip-axi_stream

@item 
uvvm-vip-gpio

@item 
uvvm-vip-i2c

@item 
uvvm-vip-sbi

@item 
uvvm-vip-spi

@item 
uvvm-vip-uart
@end itemize
@end itemize


__________________________________________________________________


@node Script Configuration,Compiling on Linux,Supported Simulation and Verification Libraries,Precompile Vendor Primitives
@anchor{getting/PrecompileVendorPrimitives script-configuration}@anchor{f4}
@section Script Configuration


The vendor library compile scripts need to know where the used / latest vendor
tool chain is installed. Therefore, the scripts implement a default installation
directory search as well as environment variable checks. If a vendor tool cannot
be detected or the script chooses the wrong vendor library source directory,
then it’s possible to provide the path via @cite{–source} or @cite{-Source}.

The generated output is stored relative to the current working directory. The
scripts create a sub-directory for each vendor. The default output directory can
be overwritten by the parameter @cite{–output} or @cite{-Output}.

To compile all source files with GHDL, the simulator executable is searched in
@cite{PATH}. The found default GHDL executable can be overwritten by setting the
environment variable @cite{GHDL} or by passing the parameter @cite{–ghdl} or @cite{-GHDL} to
the scripts.

If the vendor library compilation is used very often, we recommend configuring
these parameters in @cite{config.sh} or @cite{config.psm1}, so the command line can be
shortened to the essential parts.


__________________________________________________________________


@node Compiling on Linux,Compiling on Windows,Script Configuration,Precompile Vendor Primitives
@anchor{getting/PrecompileVendorPrimitives compiling-on-linux}@anchor{f5}
@section Compiling on Linux



@itemize *

@item 

@table @asis

@item @strong{Step 0 - Configure the scripts (optional)}

See the next section for how to configure @cite{config.sh}.
@end table

@item 
@strong{Step 1 - Browse to your simulation working directory}

@example
$ cd <MySimulationFolder>
`@w{`}`
@end example

@item 
@strong{Step 2 - Start the compilation script(s)}

@example
$ /usr/local/lib/ghdl/vendors/compile-altera.sh --all
$ /usr/local/lib/ghdl/vendors/compile-lattice.sh --all
$ /usr/local/lib/ghdl/vendors/compile-xilinx-ise.sh --all
$ /usr/local/lib/ghdl/vendors/compile-xilinx-vivado.sh --all
$ /usr/local/lib/ghdl/vendors/compile-osvvm.sh --all
$ /usr/local/lib/ghdl/vendors/compile-uvvm.sh --all
`@w{`}`

In most cases GHDL is installed into `/usr/local/`. The scripts are
installed into the `lib` directory.
@end example

@item 

@table @asis

@item @strong{Step 3 - Viewing the result}

This creates vendor directories in your current working directory and
compiles the vendor files into them.
@end table

@example
$ ls -ahl
...
drwxr-xr-x  2 <user> <group>  56K Mar 09 17:41 altera
drwxr-xr-x  2 <user> <group>  56K Mar 09 17:42 lattice
drwxr-xr-x  2 <user> <group>  56K Mar 09 17:48 osvvm
drwxr-xr-x  2 <user> <group>  56K Mar 09 17:58 uvvm
drwxr-xr-x  2 <user> <group>  56K Mar 09 17:58 xilinx-ise
drwxr-xr-x  2 <user> <group>  56K Mar 09 17:48 xilinx-vivado
`@w{`}`
@end example
@end itemize


__________________________________________________________________


@node Compiling on Windows,Configuration Files,Compiling on Linux,Precompile Vendor Primitives
@anchor{getting/PrecompileVendorPrimitives compiling-on-windows}@anchor{f6}
@section Compiling on Windows



@itemize *

@item 

@table @asis

@item @strong{Step 0 - Configure the scripts (optional)}

See the next section for how to configure @cite{config.psm1}.
@end table

@item 
@strong{Step 1 - Browse to your simulation working directory}

@example
PS> cd <MySimulationFolder>
@end example

@item 
@strong{Step 2 - Start the compilation script(s)}

@example
PS> <GHDL>\libraries\vendors\compile-altera.ps1 -All
PS> <GHDL>\libraries\vendors\compile-lattice.ps1 -All
PS> <GHDL>\libraries\vendors\compile-xilinx-ise.ps1 -All
PS> <GHDL>\libraries\vendors\compile-xilinx-vivado.ps1 -All
PS> <GHDL>\libraries\vendors\compile-osvvm.ps1 -All
PS> <GHDL>\libraries\vendors\compile-uvvm.ps1 -All
@end example

@item 

@table @asis

@item @strong{Step 3 - Viewing the result}

This creates vendor directories in your current working directory and
compiles the vendor files into them.
@end table

@example
PS> dir
    Directory: D:\temp\ghdl

Mode           LastWriteTime       Length Name
----           -------------       ------ ----
d----    09.03.2018    19:33        <DIR> altera
d----    09.03.2018    19:38        <DIR> lattice
d----    09.03.2018    19:38        <DIR> osvvm
d----    09.03.2018    19:45        <DIR> uvvm
d----    09.03.2018    19:06        <DIR> xilinx-ise
d----    09.03.2018    19:40        <DIR> xilinx-vivado
@end example
@end itemize


__________________________________________________________________


@node Configuration Files,,Compiling on Windows,Precompile Vendor Primitives
@anchor{getting/PrecompileVendorPrimitives configuration-files}@anchor{f7}
@section Configuration Files


@menu
* For Linux; config.sh: For Linux config sh. 
* For Windows; config.psm1: For Windows config psm1. 
* Selectable Options for the Bash Scripts;: Selectable Options for the Bash Scripts. 
* Selectable Options for the PowerShell Scripts;: Selectable Options for the PowerShell Scripts. 

@end menu

@node For Linux config sh,For Windows config psm1,,Configuration Files
@anchor{getting/PrecompileVendorPrimitives for-linux-config-sh}@anchor{f8}
@subsection For Linux: @cite{config.sh}


Please open the @cite{config.sh} file and set the dictionary entries for the
installed vendor tools to your tool’s installation
directories. Use an empty string @cite{“”} for not installed tools.

@cite{config.sh}:

@example
declare -A InstallationDirectory
InstallationDirectory[AlteraQuartus]="/opt/Altera/17.1"
InstallationDirectory[LatticeDiamond]="/opt/Diamond/3.9_x64"
InstallationDirectory[OSVVM]="/home/<user>/git/GitHub/osvvm"
InstallationDirectory[UVVM]="/home/<user>/git/GitHub/uvvm_all"
InstallationDirectory[XilinxISE]="/opt/Xilinx/14.7"
InstallationDirectory[XilinxVivado]="/opt/Xilinx/Vivado/2017.4"
@end example

@node For Windows config psm1,Selectable Options for the Bash Scripts,For Linux config sh,Configuration Files
@anchor{getting/PrecompileVendorPrimitives for-windows-config-psm1}@anchor{f9}
@subsection For Windows: @cite{config.psm1}


Please open the @cite{config.psm1} file and set the dictionary entries for the
installed vendor tools to your tool’s installation
folder. Use an empty string @cite{“”} for not installed tools.

@cite{config.psm1}:

@example
$InstallationDirectory = @@@{
  "AlteraQuartus" =   "C:\Altera\17.1";
  "LatticeDiamond" =  "C:\Lattice\Diamond\3.9_x64";
  "XilinxISE" =       "C:\Xilinx\14.7\ISE_DS";
  "XilinxVivado" =    "C:\Xilinx\Vivado\2017.4";
  "OSVVM" =           "D:\git\GitHub\osvvm";
  "UVVM" =            "D:\git\GitHub\uvvm_all"
@}
@end example

@node Selectable Options for the Bash Scripts,Selectable Options for the PowerShell Scripts,For Windows config psm1,Configuration Files
@anchor{getting/PrecompileVendorPrimitives selectable-options-for-the-bash-scripts}@anchor{fa}
@subsection Selectable Options for the Bash Scripts:



@itemize *

@item 
Common parameters to most scripts:

@example
--help, -h            Print the embedded help page(s).
--clean, -c           Cleanup directory before analyzing.
--no-warnings, -n     Don't show warnings. Report errors only.
--skip-existing, -s   Skip already compiled files (an *.o file exists).
--skip-largefiles, -S Don't compile large entities like DSP and PCIe primitives.
--halt-on-error, -H   Stop compiling if an error occurred.
@end example

@item 
@cite{compile-altera.sh}

Selectable libraries:

@example
--all, -a             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
@end example

Compile options:

@example
--vhdl93              Compile selected libraries with VHDL-93 (default).
--vhdl2008            Compile selected libraries with VHDL-2008.
@end example

@item 
@cite{compile-xilinx-ise.sh}

Selectable libraries:

@example
--all, -a             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
--corelib             Compile the xilinxcorelib macros
--secureip            Compile the secureip primitives
@end example

Compile options:

@example
--vhdl93              Compile selected libraries with VHDL-93 (default).
--vhdl2008            Compile selected libraries with VHDL-2008.
@end example

@item 
@cite{compile-xilinx-vivado.sh}

Selectable libraries:

@example
--all, -a             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
@end example

Compile options:

@example
--vhdl93              Compile selected libraries with VHDL-93 (default).
--vhdl2008            Compile selected libraries with VHDL-2008.
@end example

@item 
@cite{compile-osvvm.sh}

Selectable libraries:

@example
--all, -a             Compile all.
--osvvm               Compile the OSVVM library.
@end example

@item 
@cite{compile-uvvm.sh}

Selectable libraries:

@example
--all, -a             Compile all.
--uvvm                Compile the UVVM libraries.
@end example
@end itemize

@node Selectable Options for the PowerShell Scripts,,Selectable Options for the Bash Scripts,Configuration Files
@anchor{getting/PrecompileVendorPrimitives selectable-options-for-the-powershell-scripts}@anchor{fb}
@subsection Selectable Options for the PowerShell Scripts:



@itemize *

@item 
Common parameters to all scripts:

@example
-Help                 Print the embedded help page(s).
-Clean                Cleanup directory before analyzing.
-SuppressWarnings     Don't show warnings. Report errors only.
@end example

@item 
@cite{compile-altera.ps1}

Selectable libraries:

@example
-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
@end example

Compile options:

@example
-VHDL93               Compile selected libraries with VHDL-93 (default).
-VHDL2008             Compile selected libraries with VHDL-2008.
@end example

@item 
@cite{compile-xilinx-ise.ps1}

Selectable libraries:

@example
-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
-CoreLib              Compile the xilinxcorelib macros
-Secureip             Compile the secureip primitives
@end example

Compile options:

@example
-VHDL93               Compile selected libraries with VHDL-93 (default).
-VHDL2008             Compile selected libraries with VHDL-2008.
@end example

@item 
@cite{compile-xilinx-vivado.ps1}

Selectable libraries:

@example
-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
@end example

Compile options:

@example
-VHDL93               Compile selected libraries with VHDL-93 (default).
-VHDL2008             Compile selected libraries with VHDL-2008.
@end example

@item 
@cite{compile-osvvm.ps1}

Selectable libraries:

@example
-All                  Compile all.
-OSVVM                Compile the OSVVM library.
@end example

@item 
@cite{compile-uvvm.ps1}

Selectable libraries:

@example
-All                  Compile all.
-UVVM                 Compile the UVVM libraries.
@end example
@end itemize


__________________________________________________________________


@quotation
@end quotation

@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML

@node Command Reference,Coding Style,Precompile Vendor Primitives,Top
@anchor{references/CommandReference doc}@anchor{fc}@anchor{references/CommandReference command-reference}@anchor{fd}@anchor{references/CommandReference ref-command}@anchor{f}
@chapter Command Reference


@cartouche
@quotation Hint 
The most common commands and options are shown in section @ref{e,,Invoking GHDL}. Here the advanced and experimental features are described.
@end quotation
@end cartouche

@menu
* Environment variables:: 
* Misc commands:: 
* File commands:: 
* GCC/LLVM only commands:: 
* Options: Options<2>. 
* Passing options to other programs:: 

@end menu

@node Environment variables,Misc commands,,Command Reference
@anchor{references/CommandReference environment-variables}@anchor{fe}
@section Environment variables


@geindex environment variable; GHDL_PREFIX
@anchor{references/CommandReference envvar-GHDL_PREFIX}@anchor{34}
@deffn {Environment Variable} GHDL_PREFIX
@end deffn

@node Misc commands,File commands,Environment variables,Command Reference
@anchor{references/CommandReference misc-commands}@anchor{ff}
@section Misc commands


There are a few GHDL commands which are seldom useful.

@geindex cmd help

@menu
* Help [-h]:: 
* Display config [--disp-config]:: 
* Display standard [--disp-standard]:: 
* Version [--version]:: 

@end menu

@node Help [-h],Display config [--disp-config],,Misc commands
@anchor{references/CommandReference help-h}@anchor{100}
@subsection Help [@code{-h}]


@geindex ghdl command line option; --help@comma{} -h
@anchor{references/CommandReference cmdoption-ghdl-help}@anchor{101}
@deffn {Option} @w{-}@w{-}help, @w{-}h
@end deffn

Display (on the standard output) a short description of the all the commands
available. If the help switch is followed by a command switch, then options
for that second command are displayed:

@example
ghdl --help
ghdl -h
ghdl -h command
@end example

@geindex cmd display configuration

@node Display config [--disp-config],Display standard [--disp-standard],Help [-h],Misc commands
@anchor{references/CommandReference display-config-disp-config}@anchor{102}
@subsection Display config [@code{--disp-config}]


@geindex ghdl command line option; --disp-config <[options]>
@anchor{references/CommandReference cmdoption-ghdl-disp-config}@anchor{35}
@deffn {Option} @w{-}@w{-}disp@w{-}config <[options]>
@end deffn

Display the program paths and options used by GHDL. This may be useful to track installation errors.

@geindex cmd display standard

@geindex display `@w{`}std.standard`@w{`}

@node Display standard [--disp-standard],Version [--version],Display config [--disp-config],Misc commands
@anchor{references/CommandReference display-standard-disp-standard}@anchor{103}
@subsection Display standard [@code{--disp-standard}]


@geindex ghdl command line option; --disp-standard <[options]>
@anchor{references/CommandReference cmdoption-ghdl-disp-standard}@anchor{104}
@deffn {Option} @w{-}@w{-}disp@w{-}standard <[options]>
@end deffn

Display the @code{std.standard} package.

@geindex cmd version

@node Version [--version],,Display standard [--disp-standard],Misc commands
@anchor{references/CommandReference version-version}@anchor{105}
@subsection Version [@code{--version}]


@geindex ghdl command line option; --version@comma{} -v
@anchor{references/CommandReference cmdoption-ghdl-version}@anchor{106}
@deffn {Option} @w{-}@w{-}version, @w{-}v
@end deffn

Display the GHDL version.

@node File commands,GCC/LLVM only commands,Misc commands,Command Reference
@anchor{references/CommandReference file-commands}@anchor{107}
@section File commands


The following commands act on one or several files. These are not analyzed, therefore, they work even if a file has semantic errors.

@geindex cmd file pretty printing

@geindex vhdl to html

@menu
* Pretty print [--pp-html]:: 
* Find [-f]:: 
* Chop [--chop]:: 
* Lines [--lines]:: 

@end menu

@node Pretty print [--pp-html],Find [-f],,File commands
@anchor{references/CommandReference pretty-print-pp-html}@anchor{108}
@subsection Pretty print [@code{--pp-html}]


@geindex ghdl command line option; --pp-html <[options] file...>
@anchor{references/CommandReference cmdoption-ghdl-pp-html}@anchor{109}
@deffn {Option} @w{-}@w{-}pp@w{-}html <[options] file...>
@end deffn

The files are just scanned and an html file with syntax highlighting is generated on standard output. Since the files are not even parsed, erroneous files or incomplete designs can be pretty printed.

The style of the html file can be modified with the @code{--format=} option:


@itemize *

@item 
By default or when the @code{--format=html2} option is specified, the output is an HTML 2.0 file, with colours set through @cite{<FONT>} tags.

@item 
When the @code{--format=css} option is specified, the output is an HTML 4.0 file, with colours set through a CSS file, whose name is @code{ghdl.css}. See Cross-reference_command, for more details about this CSS file.
@end itemize

@geindex cmd file find

@node Find [-f],Chop [--chop],Pretty print [--pp-html],File commands
@anchor{references/CommandReference find-f}@anchor{10a}
@subsection Find [@code{-f}]


@geindex ghdl command line option; -f <file...>
@anchor{references/CommandReference cmdoption-ghdl-f}@anchor{4b}
@deffn {Option} @w{-}f <file...>
@end deffn

The files are scanned, parsed and the names of design units are displayed. Design units marked with two stars are candidates to be at the apex of a design hierarchy.

@geindex cmd file chop

@node Chop [--chop],Lines [--lines],Find [-f],File commands
@anchor{references/CommandReference chop-chop}@anchor{10b}
@subsection Chop [@code{--chop}]


@geindex ghdl command line option; --chop <files...>
@anchor{references/CommandReference cmdoption-ghdl-chop}@anchor{10c}
@deffn {Option} @w{-}@w{-}chop <files...>
@end deffn

The provided files are read, and a file is written in the current directory for every design unit. Each filename is built according to the type:


@itemize *

@item 
For an entity declaration, a package declaration, or a configuration the file name is @code{NAME.vhdl}, where @cite{NAME} is the name of the design unit.

@item 
For a package body, the filename is @code{NAME-body.vhdl}.

@item 
Finally, for an architecture @cite{ARCH} of an entity @cite{ENTITY}, the filename is @code{ENTITY-ARCH.vhdl}.
@end itemize

Since the input files are parsed, this command aborts in case of syntax error. The command aborts too if a file to be written already exists.

Comments between design units are stored into the most adequate files.

This command may be useful to split big files, if your computer doesn’t have enough memory to compile such files. The size of the executable is reduced too.

@geindex cmd file lines

@node Lines [--lines],,Chop [--chop],File commands
@anchor{references/CommandReference lines-lines}@anchor{10d}
@subsection Lines [@code{--lines}]


@geindex ghdl command line option; --lines <files...>
@anchor{references/CommandReference cmdoption-ghdl-lines}@anchor{10e}
@deffn {Option} @w{-}@w{-}lines <files...>
@end deffn

Display on the standard output lines of files preceded by line number.

@node GCC/LLVM only commands,Options<2>,File commands,Command Reference
@anchor{references/CommandReference gcc-llvm-only-commands}@anchor{10f}@anchor{references/CommandReference gccllvm-only-programs}@anchor{ce}
@section GCC/LLVM only commands


@geindex cmd GCC/LLVM binding

@menu
* Bind [--bind]:: 
* Link [--link]:: 
* List link [--list-link]:: 

@end menu

@node Bind [--bind],Link [--link],,GCC/LLVM only commands
@anchor{references/CommandReference bind-bind}@anchor{110}
@subsection Bind [@code{--bind}]


@geindex ghdl command line option; --bind <[options] primary_unit [secondary_unit]>
@anchor{references/CommandReference cmdoption-ghdl-bind}@anchor{4a}
@deffn {Option} @w{-}@w{-}bind <[options] primary_unit [secondary_unit]>
@end deffn

Performs only the first stage of the elaboration command; the list of object files is created but the executable is not built. This command should be used only when the main entry point is not GHDL.

@cartouche
@quotation Hint 
Currently, the objects generated by @code{--bind} are created in the working directory. This behaviour is different from other object files generated with @code{-a}, which are always placed in the same directory as the @cite{WORK} library. It is possible to provide an output path with @code{ghdl --bind -o path/primary_unit primary_unit}. However, @code{ghdl --list-link} will only search in the current path.
@end quotation
@end cartouche

@geindex cmd GCC/LLVM linking

@node Link [--link],List link [--list-link],Bind [--bind],GCC/LLVM only commands
@anchor{references/CommandReference link-link}@anchor{111}
@subsection Link [@code{--link}]


@geindex ghdl command line option; --link <[options] primary_unit [secondary_unit]>
@anchor{references/CommandReference cmdoption-ghdl-link}@anchor{112}
@deffn {Option} @w{-}@w{-}link <[options] primary_unit [secondary_unit]>
@end deffn

Performs only the second stage of the elaboration command: the executable is created by linking the files of the object files list. This command is available only for completeness. The elaboration command is equivalent to the bind command followed by the link command.

@geindex cmd GCC/LLVM list link

@node List link [--list-link],,Link [--link],GCC/LLVM only commands
@anchor{references/CommandReference list-link-list-link}@anchor{113}
@subsection List link [@code{--list-link}]


@geindex ghdl command line option; --list-link <primary_unit [secondary_unit]>
@anchor{references/CommandReference cmdoption-ghdl-list-link}@anchor{114}
@deffn {Option} @w{-}@w{-}list@w{-}link <primary_unit [secondary_unit]>
@end deffn

This command may be used only after a bind command. GHDL displays all the files which will be linked to create an executable and additional arguments for the linker. This command is intended to add object files in a link of a foreign program. This command should be used only after @code{ghdl --bind}, as some files generated by it are looked for in the current path.

@cartouche
@quotation Hint 
One of the arguments returned by @code{--list-link} is @code{-Wl,--version-script=PREFIX/lib/ghdl/grt.ver}, where @cite{PREFIX} is the installation path of GHDL. This will hide most of the symbols when the target executable binary is built. In some contexts, where the binary is to be loaded dynamically, the user might want additional symbols to be accessible. There are two possible approaches to have it done:


@itemize *

@item 
Filter the output of @code{--list-link} with e.g. @code{sed}.

@item 
Provide an additional non-anonymous version script: @code{-Wl,-Wl,--version-script=file.ver}.
@end itemize
@end quotation
@end cartouche

@node Options<2>,Passing options to other programs,GCC/LLVM only commands,Command Reference
@anchor{references/CommandReference options}@anchor{115}
@section Options


@geindex ghdl command line option; --mb-comments@comma{} -C
@anchor{references/CommandReference cmdoption-ghdl-mb-comments}@anchor{29}
@deffn {Option} @w{-}@w{-}mb@w{-}comments, @w{-}C
@end deffn

Allow multi-bytes chars in a comment.

@geindex ghdl command line option; --syn-binding
@anchor{references/CommandReference cmdoption-ghdl-syn-binding}@anchor{116}
@deffn {Option} @w{-}@w{-}syn@w{-}binding
@end deffn

Use synthesizer rules for component binding. During elaboration, if a component is not bound to an entity using VHDL LRM rules, try to find in any known library an entity whose name is the same as the component name.

This rule is known as the synthesizer rule.

There are two key points: normal VHDL LRM rules are tried first and entities are searched only in known libraries. A known library is a library which has been named in your design.

This option is only useful during elaboration.

@geindex ghdl command line option; --GHDL1<=COMMAND>
@anchor{references/CommandReference cmdoption-ghdl-ghdl1}@anchor{117}
@deffn {Option} @w{-}@w{-}GHDL1<=COMMAND>
@end deffn

Use @code{COMMAND} as the command name for the compiler. If @code{COMMAND} is not a path, then it is searched in the path.

@geindex ghdl command line option; --AS<=COMMAND>
@anchor{references/CommandReference cmdoption-ghdl-as}@anchor{118}
@deffn {Option} @w{-}@w{-}AS<=COMMAND>
@end deffn

Use @code{COMMAND} as the command name for the assembler. If @code{COMMAND} is not a path, then it is searched in the path. The default is @code{as}.

@geindex ghdl command line option; --LINK<=COMMAND>
@anchor{references/CommandReference id1}@anchor{119}
@deffn {Option} @w{-}@w{-}LINK<=COMMAND>
@end deffn

Use @code{COMMAND} as the linker driver. If @code{COMMAND} is not a path, then it is searched in the path. The default is @code{gcc}.

@node Passing options to other programs,,Options<2>,Command Reference
@anchor{references/CommandReference id2}@anchor{11a}@anchor{references/CommandReference passing-options-to-other-programs}@anchor{c9}
@section Passing options to other programs


@cartouche
@quotation Warning 
These options are only available with GCC/LLVM.
@end quotation
@end cartouche

For many commands, GHDL acts as a driver: it invokes programs to perform the command. You can pass arbitrary options to these programs.

Both the compiler and the linker are in fact GCC programs. See the GCC manual for details on GCC options.

@geindex ghdl command line option; -Wc@comma{}<OPTION>
@anchor{references/CommandReference cmdoption-ghdl-wc-option}@anchor{11b}
@deffn {Option} @w{-}Wc,<OPTION>
@end deffn

Pass @cite{OPTION} as an option to the compiler.

@geindex ghdl command line option; -Wa@comma{}<OPTION>
@anchor{references/CommandReference cmdoption-ghdl-wa-option}@anchor{11c}
@deffn {Option} @w{-}Wa,<OPTION>
@end deffn

Pass @cite{OPTION} as an option to the assembler.

@geindex ghdl command line option; -Wl@comma{}<OPTION>
@anchor{references/CommandReference cmdoption-ghdl-wl-option}@anchor{11d}
@deffn {Option} @w{-}Wl,<OPTION>
@end deffn

Pass @cite{OPTION} as an option to the linker.

@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML

@node Coding Style,Implementation of VHDL,Command Reference,Top
@anchor{references/CodingStyle doc}@anchor{11e}@anchor{references/CodingStyle coding-style}@anchor{11f}@anchor{references/CodingStyle ref-style}@anchor{1b}
@chapter Coding Style


Ada subset: use only a simple (VHDL like) subset of Ada: no tasking, no
controlled types… VHDL users should easily understand that subset.
Allowed Ada95 features: the standard library, child packages.
Use assertions.

We try to follow the ‘GNU Coding Standards’ when possible: comments before
declarations, one space at the end of sentences, finish sentences with a dot.
But: 2 spaces for indentation in code blocks.

No trailing spaces, no TAB (HT).

Subprograms must have a comment before to describe them, like:

@example
--  Analyze the concurrent statements of PARENT.
procedure Sem_Concurrent_Statement_Chain (Parent : Iir);
@end example

The line before the comment must be a blank line (unless this is the first
declaration). Don’t repeat the comment before the subprogram body.


@itemize *

@item 
For subprograms:


@enumerate 

@item 
Declare on one line when possible:

@example
function Translate_Static_Aggregate (Aggr : Iir) return O_Cnode
@end example

@item 
If not possible, put the return on the next line:

@example
function Translate_Static_String (Str_Type : Iir; Str_Ident : Name_Id)
                                 return O_Cnode
@end example

@item 
If not possible, put parameters and return on the next line:

@example
function Create_String_Literal_Var_Inner
  (Str : Iir; Element_Type : Iir; Str_Type : O_Tnode) return Var_Type
@end example

@item 
If not possible, return on the next line:

@example
function Translate_Shortcut_Operator
  (Imp : Iir_Implicit_Function_Declaration; Left, Right : Iir)
  return O_Enode
@end example

@item 
If not possible, one parameter per line, just after subprogram name:

@example
procedure Translate_Static_Aggregate_1 (List : in out O_Array_Aggr_List;
                                        Aggr : Iir;
                                        Info : Iir;
                                        El_Type : Iir)
@end example

@item 
If not possible, add a return after subprogram name:

@example
function Translate_Predefined_TF_Array_Element
  (Op : Predefined_Boolean_Logical;
   Left, Right : Iir;
   Res_Type : Iir;
   Loc : Iir)
  return O_Enode
@end example

@item 
If not possible, ask yourself what is wrong!  Shorten a name.
@end enumerate

@item 
Rule for the ‘is’: on a new line only if the declarative part is not empty:

@quotation

@example
procedure Translate_Assign (Target : Mnode; Expr : Iir; Target_Type : Iir)
is
  Val : O_Enode;
begin
@end example
@end quotation

vs.

@quotation

@example
function Translate_Static_Range_Dir (Expr : Iir) return O_Cnode is
begin
@end example
@end quotation

If the parameter line is too long with the ‘is’, put in on a separate line:

@quotation

@example
procedure Predeclare_Scope_Type
  (Scope : in out Var_Scope_Type; Name : O_Ident) is
@end example
@end quotation

@item 
Generic instantiation: put the generic actual part on a new line:

@quotation

@example
procedure Free is new Ada.Unchecked_Deallocation
  (Action_List, Action_List_Acc);
@end example
@end quotation

@item 
For if/then statement:


@enumerate 

@item 
‘then’ on the same line:

@example
if Get_Expr_Staticness (Decl) = Locally then
@end example

@item 
If not possible, ‘then’ is alone on its line aligned with the ‘if’:

@example
if Expr = Null_Iir
  or else Get_Kind (Expr) = Iir_Kind_Overflow_Literal
then
@end example

@item 
For a multiline condition, ‘or else’ and ‘and then’ should start lines.
@end enumerate

@item 
‘Local’ variable declaration:
Do not initialize variables, constants must be declared before variables:

@quotation

@example
is
  N_Info : constant Iir := Get_Sub_Aggregate_Info (Info);
  Assoc  : Iir;
  Sub    : Iir;
begin
@end example
@end quotation

If the initialization expression has a side effect (such as allocation), do
not use a constant.
@end itemize

@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML

@node Implementation of VHDL,Implementation of VITAL,Coding Style,Top
@anchor{references/ImplementationOfVHDL doc}@anchor{120}@anchor{references/ImplementationOfVHDL implementation-of-vhdl}@anchor{121}@anchor{references/ImplementationOfVHDL ref-implvhdl}@anchor{10}
@chapter Implementation of VHDL


This chapter describes several implementation defined aspects of VHDL in GHDL.

@menu
* VHDL standards:: 
* PSL implementation:: 
* Source representation:: 
* Library database:: 
* Top entity:: 
* Using vendor libraries:: 

@end menu

@node VHDL standards,PSL implementation,,Implementation of VHDL
@anchor{references/ImplementationOfVHDL id1}@anchor{122}@anchor{references/ImplementationOfVHDL vhdl-standards}@anchor{54}
@section VHDL standards


@geindex VHDL standards

@geindex IEEE 1076

@geindex IEEE 1076a

@geindex 1076

@geindex 1076a

@geindex v87

@geindex v93

@geindex v93c

@geindex v00

@geindex v02

@geindex v08

Unfortunately, there are many versions of the VHDL
language, and they aren’t backward compatible.

The VHDL language was first standardized in 1987 by IEEE as IEEE 1076-1987, and
is commonly referred as VHDL-87. This is certainly the most important version,
since most of the VHDL tools are still based on this standard.

Various problems of this first standard have been analyzed by experts groups
to give reasonable ways of interpreting the unclear portions of the standard.

VHDL was revised in 1993 by IEEE as IEEE 1076-1993. This revision is still
well-known.

Unfortunately, VHDL-93 is not fully compatible with VHDL-87, i.e. some perfectly
valid VHDL-87 programs are invalid VHDL-93 programs. Here are some of the
reasons:


@itemize *

@item 
the syntax of file declaration has changed (this is the most visible source
of incompatibility),

@item 
new keywords were introduced (group, impure, inertial, literal,
postponed, pure, reject, rol, ror, shared, sla, sll, sra, srl,
unaffected, xnor),

@item 
some dynamic behaviours have changed (the concatenation is one of them),

@item 
rules have been added.
@end itemize

Shared variables were replaced by protected types in the 2000 revision of
the VHDL standard. This modification is also known as 1076a. Note that this
standard is not fully backward compatible with VHDL-93, since the type of a
shared variable must now be a protected type (there was no such restriction
before).

Minor corrections were added by the 2002 revision of the VHDL standard. This
revision is not fully backward compatible with VHDL-00 since, for example,
the value of the @cite{‘instance_name} attribute has slightly changed.

The latest version is 2008. Many features have been added, and GHDL
doesn’t implement all of them.

You can select the VHDL standard expected by GHDL with the
@code{--std=<STANDARD>} option, where @code{<STANDARD>} is one of the list below:


@table @asis

@item 87

Select VHDL-87 standard as defined by IEEE 1076-1987. LRM bugs corrected by
later revisions are taken into account.

@item 93

Select VHDL-93; VHDL-87 file declarations are not accepted.

@item 93c

Select VHDL-93 standard with relaxed rules:


@itemize *

@item 
VHDL-87 file declarations are accepted;

@item 
default binding indication rules of VHDL-02 are used. Default binding rules
are often used, but they are particularly obscure before VHDL-02.
@end itemize

@item 00

Select VHDL-2000 standard, which adds protected types.

@item 02

Select VHDL-2002 standard.

@item 08

Select VHDL-2008 standard (partially implemented).
@end table

Multiple standards can be used in a design:


@multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxx} 
@headitem

GROUP

@tab

VHDL Standard

@item

87

@tab

87

@item

93

@tab

93, 93c, 00, 02

@item

08

@tab

08

@end multitable


@cartouche
@quotation Note 
The standards in each group are considered compatible: you can elaborate a design mixing these standards. However, standards of different groups are not compatible.
@end quotation
@end cartouche

@node PSL implementation,Source representation,VHDL standards,Implementation of VHDL
@anchor{references/ImplementationOfVHDL id2}@anchor{123}@anchor{references/ImplementationOfVHDL psl-implementation}@anchor{5b}
@section PSL implementation


GHDL understands embedded PSL annotations in VHDL files, but not in
separate files.

As PSL annotations are embedded within comments, you must analyze and elaborate
your design with option @emph{-fpsl} to enable PSL annotations.

A PSL assertion statement must appear within a comment that starts
with the @cite{psl} keyword. The keyword must be followed (on the
same line) by a PSL keyword such as @cite{assert} or @cite{default}.
To continue a PSL statement on the next line, just start a new comment.

A PSL statement is considered a process, so it’s not allowed within
a process.

All PSL assertions must be clocked (GHDL doesn’t support unclocked assertion).
Furthermore only one clock per assertion is allowed.

You can either use a default clock like this:

@example
-- psl default clock is rising_edge (CLK);
-- psl assert always
--   a -> eventually! b;
@end example

or use a clocked expression (note the use of parentheses):

@example
-- psl assert (always a -> next[3](b)) @@rising_edge (clk);
@end example

Of course only the simple subset of PSL is allowed.

Currently the built-in functions are not implemented.

@node Source representation,Library database,PSL implementation,Implementation of VHDL
@anchor{references/ImplementationOfVHDL source-representation}@anchor{124}
@section Source representation


According to the VHDL standard, design units (i.e. entities,
architectures, packages, package bodies, and configurations) may be
independently analyzed.

Several design units may be grouped into a design file.

In GHDL, a system file represents a design file. That is, a file compiled by
GHDL may contain one or more design units.

It is common to have several design units in a design file.

GHDL does not impose any restriction on the name of a design file
(except that the filename may not contain any control character or
spaces).

GHDL does not keep a binary representation of the design units analyzed like
other VHDL analyzers. The sources of the design units are re-read when
needed (for example, an entity is re-read when one of its architectures is
analyzed). Therefore, if you delete or modify a source file of a unit
analyzed, GHDL will refuse to use it.

@node Library database,Top entity,Source representation,Implementation of VHDL
@anchor{references/ImplementationOfVHDL id3}@anchor{125}@anchor{references/ImplementationOfVHDL library-database}@anchor{126}
@section Library database


Each design unit analyzed is placed into a design library. By default,
the name of this design library is @code{work}; however, this can be
changed with the @code{--work=} option of GHDL.

To keep the list of design units in a design library, GHDL creates
library files. The name of these files is @code{<LIB_NAME>-obj<GROUP>.cf}, where
@cite{<LIB_NAME>} is the name of the library, and @cite{<GROUP>} the VHDL version (87,
93 or 08) used to analyze the design units.

For details on @code{GROUP} values see section @ref{54,,VHDL standards}.

You don’t have to know how to read a library file. You can display it
using the @emph{-d} of @cite{ghdl}. The file contains the name of the
design units, as well as the location and the dependencies.

The format may change with the next version of GHDL.

@node Top entity,Using vendor libraries,Library database,Implementation of VHDL
@anchor{references/ImplementationOfVHDL id4}@anchor{127}@anchor{references/ImplementationOfVHDL top-entity}@anchor{3c}
@section Top entity


There are some restrictions on the entity being at the apex of a design
hierarchy:


@itemize *

@item 
The generic must have a default value, and the value of a generic is its
default value.

@item 
The ports type must be constrained.
@end itemize

@node Using vendor libraries,,Top entity,Implementation of VHDL
@anchor{references/ImplementationOfVHDL using-vendor-libraries}@anchor{128}
@section Using vendor libraries


Many vendors libraries have been analyzed with GHDL. There are
usually no problems. Be sure to use the @code{--work=} option.
However, some problems have been encountered.

GHDL follows the VHDL LRM (the manual which defines VHDL) more
strictly than other VHDL tools. You could try to relax the
restrictions by using the @code{--std=93c}, @code{-fexplicit},
@code{-frelaxed-rules} and @code{--warn-no-vital-generic}.

@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML

@node Implementation of VITAL,Roadmap | Future Improvements,Implementation of VHDL,Top
@anchor{references/ImplementationOfVITAL doc}@anchor{129}@anchor{references/ImplementationOfVITAL implementation-of-vital}@anchor{12a}@anchor{references/ImplementationOfVITAL ref-implvital}@anchor{11}
@chapter Implementation of VITAL


@geindex VITAL

@geindex IEEE 1076.4

@geindex 1076.4

This chapter describes how VITAL is implemented in GHDL. Support of VITAL is
really in a preliminary stage. Do not expect too much of it as of right now.

@menu
* VITAL packages:: 
* VHDL restrictions for VITAL:: 
* Backannotation:: 
* Negative constraint calculation:: 

@end menu

@node VITAL packages,VHDL restrictions for VITAL,,Implementation of VITAL
@anchor{references/ImplementationOfVITAL id1}@anchor{12b}@anchor{references/ImplementationOfVITAL vital-packages}@anchor{56}
@section VITAL packages


The VITAL standard or IEEE 1076.4 was first published in 1995, and revised in
2000.

The version of the VITAL packages depends on the VHDL standard. VITAL
1995 packages are used with the VHDL 1987 standard, while VITAL 2000
packages are used with other standards. This choice is based on the
requirements of VITAL: VITAL 1995 requires the models follow the VHDL
1987 standard, while VITAL 2000 requires the models follow VHDL 1993.

The VITAL 2000 packages were slightly modified so that they conform to
the VHDL 1993 standard (a few functions are made pure and a few
impure).

@node VHDL restrictions for VITAL,Backannotation,VITAL packages,Implementation of VITAL
@anchor{references/ImplementationOfVITAL id2}@anchor{12c}@anchor{references/ImplementationOfVITAL vhdl-restrictions-for-vital}@anchor{5e}
@section VHDL restrictions for VITAL


The VITAL standard (partially) implemented is the IEEE 1076.4 standard
published in 1995.

This standard defines restriction of the VHDL language usage on VITAL
model. A @emph{VITAL model} is a design unit (entity or architecture)
decorated by the @cite{VITAL_Level0} or @cite{VITAL_Level1} attribute.
These attributes are defined in the @cite{ieee.VITAL_Timing} package.

Currently, only VITAL level 0 checks are implemented. VITAL level 1 models
can be analyzed, but GHDL doesn’t check they comply with the VITAL standard.

Moreover, GHDL doesn’t check (yet) that timing generics are not read inside
a VITAL level 0 model prior the VITAL annotation.

The analysis of a non-conformant VITAL model fails. You can disable the
checks of VITAL restrictions with the @emph{–no-vital-checks}. Even when
restrictions are not checked, SDF annotation can be performed.

@node Backannotation,Negative constraint calculation,VHDL restrictions for VITAL,Implementation of VITAL
@anchor{references/ImplementationOfVITAL backannotation}@anchor{a3}@anchor{references/ImplementationOfVITAL id3}@anchor{12d}
@section Backannotation


@geindex SDF

@emph{Backannotation} is the process of setting VITAL generics with timing
information provided by an external files.

The external files must be SDF (Standard Delay Format) files. GHDL
supports a tiny subset of SDF version 2.1. Other version numbers can be
used, provided no features added by later versions are used.

Hierarchical instance names are not supported. However you can use a list of
instances. If there is no instance, the top entity will be annotated and
the celltype must be the name of the top entity. If there is at least one
instance, the last instance name must be a component instantiation label, and
the celltype must be the name of the component declaration instantiated.

Instances being annotated are not required to be VITAL compliant. However
generics being annotated must follow rules of VITAL (e.g., type must be a
suitable vital delay type).

Currently, only timing constraints applying on a timing generic of type
@cite{VitalDelayType01} has been implemented. This SDF annotator is
just a proof of concept. Features will be added with the following GHDL
release.

@node Negative constraint calculation,,Backannotation,Implementation of VITAL
@anchor{references/ImplementationOfVITAL negative-constraint-calculation}@anchor{12e}
@section Negative constraint calculation


Negative constraint delay adjustments are necessary to handle negative
constraints such as a negative setup time. This step is defined in the VITAL
standard and should occur after backannotation.

GHDL does not do negative constraint calculation. It fails to handle models
with negative constraint. I hope to be able to add this phase soon.

@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML

@node Roadmap | Future Improvements,Meta,Implementation of VITAL,Top
@anchor{appendix/Roadmap doc}@anchor{12f}@anchor{appendix/Roadmap change-roadmap}@anchor{130}@anchor{appendix/Roadmap roadmap-future-improvements}@anchor{131}
@chapter Roadmap | Future Improvements


We have several axes for @cite{GHDL} improvements:


@itemize *

@item 
Documentation

@item 
Better diagnostics messages (warning and error)

@item 
Full support of VHDL-2008

@item 
Optimization (simulation speed)

@item 
Graphical tools (to see waves and to debug)

@item 
Style checks

@item 
VITAL acceleration
@end itemize

@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML

@node Meta,Index<2>,Roadmap | Future Improvements,Top
@anchor{appendix/Meta doc}@anchor{132}@anchor{appendix/Meta meta}@anchor{133}
@chapter Meta


@menu
* General guidelines to edit the documentation:: 
* Guidelines to edit section ‘Building’:: 
* Documentation configuration:: 
* Dist:: 

@end menu

@node General guidelines to edit the documentation,Guidelines to edit section ‘Building’,,Meta
@anchor{appendix/Meta general-guidelines-to-edit-the-documentation}@anchor{134}
@section General guidelines to edit the documentation


@quotation


@enumerate 

@item 
It’s better for version control systems and diff tools to break lines at a sensible number of characters. Long lines appear as one diff. Also merging is more complex because merges are line based. Long unbreakable items may be longer (links, refs, etc.). We chose to use 160 chars.

@item 
Please indent all directive content by 3 spaces (not 2, and no tabs).

@item 
Please use @code{*} as an itemize character, since @code{-} and @code{+} are supported by docutils, but not officially supported by Sphinx.

@item 
Please underline all headlines with at least as many characters as the headline is long. Following the Python pattern for headlines the levels are:

@example
############
************ (sometimes skipped in small documents)
============
-------------------
‘’’’’’’’’’’’’’’’’’’’’’’’
@end example

@item 
It’s not required to write

@example
:samp:`code`
@end example

The default role for

@quotation

@example
`@w{`}code`@w{`}
@end example
@end quotation

is samp. @code{:samp:} is only required when you want to write italic text in code text.

@quotation

@example
:samp:`print 1+@{variable@}`
@end example
@end quotation

Now, variable becomes italic.

Please simplify all usages of @code{:samp:`code`} to @code{`@w{`}code`@w{`}} for readability. Here are the regular expressions for an editor like Notepad++:


@itemize -

@item 
Search pattern:: @code{(.+?)}

@item 
Replace pattern:: @code{\1}
@end itemize

@item 
Each backend has one folder and each platform/compiler has one file. Please note that page headlines are different from ToC headline:

@example
.. toctree::
   :hidden:

   ToC entry <file1>
   file2
@end example

@item 
Documentation should not use “you”, “we”, …, because it’s not an interactive conversation or informal letter. It’s like a thesis, everything is structured and formal. However, to make it more friendly to newcomers, we agree to allow informal language in the section @ref{d,,Quick Start Guide}.

@item 
Please keep errors to a minimum.
@end enumerate
@end quotation

@node Guidelines to edit section ‘Building’,Documentation configuration,General guidelines to edit the documentation,Meta
@anchor{appendix/Meta guidelines-to-edit-section-building}@anchor{135}
@section Guidelines to edit section ‘Building’


We prefer a text block, which explains how a compilation works, what we can configure for that backend, etc. After that, we prefer a code block with e.g. bash instructions on how to compile a backend. A list of instructions with embedded bash lines is not helpful. An experienced, as well as novice user, would like to copy a set of instructions into the shell. But it should be stated what these instructions will do. Complex flows like for GCC, can be split into multiple shell code blocks. Moreover, we find it essential to demonstrate when and where to change directories.

We would like to see a list like:


@itemize *

@item 
gcc (Gnu Compiler Collection)

@item 
gcc-gnat (Ada compiler for GCC)

@item 
llvm-del (LLVM development package)

@item 
…
@end itemize

The goal is also to explain what a user is installing and what the few lines in the build description do. Now they know the name, can search for similar names if they have another package manager or distro or can ask Google/Wikipedia. We often find many build receipts with cryptic shell code and to execute this unknown stuff with sudo is not comfortable. We would like to know what it does before hitting enter.

@node Documentation configuration,Dist,Guidelines to edit section ‘Building’,Meta
@anchor{appendix/Meta documentation-configuration}@anchor{136}
@section Documentation configuration



@itemize *

@item 
Python snippet for Sphinx’s @cite{conf.py} to extract the current version number from Git (latest tag name). [#200@footnote{https://github.com/ghdl/ghdl/issues/200}, #221@footnote{https://github.com/ghdl/ghdl/issues/221}]

@item 
Reference @code{genindex.html} from the navigation bar. [#200@footnote{https://github.com/ghdl/ghdl/issues/200}]

@item 
Create “parts” (LaTeX terminology / chapter headlines) in navigation bar. [#200@footnote{https://github.com/ghdl/ghdl/issues/200}]

@item 

@table @asis

@item Intersphinx files [#200@footnote{https://github.com/ghdl/ghdl/issues/200}]


@itemize *

@item 
To decompress the inventory file: @cite{curl -s http://ghdl.readthedocs.io/en/latest/objects.inv | tail -n+5 | openssl zlib -d}. From how-to-uncompress-zlib-data-in-unix@footnote{http://unix.stackexchange.com/questions/22834/how-to-uncompress-zlib-data-in-unix}.

@item 
External ref and link to section:

@example
:ref:`GHDL Roadmap <ghdl:CHANGE:Roadmap>`
@end example

@item 
External ref to option (no link):

@example
:ghdl:option:`--ieee`
:option:`ghdl:--ieee`
@end example
@end itemize
@end table
@end itemize

@node Dist,,Documentation configuration,Meta
@anchor{appendix/Meta dist}@anchor{137}
@section Dist



@itemize *

@item 
Ubuntu uses @cite{dash} instead of @cite{bash} when a shell script is run. As a result, some functionalities, such as arrays like @code{array[1]}, are not supported. Therefore, build scripts in @cite{dist/linux} should not use those functionalities unless they are sourced in a @cite{bash} shell. That is, @code{travis-ci.sh} uses arrays, since it is sourced in the Travis CI machine. But @code{docker-buildtest.sh} and @code{buildtest.sh} do not use any. The same applies to the scripts in @cite{testsuite}.
@end itemize

@c # preload commonly known graphical characters like (c)

@c This data file has been placed in the public domain.

@c Derived from the Unicode character mappings available from
@c <http://www.w3.org/2003/entities/xml/>.
@c Processed by unicode2rstsubs.py, part of Docutils:
@c <http://docutils.sourceforge.net>.

@c # define a hard kine break for HTML

@c # This file is a placeholder and will be replaced

@node Index<2>,Index,Meta,Top
@anchor{genindex doc}@anchor{138}@anchor{genindex index}@anchor{139}
@chapter Index


@node Index,,Index<2>,Top
@unnumbered Index


@printindex ge


@c %**end of body
@bye
