\input texinfo @c -*-texinfo-*- @c %**start of header @setfilename GHDL.info @documentencoding UTF-8 @ifinfo @*Generated by Sphinx 1.3.5.@* @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 2016-09-14, February 18, 2017 Tristan Gingold Copyright @copyright{} 2015, Tristan Gingold @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 GHDL documentation master file, created by @c sphinx-quickstart on Fri Nov 20 20:33:03 2015. @c You can adapt this file completely to your liking, but it should at least @c contain the root `toctree` directive. Contents: @menu * Introduction:: * Starting with GHDL:: * Invoking GHDL:: * Simulation and runtime:: * GHDL implementation of VHDL:: * GHDL implementation of VITAL:: * Flaws and bugs report:: * Copyrights:: * Indices and tables:: * Index:: @detailmenu --- The Detailed Node Listing --- Introduction * Content of this manual:: * What is VHDL?:: * What is GHDL?:: Starting with GHDL * The hello world program:: * A full adder:: * Starting with a design:: Invoking GHDL * Building commands:: * GHDL options:: * Passing options to other programs:: * GHDL Diagnostics Control:: * GHDL warnings:: * Rebuilding commands:: * Library commands:: * Cross-reference command:: * File commands:: * Misc commands:: * VPI build commands:: * Installation Directory:: * IEEE library pitfalls:: * IEEE math packages:: Building commands * Analysis command:: * Elaboration command:: * Run command:: * Elaborate and run command:: * Bind command:: * Link command:: * List link command:: * Check syntax command:: * Analyze and elaborate command:: Rebuilding commands * Import command:: * Make command:: * Generate Makefile command:: Library commands * Directory command:: * Clean command:: * Remove command:: * Copy command:: * Create a Library:: File commands * Pretty print command:: * Find command:: * Chop command:: * Lines command:: Misc commands * Help command:: * Disp config command:: * Disp standard command:: * Version command:: VPI build commands * VPI compile command:: * VPI link command:: * VPI cflags command:: * VPI ldflags command:: * VPI include dir command:: * VPI library dir command:: Simulation and runtime * Simulation options:: * Debugging VHDL programs:: GHDL implementation of VHDL * VHDL standards:: * PSL implementation:: * Source representation:: * Library database:: * Top entity:: * Using vendor libraries:: * Interfacing to other languages:: Interfacing to other languages * Foreign declarations:: * Restrictions on foreign declarations:: * Linking with foreign object files:: * Starting a simulation from a foreign program:: * Linking with Ada:: * Using GRT from Ada:: GHDL implementation of VITAL * VITAL packages:: * VHDL restrictions for VITAL:: * Backannotation:: * Negative constraint calculation:: Flaws and bugs report * Reporting bugs:: * Future improvements:: @end detailmenu @end menu @node Introduction,Starting with GHDL,Top,Top @anchor{Introduction welcome-to-ghdl-s-documentation}@anchor{1}@anchor{Introduction introduction}@anchor{2}@anchor{Introduction doc}@anchor{3} @chapter Introduction @menu * Content of this manual:: * What is VHDL?:: * What is GHDL?:: @end menu @node Content of this manual,What is VHDL?,,Introduction @anchor{Introduction content-of-this-manual}@anchor{4} @section Content of this manual 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. @node What is VHDL?,What is GHDL?,Content of this manual,Introduction @anchor{Introduction what-is-vhdl}@anchor{5} @section What is @cite{VHDL}? @cite{VHDL} is an acronym for Very High Speed Integrated Circuit Hardware Description Language which is a programming language used to describe a logic circuit by function, data flow behaviour, or structure. @cite{VHDL} @emph{is} a programming language: although @cite{VHDL} was not designed for writing general purpose programs, you can write any algorithm with the @cite{VHDL} language. If you are able to write programs, you will find in @cite{VHDL} features similar to those found in procedural languages such as @cite{C}, @cite{Python}, or @cite{Ada}. @cite{VHDL} derives most of its syntax and semantics from @cite{Ada}. Knowing @cite{Ada} is an advantage for learning @cite{VHDL} (it is an advantage in general as well). However, @cite{VHDL} was not designed as a general purpose language but as an @cite{HDL} (hardware description language). As the name implies, @cite{VHDL} aims at modeling or documenting electronics systems. Due to the nature of hardware components which are always running, @cite{VHDL} is a highly concurrent language, built upon an event-based timing model. Like a program written in any other language, a @cite{VHDL} program can be executed. Since @cite{VHDL} is used to model designs, the term @emph{simulation} is often used instead of @cite{execution}, with the same meaning. Like a program written in another hardware description language, a @cite{VHDL} program can be transformed with a @emph{synthesis tool} into a netlist, that is, a detailed gate-level implementation. @node What is GHDL?,,What is VHDL?,Introduction @anchor{Introduction what-is-ghdl}@anchor{6} @section What is @cite{GHDL}? @cite{GHDL} is a shorthand for G Hardware Design Language. Currently, @cite{G} has no meaning. @cite{GHDL} is a @cite{VHDL} compiler that can execute (nearly) any @cite{VHDL} program. @cite{GHDL} is @emph{not} a synthesis tool: you cannot create a netlist with @cite{GHDL}. Unlike some other simulators, @cite{GHDL} is a compiler: it directly translates a @cite{VHDL} file to machine code, using the @cite{GCC} or @cite{LLVM} back-end and 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. The Windows(TM) version of @cite{GHDL} is not based on @cite{GCC} but on an internal code generator. The current version of @cite{GHDL} does not contain any graphical viewer: you cannot see signal waves. You can still check with a test bench. The current version can produce a @cite{VCD} file which can be viewed with a wave viewer, as well as @cite{ghw} files to be viewed by @cite{gtkwave}. @cite{GHDL} aims at implementing @cite{VHDL} as defined by IEEE 1076. It supports most of the 1987 standard and most features added by the 1993 standard. @node Starting with GHDL,Invoking GHDL,Introduction,Top @anchor{Starting_with_GHDL doc}@anchor{7}@anchor{Starting_with_GHDL starting-with-ghdl}@anchor{8} @chapter Starting with GHDL In this chapter, you will learn how to use the GHDL compiler by working on two examples. @menu * The hello world program:: * A full adder:: * Starting with a design:: @end menu @node The hello world program,A full adder,,Starting with GHDL @anchor{Starting_with_GHDL the-hello-world-program}@anchor{9} @section The hello world program To illustrate the large purpose of VHDL, here is a commented VHDL "Hello world" program. @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 Suppose this program is contained in the file @code{hello.vhdl}. First, you have to compile the file; this is called @cite{analysis} of a design file in VHDL terms. @example $ ghdl -a hello.vhdl @end example This command creates or updates a file @code{work-obj93.cf}, which describes the library @cite{work}. On GNU/Linux, this command generates a file @code{hello.o}, which is the object file corresponding to your VHDL program. The object file is not created on Windows. Then, you have to build an executable file. @example $ ghdl -e hello_world @end example The @code{-e} option means @emph{elaborate}. With this option, @cite{GHDL} creates code in order to elaborate a design, with the @code{hello_world} entity at the top of the hierarchy. On GNU/Linux, if you have enabled the GCC backend during the compilation of @cite{GHDL}, an executable program called @code{hello_world} which can be run is generated: @example $ ghdl -r hello_world @end example or directly: @example $ ./hello_world @end example On Windows or if the GCC backend was not enabled, no file is created. The simulation is launched using this command: @example > ghdl -r hello_world @end example The result of the simulation appears on the screen: @example Hello world! @end example @node A full adder,Starting with a design,The hello world program,Starting with GHDL @anchor{Starting_with_GHDL a-full-adder}@anchor{a} @section A full adder VHDL is generally used for hardware design. This example starts with a full adder described in the @code{adder.vhdl} file: @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 assignment. -- 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: @example $ ghdl -a adder.vhdl @end example You can 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 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. The file @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: @example $ ghdl -a adder_tb.vhdl @end example And build an executable for the testbench: @example $ ghdl -e adder_tb @end example You do not need to specify which object files are required: GHDL knows them and automatically adds them in the executable. Now, it is time to run the testbench: @example $ ghdl -r adder_tb adder_tb.vhdl:52:7:(assertion note): end of test @end example If your design is rather complex, you'd like to inspect signals. Signals value can be dumped using the VCD file format. The resulting file can be read with a wave viewer such as GTKWave. First, you should simulate your design and dump a waveform file: @example $ ghdl -r adder_tb --vcd=adder.vcd @end example Then, you may now view the waves: @example $ gtkwave adder.vcd @end example See @ref{b,,Simulation options}, for more details on the @ref{c,,--vcd} option and other runtime options. @node Starting with a design,,A full adder,Starting with GHDL @anchor{Starting_with_GHDL starting-with-a-design}@anchor{d} @section Starting with a design Unless you are only studying VHDL, you will work with bigger 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 @indicateurl{http://ghdl.free.fr/dlx.tar.gz} First, untar the sources: @example $ tar zxvf dlx.tar.gz @end example 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 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: @example $ ghdl -i --workdir=work *.vhdl @end example and making a design: @example $ ghdl -m --workdir=work dlx_test_behaviour @end example Before this second stage, GHDL knows all the design units of the DLX, but no one have been analyzed. The make command of GHDL analyzes and elaborates a design. This creates many files in the @code{work/} directory, and the @code{dlx_test_behaviour} executable in the current directory. The simulation needs to have a DLX program contained in the file @code{dlx.out}. This memory image will be be loaded in the DLX memory. Just take one sample: @example $ cp test_loop.out dlx.out @end example And you can run the test suite: @example $ ghdl -r --workdir=work dlx_test_behaviour @end example 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 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: @example $ ghdl -r --workdir=work dlx_test_behaviour --assert-level=note @end example 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 If you want to make room on your hard drive, you can either: @itemize * @item clean the design library with the GHDL command: @example $ ghdl --clean --workdir=work @end example 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: @example $ ghdl --remove --workdir=work @end example 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 to make the design. @item remove the @code{work/} directory: @example $ rm -rf work @end example 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 Sometimes, a design does not fully follow the VHDL standards. For example it uses the badly engineered @code{std_logic_unsigned} package. GHDL supports this VHDL dialect through some options: @example --ieee=synopsys -fexplicit @end example See @ref{e,,IEEE library pitfalls}, for more details. @node Invoking GHDL,Simulation and runtime,Starting with GHDL,Top @anchor{Invoking_GHDL invoking-ghdl}@anchor{f}@anchor{Invoking_GHDL doc}@anchor{10} @chapter Invoking GHDL The form of the @code{ghdl} command is: @example ghdl command [options...] @end example The GHDL program has several commands. The first argument selects the command. The options are used to slightly modify the action. No option is allowed before the command. Except for the run command, no option is allowed after a filename or a unit name. 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). @menu * Building commands:: * GHDL options:: * Passing options to other programs:: * GHDL Diagnostics Control:: * GHDL warnings:: * Rebuilding commands:: * Library commands:: * Cross-reference command:: * File commands:: * Misc commands:: * VPI build commands:: * Installation Directory:: * IEEE library pitfalls:: * IEEE math packages:: @end menu @node Building commands,GHDL options,,Invoking GHDL @anchor{Invoking_GHDL building-commands}@anchor{11} @section Building commands The mostly used commands of GHDL are those to analyze and elaborate a design. @menu * Analysis command:: * Elaboration command:: * Run command:: * Elaborate and run command:: * Bind command:: * Link command:: * List link command:: * Check syntax command:: * Analyze and elaborate command:: @end menu @node Analysis command,Elaboration command,,Building commands @anchor{Invoking_GHDL analysis-command}@anchor{12} @subsection Analysis command @geindex analysis @geindex -a command Analyze one or several files: @example ghdl -a [options...] file... @end example The analysis command compiles one or more files, and creates an object file for each source file. The analysis command is selected with @code{-a} switch. 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 (the following files are not analyzed). See @ref{13,,GHDL options}, for details on the GHDL options. For example, to produce debugging information such as line numbers, use: @example ghdl -a -g my_design.vhdl @end example @node Elaboration command,Run command,Analysis command,Building commands @anchor{Invoking_GHDL id1}@anchor{14}@anchor{Invoking_GHDL elaboration-command}@anchor{15} @subsection Elaboration command @geindex elaboration @geindex -e command Elaborate a design: @example ghdl -e [options..] primary_unit [secondary_unit] @end example On GNU/Linux, if the GCC backend was enabled during the compilation of @cite{GHDL}, the elaboration command creates an executable containing the code of the @cite{VHDL} sources, the elaboration code and simulation code to execute a design hierarchy. The executable is created in the current directory. On Windows or if the GCC backend was not enabled, this command elaborates the design but does not generate anything. The elaboration command is selected with @code{-e} switch, and must be followed by either: @itemize * @item a name of a configuration unit @item a name of an entity unit @item a name of an entity unit followed by a name of an architecture unit @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{13,,GHDL options}. See @ref{16,,Top entity}, for the restrictions on the root design of a hierarchy. On GNU/Linux the filename of the executable is the name of the primary unit, or for the later case, the concatenation of the name of the primary unit, a dash, and the name of the secondary unit (or architecture). On Windows there is no executable generated. The @code{-o} followed by a filename can override the default executable filename. For the elaboration command, @cite{GHDL} 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 objects files required for the executable. Then, it links all these files with the runtime library. The actual elaboration is performed at runtime. On Windows this command can be skipped because it is also done by the run command. @node Run command,Elaborate and run command,Elaboration command,Building commands @anchor{Invoking_GHDL run-command}@anchor{17}@anchor{Invoking_GHDL id2}@anchor{18} @subsection Run command @geindex run @geindex -r command Run (or simulate) a design: @example ghdl -r [options...] primary_unit [secondary_unit] [simulation_options...] @end example The options and arguments are the same as for the elaboration command, @ref{15,,Elaboration command}. On GNU/Linux this command simply determines the filename of the executable and executes it. Options are ignored. You may also directly execute the program. The executable must be in the current directory. This command exists for three reasons: @itemize * @item You don't have to create the executable program name. @item It is coherent with the @code{-a} and @code{-e} commands. @item It works with the Windows implementation, where the code is generated in memory. @end itemize On Windows this command elaborates and launches the simulation. As a consequence you must use the same options used during analysis. See @ref{19,,Simulation and runtime}, for details on options. @node Elaborate and run command,Bind command,Run command,Building commands @anchor{Invoking_GHDL elaborate-and-run-command}@anchor{1a} @subsection Elaborate and run command @geindex elaborate and run @geindex --elab-run command Elaborate and then simulate a design unit: @example ghdl --elab-run [elab_options...] primary_unit [secondary_unit] [run_options...] @end example This command acts like the elaboration command (see @ref{15,,Elaboration command}) followed by the run command (see @ref{17,,Run command}). @node Bind command,Link command,Elaborate and run command,Building commands @anchor{Invoking_GHDL bind-command}@anchor{1b}@anchor{Invoking_GHDL id3}@anchor{1c} @subsection Bind command @geindex binding @geindex --bind command Bind a design unit and prepare the link step: @example ghdl --bind [options] primary_unit [secondary_unit] @end example This command is only available on GNU/Linux. This performs only the first stage of the elaboration command; the list of objects files is created but the executable is not built. This command should be used only when the main entry point is not ghdl. @node Link command,List link command,Bind command,Building commands @anchor{Invoking_GHDL link-command}@anchor{1d}@anchor{Invoking_GHDL id4}@anchor{1e} @subsection Link command @geindex linking @geindex --link command Link an already bound design unit: @example ghdl --link [options] primary_unit [secondary_unit] @end example This 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. @node List link command,Check syntax command,Link command,Building commands @anchor{Invoking_GHDL list-link-command}@anchor{1f}@anchor{Invoking_GHDL id5}@anchor{20} @subsection List link command @geindex --list-link command Display files which will be linked: @example ghdl --list-link primary_unit [secondary_unit] @end example This command is only available on GNU/Linux. This command may be used only after a bind command. GHDL displays all the files which will be linked to create an executable. This command is intended to add object files in a link of a foreign program. @node Check syntax command,Analyze and elaborate command,List link command,Building commands @anchor{Invoking_GHDL id6}@anchor{21}@anchor{Invoking_GHDL check-syntax-command}@anchor{22} @subsection Check syntax command @geindex checking syntax @geindex -s command Analyze files but do not generate code: @example ghdl -s [options] files @end example This command may be used to check the syntax of files. It does not update the library. @node Analyze and elaborate command,,Check syntax command,Building commands @anchor{Invoking_GHDL analyze-and-elaborate-command}@anchor{23}@anchor{Invoking_GHDL id7}@anchor{24} @subsection Analyze and elaborate command @geindex Analyze and elaborate command @geindex -c command Analyze files and elaborate them at the same time. On GNU/Linux: @example ghdl -c [options] file... -e primary_unit [secondary_unit] @end example On Windows: @example ghdl -c [options] file... -r primary_unit [secondary_unit] @end example This command combines analysis and elaboration: files are analyzed and the unit is then elaborated. However, code is only generated during the elaboration. On Windows the simulation is launched. To be more precise, the files are first parsed, and then the elaboration drives the analysis. Therefore, there is no analysis order, and you don't need to care about it. 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 smaller executable, since unused units and subprograms do not generate code. @end itemize However, you should know that currently most of the time is spent in code generation and the analyze and elaborate command generate 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. This command is still experimental. In case of problems, you should go back to the traditional way. @node GHDL options,Passing options to other programs,Building commands,Invoking GHDL @anchor{Invoking_GHDL ghdl-options}@anchor{13}@anchor{Invoking_GHDL id8}@anchor{25} @section GHDL options @geindex IEEE 1164 @geindex 1164 @geindex IEEE 1076.3 @geindex 1076.3 Besides the options described below, @cite{GHDL} passes any debugging options (those that begin with @code{-g}) and optimizations options (those that begin with @code{-O} or @code{-f}) to @cite{GCC}. Refer to the @cite{GCC} manual for details. @c option::--work= @c @c .. index:: WORK library @c @c Specify the name of the :samp:`WORK` library. Analyzed units are always @c placed in the library logically named :samp:`WORK`. With this option, @c you can set its name. By default, the name is :samp:`work`. @c @c `GHDL` checks whether :samp:`WORK` is a valid identifier. Although being @c more or less supported, the :samp:`WORK` identifier should not be an @c extended identifier, since the filesystem may prevent it from correctly @c working (due to case sensitivity or forbidden characters in filenames). @c @c `VHDL` rules forbid you to add units to the :samp:`std` library. @c Furthermore, you should not put units in the :samp:`ieee` library. @geindex command line option; --workdir= @anchor{Invoking_GHDL cmdoption--workdir}@anchor{26} @deffn {Option} @w{-}@w{-}workdir= 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 @ref{27,,-P} to specify where libraries other than @code{WORK} are placed. @end deffn @geindex command line option; --std= @anchor{Invoking_GHDL cmdoption--std}@anchor{28} @deffn {Option} @w{-}@w{-}std= Specify the standard to use. By default, the standard is @code{93c}, which means VHDL-93 accepting VHDL-87 syntax. For details on @code{STD} values see @ref{29,,VHDL standards}. @end deffn @geindex command line option; --ieee= @anchor{Invoking_GHDL cmdoption--ieee}@anchor{2a} @deffn {Option} @w{-}@w{-}ieee= @geindex ieee library @geindex synopsys library @geindex mentor library Select the @code{IEEE} library to use. @code{VER} 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 by your own a 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 packages @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 @ref{2b,,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}. The package is a slight variation of a definitely not standard but widely mis-used 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 command line option; -P @anchor{Invoking_GHDL cmdoption-P}@anchor{27} @deffn {Option} @w{-}P 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 @code{--workdir=} option, or in the current directory if the latter option is not specified. @end deffn @geindex command line option; -fexplicit @anchor{Invoking_GHDL cmdoption-fexplicit}@anchor{2c} @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 @ref{e,,IEEE library pitfalls}, for an example. 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 better to fix your design and use the @code{numeric_std} package. @end deffn @geindex command line option; -frelaxed-rules @anchor{Invoking_GHDL cmdoption-frelaxed-rules}@anchor{2d} @deffn {Option} @w{-}frelaxed@w{-}rules Within an object declaration, allow to reference 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 start at the @cite{constant} word. Because the constant @code{state1} and the enumeration literal @code{state1} are homograph, 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 command line option; -fpsl @anchor{Invoking_GHDL cmdoption-fpsl}@anchor{2e} @deffn {Option} @w{-}fpsl Enable parsing of PSL assertions within comments. See @ref{2f,,PSL implementation}, for more details. @end deffn @geindex command line option; --no-vital-checks @anchor{Invoking_GHDL cmdoption--no-vital-checks}@anchor{30} @deffn {Option} @w{-}@w{-}no@w{-}vital@w{-}checks @end deffn @geindex command line option; --vital-checks @anchor{Invoking_GHDL cmdoption--vital-checks}@anchor{31} @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 @ref{32,,VHDL restrictions for VITAL}, for more details. @end deffn @geindex command line option; --syn-binding @anchor{Invoking_GHDL cmdoption--syn-binding}@anchor{33} @deffn {Option} @w{-}@w{-}syn@w{-}binding 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 synthesizer rule. There are two key points: normal VHDL LRM rules are tried first and entities are searched only in known library. A known library is a library which has been named in your design. This option is only useful during elaboration. @end deffn @geindex command line option; --PREFIX= @anchor{Invoking_GHDL cmdoption--PREFIX}@anchor{34} @deffn {Option} @w{-}@w{-}PREFIX= Use @code{PATH} as the prefix path to find commands and pre-installed (std and ieee) libraries. @end deffn @geindex command line option; --GHDL1= @anchor{Invoking_GHDL cmdoption--GHDL1}@anchor{35} @deffn {Option} @w{-}@w{-}GHDL1= Use @code{COMMAND} as the command name for the compiler. If @code{COMMAND} is not a path, then it is searched in the path. @end deffn @geindex command line option; --AS= @anchor{Invoking_GHDL cmdoption--AS}@anchor{36} @deffn {Option} @w{-}@w{-}AS= 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}. @end deffn @geindex command line option; --LINK= @anchor{Invoking_GHDL cmdoption--LINK}@anchor{37} @deffn {Option} @w{-}@w{-}LINK= 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}. @end deffn @geindex command line option; -v @anchor{Invoking_GHDL cmdoption-v}@anchor{38} @deffn {Option} @w{-}v Be verbose. For example, for analysis, elaboration and make commands, GHDL displays the commands executed. @end deffn @node Passing options to other programs,GHDL Diagnostics Control,GHDL options,Invoking GHDL @anchor{Invoking_GHDL passing-options-to-other-programs}@anchor{39} @section Passing options to other programs These options are only available on GNU/Linux. For many commands, @cite{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 command line option; -Wc@comma{}