(no commit message)
[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 stretch !$ 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 ## check out alliance and alliance-check-toolkit
84
85 Adapted from <https://www-soc.lip6.fr/en/team-cian/softwares/alliance/>
86
87 in the schroot:
88
89 git clone https://gitlab.lip6.fr/jpc/alliance-check-toolkit.git
90
91 TODO: document how to build alliance, basically this:
92
93 In the chroot, as root:
94
95 apt-get update
96 apt-get install git build-essential libtool automake \
97 flex bison xfig imagemagick \
98 texlive texlive-pictures texlive-latex-extra \
99 libx11-dev libxt-dev libxaw7-dev libxpm-dev libmotif-dev
100
101 In the chroot, as the ordinary schroot user:
102
103 mkdir -p alliance/build alliance/install
104 cd ~/alliance
105 git clone https://www-soc.lip6.fr/git/alliance.git
106 cd alliance/src
107 ./autostuff
108 cd ~/alliance/build
109 export ALLIANCE_TOP=$HOME/alliance/install
110 export LD_LIBRARY_PATH=${ALLIANCE_TOP}/lib:${LD_LIBRARY_PATH}
111 ../alliance/src/configure --prefix=$ALLIANCE_TOP --enable-alc-shared
112 make -j1 install
113
114 the two exports are best added to ~/.bash_profile for later convenience
115
116 ## coriolis2
117
118 These are nominally taken from
119 <https://www-soc.lip6.fr/equipe-cian/logiciels/coriolis/>
120 however there are errors in the original at the moment.
121 Do not try qt5, it will not work.
122
123 In ~/.bash\_profile add the following so that builds (rebuilds) if you need
124 them will be quicker, and you can run the GUI from the chroot:
125
126 export PATH=/usr/lib/ccache:"$PATH"
127 export DISPLAY=:0.0
128
129 Second (or at a new terminal / xterm), log in as root on the host (not
130 the chroot) then do schroot -c coriolis to get to be root in the chroot
131 (or, you can install sudo in the chroot and then do "sudo bash" in the
132 chroot).
133
134 Then run the following commands, as root, *in* the chroot:
135
136 apt-get update
137 apt-get install -y build-essential binutils-dev \
138 git cmake bison flex gcc python-dev \
139 libboost-all-dev libboost-python-dev \
140 zlib1g-dev \
141 libbz2-dev libxml2-dev rapidjson-dev libbz2-dev \
142 doxygen dvipng graphviz python-sphinx \
143 texlive-fonts-extra texlive-lang-french \
144 libqwt-dev qt4-dev-tools python-qt4 \
145 libxt-dev libxpm-dev libmotif-dev \
146 yosys
147
148 Then, as the ordinary (non-root) user in the schroot:
149
150 mkdir -p ~/coriolis-2.x/src
151 cd ~/coriolis-2.x/src
152 git clone https://www-soc.lip6.fr/git/coriolis.git
153
154 cd coriolis
155 git checkout devel
156 ./bootstrap/ccb.py --project=coriolis --make="-j4 install"
157
158 To set up the alliance environment, run this:
159
160 eval `~/coriolis-2.x/src/coriolis/bootstrap/coriolisEnv.py`
161
162 For convenience that may be placed in a file and "sourced", to avoid
163 having to look this page up every time
164
165 echo "eval `~/coriolis-2.x/src/coriolis/bootstrap/coriolisEnv.py`" > \
166 ~/coriolisenv
167 source ~/coriolisenv
168
169 To run the graphical editor go to the bin directory
170
171 cd ~/coriolis-2.x/Linux.MyARCH/Release.Shared/install/bin
172 ./cgt
173
174 Then run the following commands from the menubar
175
176 Tutorials / Run Demo (Python Flavour)
177
178 The following window will appear
179
180 [[!img chicken.png ]]
181
182 click on the chicken several times
183
184 # Tutorials and checks
185
186 * <https://gitlab.com/Chips4Makers/alliance-check-toolkit>
187 * See coriolis-2.x/Linux.x86_64/Release.Shared/install/share/doc/coriolis2/en/html/main/PythonTutorial/index.html
188
189 ## Information from Jean-Paul
190
191 There should be very soon a website at https://coriolis.lip6.fr (it is not yet
192 online). Where I intend to put all the documentation about Alliance/Coriolis.
193
194 In the meantime did you find the doc shipped with Coriolis ?
195
196 There are also very cursory informations about installing Alliance here:
197 https://www-soc.lip6.fr/en/team-cian/softwares/alliance/
198
199 You also have a third repository for various blocks/chip/examples here:
200 https://gitlab.lip6.fr/jpc/alliance-check-toolkit
201
202 (with a basic doc under "doc/"...)
203
204 ## More from JP
205
206 You must create a configuration for alliance-check-toolkit:
207
208 alliance-check-toolkit/etc/mk/users.d/user-LOGIN.mk
209
210 where you define where the various tools are installed
211 (look in other ones to have an idea).
212
213 You can try the ARM in alliance-check-toolkit:
214
215 > cd alliance-check-toolkit/benchsARM/cmos/
216 > make lvx
217
218 Should take about five minutes. It's symbolic, but should be
219 a configuration compatible with 180nm. To actually see the
220 results:
221
222 > make cgt
223
224 Then "File -> Open", "arm_chip_cts_r"
225
226 To have a very rough approximation, you can say that one lambda
227 equal 180nm.
228
229 Depends on the zoom level and of the fact that you ask to see
230 the inside of the cells.
231
232 To actually see the transistors:
233 Tools -> Controller -> Filter Tab -> check "Process Terminal Cells"
234
235 You can also tweak the layer display:
236 Tools -> Controller -> Layers & Go
237
238 You can quicly hide/show the Controller with CTRL+I.
239
240 You may also toy with Controller -> Look, try the other ones.
241 If you want a new one, to mimic something you're better
242 familiar with, it's in configurations files all written
243 in Python so easy to do, if a little tedious.
244
245 > i'd expect such a chip to be in the alliance-check-toolkit however we
246 > don't even know what we're looking at in order to know which bits we
247 > need, let alone know what to do or how to run them.
248 >
249 > we're *literally* completely in the dark, here, having never done this
250 > before - at all - so unless there's a specific tutorial which says, to
251 > make a chip layout do this: "step 1: install these tools. step 2: get
252 > this project repo. step 3: cd to this directory. step 4: run make or
253 > ./compile-place-and-route.sh" we're absolutely lost.
254 >
255 > thx jean-paul, and apologies for not knowing where to begin, here.
256
257 No problem. You're welcome.
258
259 The doc is mostly for people who already have a background in ASICs,
260 I will try to patch something from my lecture in VLSI to help people
261 to orient themselves.
262
263 The up-to-date documentation is supplied directly in the Coriolis
264 repository:
265
266 coriolis/documentation/output/index.html
267
268 The links toward the doxygen doc will be invalid a this point,
269 but everython else works.
270
271 After installation, it is put in:
272
273 coriolis-2.x/Linux.x86_64/Release.Shared/install/share/doc/coriolis2/en/html/index.html
274
275 # Installing python3.7 into debian/stretch chroot
276
277 python 3.6 is a prerequisite for nmigen however something
278 weird is going on, and it can't be installed. instead,
279 python 3.7 has to be installed instead. we do this by
280 adding debian/testing but setting the default release
281 as "stretch".
282
283 as root, in the
284 chroot, add the following to /etc/apt/sources.list
285
286 deb http://ftp.de.debian.org/debian testing main
287
288 then, also as root:
289
290 echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local
291 sudo apt-get update
292 apt-get -t testing install python3.7 python3-setuptools \
293 python3-jinja2 python3-pip
294
295 At this point it becomes possible to follow the main
296 instructions in [[HDL_workflow]] for installing nmigen,
297 ieee754fpu, soc and nmutil.
298
299 # Upgrading to latest yosys and nmigen in the chroot
300
301 yosys in debian/stretch may not be enough to work with nmigen,
302 therefore it's probably a good idea to upgrade. if this was
303 not a debian/stretch chroot (i.e. was a debian 10), it would be
304 a simple matter of "apt-get install yosys" however it's probably best,
305 here to install from source.
306
307 **however**.. there is another way: once the instructions
308 for installing python3.7 have been carried out. As root,
309 in the chroot:
310
311 apt-get -t testing install yosys
312
313 That's all.
314
315 To install instead from source, add the following to
316 /etc/apt/sources.list:
317
318 deb-src http://ftp.uk.debian.org/debian stretch main
319
320 then as root, in the chroot, run the following:
321
322 apt-get update
323 apt-get build-dep yosys
324 apt-get install clang
325 apt-get remove yosys
326
327 this will remove debian/stretch yosys however getting the build
328 dependencies is quick and easy enough.
329
330 then, as the ordinary user, the following instructions can be followed
331 (<http://www.clifford.at/yosys/download.html>)
332
333 cd ~
334 git clone https://github.com/cliffordwolf/yosys.git
335 cd yosys
336 make config-clang
337 make -j4
338
339 as root, run:
340
341 make install
342
343 # Check out the libresoc "soclayout" repository
344
345 See [[HDL_workflow]] for git clone instructions
346
347 $ git clone ssh://gitolite3@git.libre-riscv.org:922/libresoc.git
348
349 TODO further, here.