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