fosdem2024_bigint: improve sv.adde diagram
[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 Use this script here to save some time and mistakes <https://git.libre-soc.org/?p=dev-env-setup.git;a=blob;f=ghdl-install>
21
22 ### Necessary software to install
23
24 apt-get install git gnat gcc make g++ file texinfo zlib1g-dev
25
26 git clone https://github.com/ghdl/ghdl.git
27 wget https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.xz
28 wget https://ftp.gnu.org/gnu/mpc/mpc-1.2.1.tar.gz
29 wget https://www.mpfr.org/mpfr-4.1.0/mpfr-4.1.0.tar.xz
30 wget https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2
31 wget https://ftp.gnu.org/gnu/gcc/gcc-10.3.0/gcc-10.3.0.tar.xz
32
33 ### Build GHDL
34
35 tar -xf gcc-10.3.0.tar.xz
36 cd gcc-10.3.0
37 tar -xf ../gmp-6.2.1.tar.xz
38 mv gmp-6.2.1 gmp
39 tar -xf ../mpc-1.2.1.tar.gz
40 mv mpc-1.2.1 mpc
41 tar -xf ../mpfr-4.1.0.tar.xz
42 mv mpfr-4.1.0 mpfr
43 tar -xf ../isl-0.18.tar.bz2
44 mv isl-0.18 isl
45 cd ..
46
47 cd ghdl
48 git checkout v1.0.0
49 mkdir build
50 cd build
51 ../configure --with-gcc=../../gcc-10.3.0 --prefix=/usr/local/ghdl
52 make copy-sources
53 mkdir gcc-objs; cd gcc-objs
54 ../../../gcc-10.3.0/configure --prefix=/usr/local/ghdl \
55 --enable-languages=c,vhdl --disable-bootstrap --disable-lto \
56 --disable-multilib --disable-libssp --disable-libgomp \
57 --disable-libquadmath --enable-default-pie
58 make -j$(nproc)
59 make install
60 cd ..
61 make ghdllib
62 make install
63
64 Please adjust the install paths for ghdl.
65
66 ### Installing ghdl, yosys, and ghdl-yosys-plugin in a Debian chroot
67
68 Verified to work on a Talos II workstation (Debian Bullseye)
69
70 debootstrap bullseye /var/chroot/bullseye_ghdl
71 chroot /var/chroot/bullseye_ghdl
72
73 put some 'deb-src' URIs in your sources.list
74
75 apt-get update
76 apt-get upgrade
77 apt-get build-dep ghdl
78 apt-get install git
79 cd /root/
80 git clone https://github.com/ghdl/ghdl
81 cd ghdl
82 ./configure --with-llvm-config
83 make
84 make install
85 cd ..
86
87 apt-get build-dep yosys
88 git clone https://github.com/YosysHQ/yosys
89 cd yosys
90 make
91 make install
92
93 git clone https://github.com/ghdl/ghdl-yosys-plugin
94 cd ghdl-yosys-plugin
95 make
96 make install
97
98 [optional] apt-get install verilator
99 exit # exit the chroot
100
101 Then install schroot and create a config file
102 nano /etc/schroot/chroot.d/bullseye_ghdl
103
104 [bullseye_ghdl]
105 description=chroot
106 type=directory
107 directory=/var/chroot/bullseye_ghdl
108 users=your_username
109
110 After installing ghdl-yosys-plugin you can build [[microwatt]]