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