Correct Symbiflow instructions
[libreriscv.git] / HDL_workflow / symbiflow.mdwn
1 # Installation instructions for Symbiflow with Xilinx Artix7 100T Board
2
3 * <https://symbiflow.github.io/>
4 * <https://github.com/SymbiFlow>
5
6 WORK IN PROGRESS
7
8 ## Bugzilla page
9
10 * <https://bugs.libre-soc.org/show_bug.cgi?id=654>
11
12 ## TODO
13
14 * Installation with newest git commit of symbiflow-arch-defs
15
16 ## Setting up new debootstrap and chroot into it
17
18 Run the following if you wish to isolate the symbiflow build
19 from other software (reproducible builds) or use the schroot
20 auto-preparation script here:
21 <https://git.libre-soc.org/?p=dev-env-setup.git;a=blob;f=mk-deb-chroot;hb=HEAD>
22
23 export MY_CHROOT=/stable-chroot
24 mkdir $MY_CHROOT
25 debootstrap buster $MY_CHROOT http://deb.debian.org/debian/
26 mount -t proc proc $MY_CHROOT/proc
27 mount -t sysfs sysfs $MY_CHROOT/sys
28 mount -t devpts devpts $MY_CHROOT/dev/pts/
29 chroot $MY_CHROOT /bin/bash
30
31 ## Download neccessary softwares
32
33 apt-get install git wget
34
35 git clone https://github.com/steveicarus/iverilog.git
36 git clone https://github.com/YosysHQ/yosys.git
37 git clone https://github.com/YosysHQ/abc.git
38 git clone https://github.com/verilog-to-routing/vtr-verilog-to-routing.git
39 git clone https://github.com/cliffordwolf/icestorm.git
40 git clone https://github.com/SymbiFlow/prjxray.git
41 git clone https://github.com/SymbiFlow/yosys-symbiflow-plugins.git
42 git clone https://github.com/SymbiFlow/symbiflow-examples.git
43 git clone https://github.com/SymbiFlow/symbiflow-arch-defs.git
44 git clone https://github.com/QuickLogic-Corp/quicklogic-fasm.git
45 git clone https://github.com/QuickLogic-Corp/quicklogic-fasm-utils
46 #git clone https://github.com/SymbiFlow/symbiflow-rr-graph.git
47
48 wget http://xmlsoft.org/sources/libxml2-2.9.12.tar.gz
49 wget https://anaconda.org/LiteX-Hub/prjxray-db/0.0_248_g2e51ad3/download/linux-64/prjxray-db-0.0_248_g2e51ad3-20210317_102909.tar.bz2
50
51 # get yosys-proc.patch from Bug attachment file.
52
53 ## Steps to compile Icarus Verilog
54
55 ### Necessary software to install
56
57 apt-get install build-essential autoconf make g++ bison flex gperf libreadline6-dev
58
59 ### Build Icarus Verilog
60
61 cd iverilog
62 git checkout v11_0
63 sh autoconf.sh
64 ./configure --prefix=/usr/local/iverilog
65 make -j$(nproc)
66 make check
67 make install
68
69 Please adjust the install paths for iverilog.
70
71 ## Steps to compile Yosys
72
73 ### Necessary software to install
74
75 apt-get install -t buster_backports cmake
76 apt-get install python3 clang libreadline-dev gawk tcl-dev \
77 libffi-dev pkg-config libboost-system-dev libboost-python-dev \
78 libboost-filesystem-dev zlib1g-dev
79
80 ### Build Yosys
81
82 cd yosys
83 ln -s ../abc .
84 make -j $(nproc) PREFIX=/usr/local/symbiflow
85 make PREFIX=/usr/local/symbiflow install
86
87 ""Please adjust the install paths for Yosys.""
88
89 ## Steps to compile vtr-verilog-to-routing
90
91 ### Necessary software to install
92
93 # Only if want GUI place and route
94 #apt-get install libcairo2-dev libfontconfig1-dev libx11-dev libxft-dev \
95 #libgtk-3-dev
96
97 ### Build vtr-verilog-to-routing
98
99 cd vtr-verilog-to-routing
100 mkdir build; cd build
101 cmake -DBUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow ..
102 make -j $(nproc)
103 make install
104
105 ""Please adjust the install paths for vtr-verilog-to-routing.""
106
107 ## Steps to compile libxml2
108
109 * Newer version is needed which fixes a integer overflow error and is not
110 provided by Buster.
111
112 ### Necessary software to install
113
114 apt-get install python3-dev
115
116 ### Build libxml2
117
118 tar -xf libxml2-2.9.12.tar.gz
119 libxml2-2.9.12
120 ./configure --prefix=/usr/local/symbiflow --with-history --with-python=/usr/bin/python3
121 make -j $(nproc)
122 make install
123
124 ""Please adjust the install paths for vtr-verilog-to-routing.""
125
126 ## Steps to compile prjxray
127
128 ### Necessary software to install
129
130 ### Build prjxray
131
132 cd prjxray
133 git submodule update --init --recursive
134 mkdir build; cd build
135 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow ..
136 make
137 make install
138
139 ## Steps to compile yosys-symbiflow-plugins
140
141 ### Necessary software to install
142
143 ### Build yosys-symbiflow-plugins
144
145 cd yosys-symbiflow-plugins/
146 sed -i -e 's@include third_party/make-env/conda.mk@#include third_party/make-env/conda.mk@' Makefile
147 make
148 make install
149
150 ## Steps to compile Icestorm
151
152 ### Necessary software to install
153
154 apt-get install libftdi-dev
155
156 ### Build Icestorm
157
158 cd icestorm
159 make -j $(nproc) PREFIX=/usr/local/symbiflow
160 make install
161
162 ## Steps to compile prjxray-db
163
164 ### Install prjxray-db
165
166 tar --strip-components=2 -xf prjxray-db-0.0_248_g2e51ad3-20210312_125539.tar.bz2 share/symbiflow/prjxray-db
167
168 #!!ATTENTION!!
169
170 cat > /usr/local/symbiflow/bin/prjxray-config <<EOF
171 #!/bin/bash
172 echo /path/to/prjxray-db
173 EOF
174
175 chmod +x /usr/local/symbiflow/bin/prjxray-config
176
177 ## Steps to compile symbiflow-arch-defs
178
179 ## Necessary software to install
180
181 apt-get install nodejs npm python3-pytest openocd flake8 python3-pip \
182 default-jre-headless libantlr4-runtime-dev cython3 python3-numpy \
183 python3-intervaltree python3-simplejson python3-intelhex \
184 python3-importlib-metadata python3-jsonschema python3-packaging \
185 python3-pyparsing python3-pyrsistent python3-tqdm python3-zipp \
186 python3-typing-extensions python3-ply
187
188 pip3 install textx fasm pyjson5 pyyaml tinyfpgab tinyprog pyjson lxml \
189 progressbar2 hilbertcurve==1.0.5 pycapnp==1.0.0b1 python-constraint \
190 parameterized yapf==0.26.0
191
192 cd symbiflow-arch-defs
193 git submodule init
194 git submodule update --init --recursive
195 pip3 install -e third_party/prjxray
196 pip3 install -e third_party/xc-fasm
197 pip3 install ../quicklogic-fasm-utils
198 pip3 install ../quicklogic-fasm
199 cd third_party/qlf-fasm; git checkout master; cd ../..;
200 pip3 install -e third_party/qlf-fasm
201 cd quicklogic/common/utils/quicklogic-timings-importer;
202 git checkout master; cd ../../../../;
203 pip3 install -e quicklogic/common/utils/quicklogic-timings-importer
204 pip3 install -e third_party/vtr-xml-utils
205 pip3 install -e third_party/python-symbiflow-v2x
206 pip3 install -e third_party/python-sdf-timing
207 #pip3 install ../symbiflow-rr-graph
208 pip3 install -e third_party/symbiflow-xc-fasm2bels
209
210 export PATH=/usr/local/iverilog/bin:/usr/local/symbiflow/bin:$PATH
211
212 mkdir -p env/conda/envs
213 ln -s /usr/local/symbiflow env/conda/envs/symbiflow_arch_def_base
214
215 git checkout d5d69edeadcf28b36d75c1cb515b145fc6775c3c
216
217 sed -i -e 's@add_subdirectory(litex)@#add_subdirectory(litex)@g' -e 's@add_subdirectory(ibex)@#add_subdirectory(ibex)@g' xc/xc7/tests/soc/CMakeLists.txt
218
219 patch -p1 -i yosys-proc.patch
220
221 ### Build symbiflow-arch-defs-xc7-artix7_100t
222
223 mkdir build; cd build
224 #!!ATTENTION change path to prjxray-db
225 cmake -DUSE_CONDA=FALSE -DPRJXRAY_DB_DIR=/path/to/prjxray-db -DINSTALL_FAMILIES=xc7 -DINSTALL_ARCHS=artix7_100t -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow ..
226 cd xc/xc7/archs/artix7_100t
227 make install
228 make file_xc_xc7_archs_artix7_100t_channels_xc7a100tcsg324-1_channels.db
229 cd ../..;
230 make PINMAP_INSTALL_arty100t-full_xc7a100t_test_arty100t-full_pinmap.csv
231 mkdir -p /usr/local/symbiflow/share/symbiflow/arch/xc7a100t_test/xc7a100tcsg324-1
232 cp arty100t-full_pinmap.csv /usr/local/symbiflow/share/symbiflow/arch/xc7a100t_test/xc7a100tcsg324-1
233
234 # Now you can skip to symbiflow-examples.git for external test
235
236 # To do builtin counter test; it should build top.bit as final bitstream
237 cd tests/counter
238 make counter_arty100t_bit
239
240 ### Build symbiflow-arch-defs-xc7-artix7
241
242 mkdir build_artix7; cd build_artix7
243 #!!ATTENTION change path to prjxray-db
244 cmake -DUSE_CONDA=FALSE -DPRJXRAY_DB_DIR=/path/to/prjxray-db -DINSTALL_FAMILIES=xc7 -DINSTALL_ARCHS=artix7_100t -DINSTALL_DEVICES=artix7 -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow ..
245 cd xc/xc7/archs/artix7
246 make install
247 mkdir -p /usr/local/symbiflow/share/symbiflow/arch/xc7a50t_test/xc7a50tfgg484-1
248
249 #!!ATTENTION!!
250 python3 ../../../common/utils/prjxray_create_pinmap_csv.py --output /usr/local/symbiflow/share/symbiflow/arch/xc7a50t_test/xc7a50tfgg484-1/pinmap.csv --connection_database channels/xc7a50tfgg484-1/channels.db --package_pins /path/to/prjxray-db/artix7/xc7a50tfgg484-1/package_pins.csv
251
252 # Now you can skip to symbiflow-examples.git for external test
253 # Currently I have to modify it to artix7_x50t
254
255 # To do builtin counter test; it should build top.bit as final bitstream
256 # If the make target has not been built by cmake then you have to run
257 # cmake without -DINSTALL_DEVICES=artix7
258 cd ../..
259 cd tests/counter
260 make counter_arty_bit
261
262 ## Steps to compile symbiflow-examples
263
264 ### Build symbiflow-arch-defs-xc7-artix7_100t
265
266 cd symbiflow-examples
267 cd xc7
268 TARGET="arty_100" make -C counter_test
269
270 # Should produce top.bit bitstream