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
|
.. _BUILD:
Building GHDL
#############
GHDL currently supports three supported different backends (code generators): mcode, GCC and LLVM. Here is a short comparison, so that you can choose the one you want to use:
* mcode (an internal code generator)
+ very easy to build
- but x86_64/i386 only
+ very quick analysis time
+ can analyze very big designs
- simulation is slower
- no executable created
* GCC
+ generated code is faster (particularly with -O or -O2)
+ generated code can be debugged (with -g)
+ the output is an executable
+ ported to many platforms (x86, x86_64, powerpc, sparc)
- analyze can takes time (particularly for big units)
- build is more complex
* LLVM
+ same advantages of gcc (good generated code, debuggable)
+ easier to build than gcc
As GHDL is written in Ada, you need to use the GNU Ada compiler (GNAT). I recommend to use GNAT GPL from http://libre.adacore.com (free). GHDL was tested with GNAT GPL 2014. Any later version should work.
The only other dependency is zlib (On ubuntu/debian, install zlib1g-dev).
.. TODO::
- `./doc/oldmds/BUILD.txt <https://github.com/tgingold/ghdl/blob/master/doc/oldmds/BUILD.txt>`_
- Directory structure of the main branch [1138: #279]
- Coverage, `gcov`, is unique to gcc. That specific difference is not explained anywhere. Should be added.
- @1138 Backtraces optional -patchable-
- Very briefly, why is mode faster for analysis and GCC/LLVM for simulation?
Mcode backend
=================
- Linux
This is as simple as:
$ ./configure --prefix=PREFIX
where PREFIX is the directory for installation
$ make
This builds the ghdl_mcode executable, which can be used as is.
$ make install
To install within PREFIX
- Windows MinGW 32/64
- Windows GNAT GPL (32 only)
.. TODO::
Note: this was tested with Windows XP SP2 familly edition.
Note: If you want to create the installer, GHDL should be built on a FAT partition. NSIS rounds files date to be FAT compliant (seconds are always even) and because GHDL stores dates, the files date must not be modified.
The Ada95 GNAT compiler (GNAT GPL 2005 is known to work), along with NSIS to create the installer. Then unzip, edit winbuild to use correct path for makensis, and run winbuild. The installer is in the windows directory.
LLVM backend
=================
- Linux
You need to build and install llvm. The supported versions are 3.5
till 3.9, but only debugging is only supported with llvm 3.5
(Usually llvm also depends on libedit).
First configure ghdl with '--with-llvm-config'
$ ./configure --with-llvm-config
If llvm-config is not in your path, you can specify it:
$ ./configure --with-llvm-config=LLVM_INSTALL/bin/llvm-config
If you want to have stack backtraces on errors (like assert failure or
index of out bounds), you need to configure and build libbacktrace from gcc
(you don't need to configure gcc), and add to configure:
--with-backtrace-lib=/path-to-gcc-build/libbacktrace/.libs/libbacktrace.a
Then build with 'make' and install with 'make install'.
- Mac OS?
- Windows MinGW 32/64
GCC backend
=================
- Linux
You need to download and untar the sources of
gcc version 4.9 [do not modify this line as this is read by scripts].
First configure ghdl, specify gcc source dir and prefix.
(replace /usr/local by your prefix directory):
$ ./configure --with-gcc=/path/to/gcc/source/dir --prefix=/usr/local
Then invoke make to copy ghdl sources in the source dir:
$ make copy-sources
There are some dependencies for building gcc (gmp, mpfr and mpc). If you have
not them installed on your system, you can either build them manually or use
the 'download_prerequisite' script provided in gcc source tree (recommended).
$ cd /path/to/gcc/source/dir
$ ./contrib/download_prerequisites
Then configure gcc. The list of --disable configure options could be
adjusted for your needs. GHDL don't require all these optional
libraries and disabling them speed-up the build. Note the prefix
directory must be the same as the one used to configure ghdl.
If you have manually built gmp/mpfr/mpc (without using the script
in contrib) and if you have installed them in a non-standard
directory, you may need to add --with-gmp=GMP_INSTALL_DIR.
$ mkdir gcc-objs; cd gcc-objs
$ ../gcc-4.9.3/configure --prefix=/usr/local --enable-languages=c,vhdl \
--disable-bootstrap --disable-lto --disable-multilib \
--disable-libssp --disable-libgomp --disable-libquadmath
$ make -j2
Install gcc:
$ make install
or if you don't want to install makeinfo:
$ make install MAKEINFO=true
Build and install vhdl libraries:
$ cd /path/to/ghdl/source/dir
$ make ghdllib
$ make install
- Windows?
.. TODO:
Since the content of BUILD.txt is moved to the docs, what shall we do with this line? +gcc version 6.3 [do not modify this line as this is read by scripts].
Note for ppc64 (and AIX ?) platform: the object file format contains an identifier for the source language. Because gcc doesn't know about the VHDL, gcc crashes very early. This could be fixed with a very simple change in gcc/config/rs6000/rs6000.c, function rs6000_output_function_epilogue (as of gcc 4.8):
else if (! strcmp (language_string, "GNU Objective-C"))
i = 14;
else
- gcc_unreachable ();
+ i = 0;
fprintf (file, "%d,", i);
/* 8 single bit fields: global linkage (not set for C extern linkage,
Install file for the binary distribution of GHDL. The binary are installed in /usr/local directory. You cannot change this default location, unless you set links. You must be root to install this distribution. To install ghdl: `tar -C / -jxvf @TARFILE@.tar.bz2`. Note: you must also have a C compiler and zlib installed.
- Notes for developpers
Developping with the gcc backend:
Once gcc (with ghdl) has been built once, it is possible to work on ghdl
sources tree without copying them in gcc tree. Commands are:
$ make ghdl1-gcc # To build the compiler
$ make ghdl_gcc # To build the driver
$ make libs.vhdl.local_gcc # To compile the vhdl libraries
$ make grt-all # To build the ghdl runtime
$ make grt.links # To locally install the ghdl runtime
.. TODO::
gcc object dir
Test suites
=================
.. TODO::
@1138 explain that there are two (maybe three with vhdl08 tests)
|