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