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
|
.. _BUILD:
Building GHDL from Sources
##########################
.. rubric :: Download
GHDL can be downloaded as a `zip-file <https://github.com/ghdl/ghdl/archive/master.zip>`_/`tar-file <https://github.com/ghdl/ghdl/archive/master.tar.gz>`_
(latest 'master' branch) or cloned with ``git clone`` from GitHub. GitHub
offers HTTPS and SSH as transfer protocols. See the :ref:`RELEASE:Sources`
page for further details.
.. IMPORTANT ::
Since GHDL is written in `Ada`, independently of the code generator you use,
the a compiler is required. Most GNU/Linux package managers provide a package
named ``gcc-ada`` or ``gcc-gnat``. Alternatively, `GNU Ada compiler`, `GNAT GPL`,
can be downloaded anonymously from `libre.adacore.com <http://libre.adacore.com/tools/gnat-gpl-edition/>`_ (2014, or later; for x86, 32 or 64 bits).
Then, untar and run the doinstall script.
.. rubric :: Available back-ends
GHDL currently supports three different back-ends (code generators):
* mcode - built-in x86 (or x86_64) code generator
* GCC - Gnu Compiler Collection (`gcc.gnu.org <http://gcc.gnu.org/>`_)
* LLVM - Low-Level Virtual Machine (`llvm.org <http://llvm.org/>`_)
Here is a short comparison, so that you can choose the one you want to use:
+----------------------------+----------------------------------------------------------------------------+---------------------------------------------------------+
| Back-end | Pros | Cons |
+============================+============================================================================+=========================================================+
| :ref:`mcode <BUILD:mcode>` | * Very easy to build | * Simulation is slower |
| | * Very quick analysis | * x86_64/i386 only |
| | * Can handle very large designs | |
+----------------------------+----------------------------------------------------------------------------+---------------------------------------------------------+
| :ref:`LLVM <BUILD:llvm>` | * Generated code is faster | * Build is more complex than mcode |
| | * Generated code can be debugged (with ``-g``) | |
| | * Easier to build than GCC | |
| | * Ported to many platforms (x86, x86_64, armv7/aarch64) | |
+----------------------------+----------------------------------------------------------------------------+---------------------------------------------------------+
| :ref:`GCC <BUILD:gcc>` | * Generated code is faster (particularly with ``-O`` or ``-O2``) | * Build is even more complex |
| | * Generated code can be debugged (with ``-g``) | * Analysis can take time (particularly for large units) |
| | * Ported to many platforms (x86, x86_64, PowerPC, SPARC) | * Code coverage collection (``gcov``) is unique to GCC |
+----------------------------+----------------------------------------------------------------------------+---------------------------------------------------------+
.. toctree::
:hidden:
Directories
mcode
LLVM
GCC
.. HINT ::
The output of both GCC and LLVM is an executable file, but `mcode` does not
generate any. Therefore, if using GCC/LLVM, the call with argument ``-r`` can
be replaced with direct execution of the binary. See section :ref:`USING:QuickStart`.
After making your choice, you can jump to the corresponding section.
However, we suggest you to read :ref:`BUILD:dir_structure` first, so that you
know where the content will be placed and which files are expected to be
created.
.. HINT ::
In these instructions, the configure script is executed in the source directory; but you can execute in a different
directory too, like this:
.. CODE:: Bash
$ mkdir ghdl-objs
$ cd ghdl-objs
$ ../path/to/ghdl/configure ...
.. 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.
* MINGW/MSYS2 builds depend on the environment/runtime.
* For 64 bit, no native compiler exists from AdaCore.
* That Ada to .NET compiler, which might work for 32 or 64 bit. is not up-to-date.
|