Add pages for GHDL setup and use.
[libreriscv.git] / HDL_workflow / ghdl.mdwn
1 # Installation instructions for GHDL
2
3 ## Setting up new debootstrap and chroot into it
4
5 Run the following if you wish to isolate the ghdl build
6 from other software (reproducible builds) or use the schroot
7 auto-preparation script here:
8 <https://git.libre-soc.org/?p=dev-env-setup.git;a=blob;f=mk-deb-chroot;hb=HEAD>
9
10 export MY_CHROOT=/stable-chroot
11 mkdir $MY_CHROOT
12 debootstrap stable $MY_CHROOT http://deb.debian.org/debian/
13 mount -t proc proc $MY_CHROOT/proc
14 mount -t sysfs sysfs $MY_CHROOT/sys
15 mount -t devpts devpts $MY_CHROOT/dev/pts/
16 chroot $MY_CHROOT /bin/bash
17
18 ## Steps to compile GHDL
19
20 ### Necessary software to install
21
22 apt-get install git gnat gcc make g++ file texinfo zlib1g-dev
23
24 git clone https://github.com/ghdl/ghdl.git
25 wget https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.xz
26 wget https://ftp.gnu.org/gnu/mpc/mpc-1.2.1.tar.gz
27 wget https://www.mpfr.org/mpfr-4.1.0/mpfr-4.1.0.tar.xz
28 wget https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2
29 wget https://ftp.gnu.org/gnu/gcc/gcc-10.3.0/gcc-10.3.0.tar.xz
30
31 ### Build GHDL
32
33 tar -xf gcc-10.3.0.tar.xz
34 cd gcc-10.3.0
35 tar -xf ../gmp-6.2.1.tar.xz
36 mv gmp-6.2.1 gmp
37 tar -xf ../mpc-1.2.1.tar.gz
38 mv mpc-1.2.1 mpc
39 tar -xf ../mpfr-4.1.0.tar.xz
40 mv mpfr-4.1.0 mpfr
41 tar -xf ../isl-0.18.tar.bz2
42 mv isl-0.18 isl
43 cd ..
44
45 cd ghdl
46 git checkout v1.0.0
47 mkdir build
48 cd build
49 ../configure --with-gcc=../../gcc-10.3.0 --prefix=/usr/local/ghdl
50 make copy-sources
51 mkdir gcc-objs; cd gcc-objs
52 ../../../gcc-10.3.0/configure --prefix=/usr/local/ghdl \
53 --enable-languages=c,vhdl --disable-bootstrap --disable-lto \
54 --disable-multilib --disable-libssp --disable-libgomp \
55 --disable-libquadmath --enable-default-pie
56 make -j$(nproc)
57 make install
58 cd ..
59 make ghdllib
60 make install
61
62 Please adjust the install paths for ghdl.
63