update ghdl.mdwn
[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
64 ### Installing ghdl, yosys, and ghdl-yosys-plugin in a Debian chroot
65
66 This has been done on an AMD64 machine, the build failed on my Talos II.
67
68 debootstrap bullseye /var/chroot/bullseye_ghdl
69 chroot /var/chroot/bullseye_ghdl
70
71 put some 'deb-src' URIs in your sources.list
72
73 apt-get update
74 apt-get upgrade
75 apt-get build-dep ghdl
76 apt-get install git
77 cd /root/
78 git clone https://github.com/ghdl/ghdl
79 cd ghdl
80 ./configure
81 make
82 make install
83 cd ..
84
85 apt-get build-dep yosys
86 git clone https://github.com/YosysHQ/yosys
87 cd yosys
88 make
89 make install
90
91 git clone https://github.com/ghdl/ghdl-yosys-plugin
92 cd ghdl-yosys-plugin
93 make
94 make install
95
96 [optional] apt-get install verilator
97 exit # exit the chroot
98
99 Then install schroot and create a config file
100 nano /etc/schroot/chroot.d/bullseye_ghdl
101
102 [bullseye_ghdl]
103 description=chroot
104 type=directory
105 directory=/var/chroot/bullseye_ghdl
106 users=your_username
107
108 After installing ghdl-yosys-plugin you can build [[microwatt]]