aboutsummaryrefslogtreecommitdiffstats
path: root/doc/references/CommandReference.rst
blob: 771d2386e0bccb1a7e7640f9664314b947d909f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
.. _REF:Command:

Command Reference
#################

.. HINT:: The most common commands and options are shown in section :ref:`USING:Invoking`. Here the advanced and experimental features are described.

Misc commands
=============

There are a few GHDL commands which are seldom useful.

.. _Help_command:

Help [:samp:`-h`]
------------

.. index:: -h command

.. index:: --help command

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 this later command are displayed::

  ghdl --help
  ghdl -h
  ghdl -h command


.. _Disp_config_command:

Display config [:samp:`--disp-config`]
-------------------

.. index:: --disp-config command

.. index:: display configuration

:samp:`ghdl --disp-config [options]`

Display the program paths and options used by GHDL. This may be useful to track installation errors.

Display standard [:samp:`--disp-standard`]
---------------------

.. index:: --disp-standard command

.. index:: display :samp:`std.standard`

:samp:`ghdl --disp-standard [options]`

Display the :samp:`std.standard` package.

Version [:samp:`--version`]
---------------

.. index:: --version command

.. index:: version

:samp:`ghdl --version`

Display the `GHDL` version and exit.

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.

Pretty print [:samp:`--pp-html`]
--------------------

.. index:: --pp-html command

.. index:: pretty printing

.. index:: vhdl to html

:samp:`ghdl --pp-html [options] file...`

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 :option:`--format=` option:

* By default or when the :option:`--format=html2` option is specified, the output is an HTML 2.0 file, with colours set through `<FONT>` tags.
* When the :option:`--format=css` option is specified, the output is an HTML 4.0 file, with colours set through a CSS file, whose name is :file:`ghdl.css`. See :ref:`Cross-reference_command`, for more details about this CSS file.

Find [:samp:`-f`]
------------

.. index:: -f command

:samp:`ghdl -f file...`

The files are scanned, parsed and the names of design units are displayed. Design units marked with two stars are candidate to be at the apex of a design hierarchy.

Chop [:samp:`--chop`]
------------

.. index:: --chop command

:samp:`ghdl --chop files`

The provided files are read, and a file is written in the current directory for every design unit. Each filename is build according to the type:

* For an entity declaration, a package declaration or a configuration the file name is :file:`NAME.vhdl`, where `NAME` is the name of the design unit.
* For a package body, the filename is :file:`NAME-body.vhdl`.
* Finally, for an architecture `ARCH` of an entity `ENTITY`, the filename is :file:`ENTITY-ARCH.vhdl`.

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 has not enough memory to compile such files. The size of the executable is reduced too.

Lines [:samp:`--lines`]
-------------

.. index:: --lines command

:samp:`ghdl --lines files`

Display on the standard output lines of files preceded by line number.

GCC/LLVM only commands
=================

.. _Bind_command:

Bind [:samp:`--bind`]
------------

.. index:: binding

.. index:: --bind command

:samp:`ghdl --bind [options] primary_unit [secondary_unit]`

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.

.. _Link_command:

Link [:samp:`--link`]
------------

.. index:: linking

.. index:: --link command

:samp:`ghdl --link [options] primary_unit [secondary_unit]`
  
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.

.. _List_link_command:

List link [:samp:`--list-link`]
-----------------

.. index:: --list-link command

:samp:`ghdl --list-link primary_unit [secondary_unit]`

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.

GHDL options
=================

.. option:: --syn-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.

.. option:: --GHDL1=<COMMAND>

  Use :samp:`COMMAND` as the command name for the compiler.  If :samp:`COMMAND` is
  not a path, then it is searched in the path.

.. option:: --AS=<COMMAND>

  Use :samp:`COMMAND` as the command name for the assembler.  If :samp:`COMMAND` is
  not a path, then it is searched in the path.  The default is :samp:`as`.

.. option:: --LINK=<COMMAND>

  Use :samp:`COMMAND` as the linker driver.  If :samp:`COMMAND` is
  not a path, then it is searched in the path.  The default is :samp:`gcc`.
  
Passing options to other programs
=================================

.. WARNING:: These options are only available with GCC/LLVM.

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.

.. option:: -Wc,<OPTION>

  Pass `OPTION` as an option to the compiler.

.. option:: -Wa,<OPTION>

  Pass `OPTION` as an option to the assembler.

.. option:: -Wl,<OPTION>

  Pass `OPTION` as an option to the linker.