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
|
.. _BUILD:
Building GHDL from Sources
##########################
.. rubric:: Download
GHDL can be downloaded as a `zip-file <https://github.com/tgingold/ghdl/archive/master.zip>`_
(latest 'master' branch) or cloned with ``git clone`` from GitHub. GitHub
offers HTTPS and SSH as transfer protocols. See the :ref:`Download <GETTING:Download>`
page for further details. The installation directory is referred to as ``GHDLRoot``.
+----------+-----------------------------------------------------------+
| Protocol | Git Clone Command |
+==========+===========================================================+
| HTTPS | ``git clone https://github.com/tgingold/ghdl.git ghdl`` |
+----------+-----------------------------------------------------------+
| SSH | ``git clone ssh://git@github.com:tgingold/ghdl.git ghdl`` |
+----------+-----------------------------------------------------------+
.. rubric:: Available back-ends
GHDL currently supports three supported different back-ends (code generators):
* `mcode` (built-in),
* `GCC <http://gcc.gnu.org/>`_, and
* `LLVM <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 | * ``x86_64``/``i386`` only |
| | * Very quick analysis | * Simulation is slower |
| | * Can handle very large designs | |
+----------------------------+----------------------------------------------------------------------------+---------------------------------------------------------+
| :ref:`GCC <BUILD:gcc>` | * Generated code is faster (particularly with ``-O`` or ``-O2``) | * Analysis can take time (particularly for large units) |
| | * Generated code can be debugged (with ``-g``) | * Build is more complex |
| | * Ported to many platforms (``x86``, ``x86_64``, ``powerpc``, ``sparc``) | * Code coverage collection (``gcov``) is unique to GCC |
+----------------------------+----------------------------------------------------------------------------+---------------------------------------------------------+
| :ref:`LLVM <BUILD:llvm>` | * Same as GCC | |
| | * Easier to build than GCC | |
+----------------------------+----------------------------------------------------------------------------+---------------------------------------------------------+
.. toctree::
:hidden:
Directories
With mcode Backend <mcode/index>
With LLVM Backend <llvm/index>
With GCC Backend <gcc/index>
TestSuites
.. 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` before, so that you
know where the content is placed and which temporal files are expected to be
created.
.. HINT::
Since GHDL is written in `Ada`, independently of the code generator you use,
the `GNU Ada compiler`, `GNAT GPL`, is required, 2014 (or later) for ``x86``
(32 or 64 bits). `GNAT GPL` can be downloaded anonymously from `libre.adacore.com <http://libre.adacore.com/tools/gnat-gpl-edition/>`_.
Then, untar and run the doinstall script. Alternatively, most GNU/Linux
provide a package named ``gcc-ada`` or ``gcc-gnat``.
.. TODO::
* @1138 Backtraces optional -patchable-
* Very briefly, why is mcode faster for analysis and GCC/LLVM for simulation?
* The only other dependency is zlib (On ubuntu/debian, install zlib1g-dev).
* From :ghdlsharp:`279`:
* GCC: GHDL generates an intermediate representation for GCC, which creates an executable. So GHDL acts a a new language frontend like C for the GCC and uses the existing backend to generated e.g. x86(-64) binary code.
* LLVM: GHDL generates instructions for the LLVM abstract register machine, which then generates x86(-64) instructions for the host system.
* mcode: GHDL generates the x86(-64) instructions in memory and executes the model.
* gcc is currently only supported on Linux, because you need to compile a complete GCC from zero and add GHDL as a frontend into the GCC. Compiling the complete GCC suite plus GHDL takes a lot of time. I think it's not possible to finish the compile task in the bounds of a Travis-CI run.
|