(no commit message)
[libreriscv.git] / HDL_workflow / coriolis2.mdwn
1 # Installing Coriolis2
2
3 ## debootstrap
4
5 First set up an schroot debootstrap jail with debian 10.
6 These instructions are based on information taken from here:
7 <https://www.debian.org/releases/stretch/amd64/apds03.html.en>
8
9 In advance, on the host system, edit /etc/fstab and add mount points:
10
11 (edit: personally I prefer using mount --bind points. however if doing
12 that then after a reboot the chroot will lose the bind mountpoints
13 and the commands need to be re-run, without which the chroot is
14 unusable)
15
16 /dev /home/chroot/coriolis/dev none bind 0 0
17 /dev/pts /home/chroot/coriolis/dev/pts none bind 0 0
18 /proc /home/chroot/coriolis/proc none bind 0 0
19 /sys /home/chroot/coriolis/sys none bind 0 0
20 /tmp /home/chroot/coriolis/tmp none bind 0 0
21
22 Then run these commands:
23
24 sudo bash
25 apt-get install debootstrap schroot
26 mkdir /opt/chroot/coriolis
27 /usr/sbin/debootstrap buster !$ http://ftp.us.debian.org/debian
28 mount /home/chroot/coriolis/dev
29 mount /home/chroot/coriolis/dev/pts
30 mount /home/chroot/coriolis/proc
31 mount /home/chroot/coriolis/sys
32 mount /home/chroot/coriolis/tmp
33 echo "coriolis2" > /home/chroot/coriolis/etc/debian_chroot
34
35 To do some preparation (users):
36
37 chroot /home/chroot/coriolis2 /bin/bash
38 adduser {yourpreferredusername}
39
40 It is best to make the username the same as the first user that
41 was added during the *main* (non-chroot) debian install, so that
42 uid 1000 matches between both main and chroot. You can check
43 this by looking at /etc/passwd as root, or by typing "id".
44
45 lkcl@fizzy:~$ id
46 uid=1000(lkcl) gid=1000(lkcl) groups=1000(lkcl),5(tty),....
47
48 Alternatively, /etc/passwd and /etc/group may
49 be mount-bound as well as /home however if you later forget you did
50 this and decide to delete the chroot, you will delete the entire /home
51 of your main system, as well as /etc/passwd.
52
53 You may wish to follow some of the other things such as configuring apt,
54 locales and keyboard, from the above-linked debian-admin HOWTO.
55 bootloader, kernel, ssh access, all these are
56 unnecessary. do run "apt clean" to clear out /var/cache/apt/archives
57 in the chroot.
58
59 ## schroot
60
61 Create an schroot file section for the coriolis chroot by
62 editing /etc/schroot/schroot.conf:
63
64 [coriolis]
65 description=Debian Buster for Coriolis
66 directory=/home/chroot/coriolis
67 groups=sbuild-security,lkcl,users
68
69 Now as an *ordinary* user - not as root - you may type:
70
71 lkcl@fizzy:~$ schroot -c coriolis
72
73 and, due to the contents of /etc/debian\_chroot, and that you were in
74 fact logged in as uid 1000 and did in fact add a user to the chroot
75 as uid 1000, the prompt should become:
76
77 (coriolis2)lkcl@fizzy:~$
78
79 If however you need to run as root, then from outside the chroot,
80 as *root*, you run this:
81
82 lkcl@fizzy:~# schroot -c coriolis
83
84 and you will see this as a result:
85
86 (coriolis2)lkcl@fizzy:~#
87
88 ## check out alliance and alliance-check-toolkit
89
90 Adapted from <https://www-soc.lip6.fr/en/team-cian/softwares/alliance/>
91
92 in the schroot:
93
94 git clone https://gitlab.lip6.fr/vlsi-eda/alliance-check-toolkit.git
95
96 TODO: document how to build alliance, basically this:
97
98 In the chroot, as root:
99
100 apt-get update
101 apt-get install ccache git build-essential libtool automake \
102 flex bison xfig imagemagick \
103 texlive texlive-pictures texlive-latex-extra \
104 libx11-dev libxt-dev libxaw7-dev libxpm-dev libmotif-dev
105
106 In the chroot, as the ordinary schroot user, in ~/.bash\_profile add
107 the following so that builds (rebuilds) if you need them will be quicker:
108
109 export PATH=/usr/lib/ccache:"$PATH"
110
111 In the chroot, as the ordinary schroot user:
112
113 mkdir -p alliance/build alliance/install
114 cd ~/alliance
115 git clone https://gitlab.lip6.fr/vlsi-eda/alliance.git
116 cd alliance/src
117 ./autostuff
118 cd ~/alliance/build
119 export ALLIANCE_TOP=$HOME/alliance/install
120 export LD_LIBRARY_PATH=${ALLIANCE_TOP}/lib:${LD_LIBRARY_PATH}
121 export LD_LIBRARY_PATH=${ALLIANCE_TOP}/lib64:${LD_LIBRARY_PATH}
122 ../alliance/src/configure --prefix=$ALLIANCE_TOP --enable-alc-shared
123 make -j1 install
124
125 the two exports are best added to ~/.bash_profile for later convenience
126
127 ## coriolis2
128
129 These are nominally taken from
130 <https://www-soc.lip6.fr/equipe-cian/logiciels/coriolis/>
131 however there are errors in the original at the moment.
132 Do not try qt5, it will not work.
133
134 In ~/.bash\_profile add the following so that builds (rebuilds) if you need
135 them will be quicker, and you can run the GUI from the chroot:
136
137 export PATH=/usr/lib/ccache:"$PATH"
138 export DISPLAY=:0.0
139
140 Second (or at a new terminal / xterm), log in as root on the host (not
141 the chroot) then do schroot -c coriolis to get to be root in the chroot
142 (or, you can install sudo in the chroot and then do "sudo bash" in the
143 chroot).
144
145 Then run the following commands, as root, *in* the chroot:
146
147 apt-get update
148 apt-get install -y ccache build-essential binutils-dev \
149 git cmake bison flex gcc python-dev \
150 libboost-all-dev libboost-python-dev \
151 zlib1g-dev \
152 libbz2-dev libxml2-dev rapidjson-dev libbz2-dev \
153 doxygen dvipng graphviz python-sphinx \
154 texlive-fonts-extra texlive-lang-french \
155 libqwt-dev qt4-dev-tools python-qt4 \
156 libxt-dev libxpm-dev libmotif-dev \
157 yosys
158
159 Then, as the ordinary (non-root) user in the schroot:
160
161 mkdir -p ~/coriolis-2.x/src
162 cd ~/coriolis-2.x/src
163 git clone https://gitlab.lip6.fr/vlsi-eda/coriolis.git
164
165 cd coriolis
166 git checkout devel
167 ./bootstrap/ccb.py --project=coriolis --make="-j4 install"
168
169 In debian/buster at the moment, this will fail half-way through, due to
170 libraries not being found. When that happens run this:
171
172 ln -s ~/coriolis-2.x/Linux.x86_64/Release.Shared/install/lib64 \
173 ~/coriolis-2.x/Linux.x86_64/Release.Shared/install/lib
174
175 Then carry on with the build.
176
177 To set up the coriolis2 environment, run this:
178
179 eval `~/coriolis-2.x/src/coriolis/bootstrap/coriolisEnv.py`
180
181 For convenience that may be placed in a file and "sourced", to avoid
182 having to look this page up every time
183
184 echo "eval `~/coriolis-2.x/src/coriolis/bootstrap/coriolisEnv.py`" > \
185 ~/coriolisenv
186 source ~/coriolisenv
187
188 ## Testing coriolis2
189
190 To run the graphical editor go to the bin directory
191
192 cd ~/coriolis-2.x/Linux.MyARCH/Release.Shared/install/bin
193 ./cgt
194
195 Then run the following commands from the menubar
196
197 Tutorials / Run Demo (Python Flavour)
198
199 If the following window appears you have an error.
200
201 [[!img chicken.png ]]
202
203 click on the chicken several times
204
205 If you have the following, congratulations:
206
207 [[!img demo_cell.png ]]
208
209 # Tutorials and checks
210
211 Install alliance-check-toolkit in the chroot:
212
213 * <https://gitlab.com/Chips4Makers/alliance-check-toolkit>
214 * See coriolis-2.x/Linux.x86_64/Release.Shared/install/share/doc/coriolis2/en/html/main/PythonTutorial/index.html
215
216 Run the following (if not done already):
217
218 source ~/coriolisenv
219
220 Then, picking a random example:
221
222 cd alliance-check-toolkit/benchs/AM2901/standart_cells/cmos
223 make lvx
224 make view
225
226 A nice view of a chip should appear
227
228 ## Information from Jean-Paul
229
230 There should be very soon a website at https://coriolis.lip6.fr (it is not yet
231 online). Where I intend to put all the documentation about Alliance/Coriolis.
232
233 In the meantime did you find the doc shipped with Coriolis ?
234
235 There are also very cursory informations about installing Alliance here:
236 https://www-soc.lip6.fr/en/team-cian/softwares/alliance/
237
238 You also have a third repository for various blocks/chip/examples here:
239 https://gitlab.lip6.fr/jpc/alliance-check-toolkit
240
241 (with a basic doc under "doc/"...)
242
243 ## More from JP
244
245 You must create a configuration for alliance-check-toolkit:
246
247 alliance-check-toolkit/etc/mk/users.d/user-LOGIN.mk
248
249 where you define where the various tools are installed
250 (look in other ones to have an idea).
251
252 You can try the ARM in alliance-check-toolkit:
253
254 > cd alliance-check-toolkit/benchsARM/cmos/
255 > make lvx
256
257 Should take about five minutes. It's symbolic, but should be
258 a configuration compatible with 180nm. To actually see the
259 results:
260
261 > make cgt
262
263 Then "File -> Open", "arm_chip_cts_r"
264
265 To have a very rough approximation, you can say that one lambda
266 equal 180nm.
267
268 Depends on the zoom level and of the fact that you ask to see
269 the inside of the cells.
270
271 To actually see the transistors:
272 Tools -> Controller -> Filter Tab -> check "Process Terminal Cells"
273
274 You can also tweak the layer display:
275 Tools -> Controller -> Layers & Go
276
277 You can quicly hide/show the Controller with CTRL+I.
278
279 You may also toy with Controller -> Look, try the other ones.
280 If you want a new one, to mimic something you're better
281 familiar with, it's in configurations files all written
282 in Python so easy to do, if a little tedious.
283
284 > i'd expect such a chip to be in the alliance-check-toolkit however we
285 > don't even know what we're looking at in order to know which bits we
286 > need, let alone know what to do or how to run them.
287 >
288 > we're *literally* completely in the dark, here, having never done this
289 > before - at all - so unless there's a specific tutorial which says, to
290 > make a chip layout do this: "step 1: install these tools. step 2: get
291 > this project repo. step 3: cd to this directory. step 4: run make or
292 > ./compile-place-and-route.sh" we're absolutely lost.
293 >
294 > thx jean-paul, and apologies for not knowing where to begin, here.
295
296 No problem. You're welcome.
297
298 The doc is mostly for people who already have a background in ASICs,
299 I will try to patch something from my lecture in VLSI to help people
300 to orient themselves.
301
302 The up-to-date documentation is supplied directly in the Coriolis
303 repository:
304
305 coriolis/documentation/output/index.html
306
307 The links toward the doxygen doc will be invalid a this point,
308 but everython else works.
309
310 After installation, it is put in:
311
312 coriolis-2.x/Linux.x86_64/Release.Shared/install/share/doc/coriolis2/en/html/index.html
313
314 # Installing python3.7 into debian/buster chroot
315
316 as root, in the chroot:
317
318 apt-get install python3.7 python3-setuptools \
319 python3-jinja2 python3-pip
320
321 At this point it becomes possible to follow the main
322 instructions in [[HDL_workflow]] for installing nmigen,
323 ieee754fpu, soc and nmutil.
324
325 # Upgrading to latest yosys in the chroot
326
327 yosys in debian may not be enough to work with nmigen,
328 therefore it's probably a good idea to upgrade.
329 To install from source, add the following to
330 /etc/apt/sources.list:
331
332 deb-src http://ftp.uk.debian.org/debian buster main
333
334 then as root, in the chroot, run the following:
335
336 apt-get update
337 apt-get build-dep yosys
338 apt-get install clang
339 apt-get remove yosys
340
341 this will remove debian/buster yosys however getting the build
342 dependencies is quick and easy enough.
343
344 then, as the ordinary user, the following instructions can be followed
345 (<http://www.clifford.at/yosys/download.html>)
346
347 cd ~
348 git clone https://github.com/cliffordwolf/yosys.git
349 cd yosys
350 make config-clang
351 make -j4
352
353 as root, run:
354
355 make install
356
357 # Check out the libresoc "soclayout" repository
358
359 See [[HDL_workflow]] for git clone instructions
360
361 $ git clone ssh://gitolite3@git.libre-riscv.org:922/libresoc.git
362
363 TODO further, here.
364
365 # Issues running from (e.g.) archlinux as host and debian as a chroot
366
367 You may run into difficulties firing up GUI applications from the chroot.
368 Try installing Xnest <https://box.matto.nl/xnest.html> which you should
369 do in the *host* system. Also remember to install a "basic" window manager
370 (twm, fvwm2)
371
372 On the *host*, run Xnest and a window manager:
373
374 Xnest :1 -ac &
375 twm -display :1 &
376
377 Then, in the chroot, change DISPLAY environment variable (permanently
378 in ~/.bash_profile if desired)
379
380 export DISPLAY=:1.0
381
382 Then, in the chroot, follow the cgt instructions above, or use "make view"
383 in any of the soclayout experiments or alliance-check-toolkit bench tests
384