(no commit message)
[libreriscv.git] / HDL_workflow / coriolis2.mdwn
index 36bf68b787a86467b05ebcf80884558cf457b2c3..7b0065218bdfaee3e9ad38362375bad45cce8f01 100644 (file)
@@ -1,13 +1,22 @@
+TODO, repos moved
+git remote set-url origin https://gitlab.lip6.fr/vlsi-eda/alliance-check-toolkit.git
+  git remote set-url origin https://gitlab.lip6.fr/vlsi-eda/alliance.git
+  git remote set-url origin https://gitlab.lip6.fr/vlsi-eda/coriolis.git
+
 # Installing Coriolis2
 
 ## debootstrap
 
 First set up an schroot debootstrap jail with debian 9.0.
-Follow these instructions taken from here:
+These instructions are based on information taken from here:
 <https://www.debian.org/releases/stretch/amd64/apds03.html.en>
 
-In advance, edit /etc/fstab and add mount points: personally I prefer using
-mount --bind points
+In advance, on the host system, edit /etc/fstab and add mount points:
+
+(edit: personally I prefer using mount --bind points.  however if doing
+that then after a reboot the chroot will lose the bind mountpoints
+and the commands need to be re-run, without which the chroot is
+unusable)
 
     /dev    /home/chroot/coriolis/dev   none    bind    0   0
     /dev/pts /home/chroot/coriolis/dev/pts  none    bind    0   0
@@ -21,7 +30,11 @@ Then run these commands:
     apt-get install debootstrap schroot
     mkdir /opt/chroot/coriolis
     /usr/sbin/debootstrap stretch !$ http://ftp.us.debian.org/debian
-    mount -a
+    mount /home/chroot/coriolis/dev
+    mount /home/chroot/coriolis/dev/pts
+    mount   /home/chroot/coriolis/proc
+    mount   /home/chroot/coriolis/sys
+    mount   /home/chroot/coriolis/tmp
     echo "coriolis2" > /home/chroot/coriolis/etc/debian_chroot
 
 To do some preparation (users):
@@ -30,14 +43,21 @@ To do some preparation (users):
     adduser {yourpreferredusername}
 
 It is best to make the username the same as the first user that
-was added during the debian install, so that uid 1001 matches between
-both main and chroot.  Alternatively, /etc/passwd and /etc/group may
+was added during the *main* (non-chroot) debian install, so that
+uid 1000 matches between both main and chroot.  You can check
+this by looking at /etc/passwd as root, or by typing "id".
+
+    lkcl@fizzy:~$ id
+    uid=1000(lkcl) gid=1000(lkcl) groups=1000(lkcl),5(tty),....
+
+Alternatively, /etc/passwd and /etc/group may
 be mount-bound as well as /home however if you later forget you did
 this and decide to delete the chroot, you will delete the entire /home
 of your main system, as well as /etc/passwd.
 
 You may wish to follow some of the other things such as configuring apt,
-locales and keyboard.  bootloader, kernel, ssh access, all these are
+locales and keyboard, from the above-linked debian-admin HOWTO.
+bootloader, kernel, ssh access, all these are
 unnecessary.  do run "apt clean" to clear out /var/cache/apt/archives
 in the chroot.
 
@@ -54,10 +74,45 @@ Now as an *ordinary* user - not as root - you may type:
 
     lkcl@fizzy:~$ schroot -c coriolis
 
-and, due to the contents of /etc/debian\_chroot, the prompt should become:
+and, due to the contents of /etc/debian\_chroot, and that you were in
+fact logged in as uid 1000 and did in fact add a user to the chroot
+as uid 1000, the prompt should become:
 
     (coriolis2)lkcl@fizzy:~$ 
 
+## check out alliance and alliance-check-toolkit
+
+Adapted from <https://www-soc.lip6.fr/en/team-cian/softwares/alliance/>
+
+in the schroot:
+
+    git clone https://gitlab.lip6.fr/jpc/alliance-check-toolkit.git
+
+TODO: document how to build alliance, basically this:
+
+In the chroot, as root:
+
+    apt-get update
+    apt-get install git build-essential libtool automake \
+             flex bison xfig imagemagick \
+             texlive texlive-pictures texlive-latex-extra \
+             libx11-dev libxt-dev libxaw7-dev libxpm-dev libmotif-dev
+
+In the chroot, as the ordinary schroot user:
+
+    mkdir -p alliance/build alliance/install
+    cd ~/alliance
+    git clone https://www-soc.lip6.fr/git/alliance.git
+    cd alliance/src
+    ./autostuff
+    cd ~/alliance/build
+    export ALLIANCE_TOP=$HOME/alliance/install
+    export LD_LIBRARY_PATH=${ALLIANCE_TOP}/lib:${LD_LIBRARY_PATH}
+    ../alliance/src/configure --prefix=$ALLIANCE_TOP --enable-alc-shared
+    make -j1 install
+
+the two exports are best added to ~/.bash_profile for later convenience
+
 ## coriolis2
 
 These are nominally taken from
@@ -86,7 +141,11 @@ Then run the following commands, as root, *in* the chroot:
                   libbz2-dev libxml2-dev rapidjson-dev libbz2-dev     \
                   doxygen dvipng graphviz python-sphinx               \
                   texlive-fonts-extra texlive-lang-french            \
-                  libqwt-dev qt4-dev-tools python-qt4
+                  libqwt-dev qt4-dev-tools python-qt4               \
+                   libxt-dev libxpm-dev libmotif-dev                \
+                   yosys
+
+Then, as the ordinary (non-root) user in the schroot:
 
     mkdir -p ~/coriolis-2.x/src
     cd ~/coriolis-2.x/src
@@ -107,3 +166,184 @@ having to look this page up every time
             ~/coriolisenv
     source ~/coriolisenv
 
+To run the graphical editor go to the bin directory
+     cd ~/coriolis-2.x/Linux.MyARCH/Release.Shared/install/bin
+    ./cgt
+
+Then run the following commands from the menubar
+
+    Tutorials / Run Demo (Python Flavour)
+    
+The following window will appear
+
+[[!img chicken.png ]]
+
+click on the chicken several times
+
+# Tutorials and checks
+
+* <https://gitlab.com/Chips4Makers/alliance-check-toolkit>
+* See coriolis-2.x/Linux.x86_64/Release.Shared/install/share/doc/coriolis2/en/html/main/PythonTutorial/index.html
+
+## Information from Jean-Paul
+
+There should be very soon a website at https://coriolis.lip6.fr (it is not yet
+online). Where I intend to put all the documentation about Alliance/Coriolis.
+
+In the meantime did you find the doc shipped with Coriolis ?
+
+There are also very cursory informations about installing Alliance here:
+    https://www-soc.lip6.fr/en/team-cian/softwares/alliance/
+
+You also have a third repository for various blocks/chip/examples here:
+    https://gitlab.lip6.fr/jpc/alliance-check-toolkit
+
+(with a basic doc under "doc/"...)
+
+## More from JP
+
+You must create a configuration for alliance-check-toolkit:
+
+    alliance-check-toolkit/etc/mk/users.d/user-LOGIN.mk
+
+    where you define where the various tools are installed
+    (look in other ones to have an idea).
+
+  You can try the ARM in alliance-check-toolkit:
+
+    > cd alliance-check-toolkit/benchsARM/cmos/
+    > make lvx
+
+    Should take about five minutes. It's symbolic, but should be
+    a configuration compatible with 180nm. To actually see the
+    results:
+
+    > make cgt
+
+    Then "File -> Open", "arm_chip_cts_r"
+
+    To have a very rough approximation, you can say that one lambda
+    equal 180nm.
+
+Depends on the zoom level and of the fact that you ask to see
+the inside of the cells.
+
+To actually see the transistors:
+   Tools -> Controller -> Filter Tab -> check "Process Terminal Cells"
+
+You can also tweak the layer display:
+   Tools -> Controller -> Layers & Go
+
+  You can quicly hide/show the Controller with CTRL+I.
+
+  You may also toy with Controller -> Look, try the other ones.
+  If you want a new one, to mimic something you're better
+  familiar with, it's in configurations files all written
+  in Python so easy to do, if a little tedious.
+
+> i'd expect such a chip to be in the alliance-check-toolkit however we
+> don't even know what we're looking at in order to know which bits we
+> need, let alone know what to do or how to run them.
+>
+> we're *literally* completely in the dark, here, having never done this
+> before - at all - so unless there's a specific tutorial which says, to
+> make a chip layout do this: "step 1: install these tools.  step 2: get
+> this project repo.  step 3: cd to this directory.  step 4: run make or
+> ./compile-place-and-route.sh" we're absolutely lost.
+>
+> thx jean-paul, and apologies for not knowing where to begin, here.
+
+  No problem. You're welcome.
+
+  The doc is mostly for people who already have a background in ASICs,
+  I will try to patch something from my lecture in VLSI to help people
+  to orient themselves.
+
+  The up-to-date documentation is supplied directly in the Coriolis
+  repository:
+
+     coriolis/documentation/output/index.html
+
+     The links toward the doxygen doc will be invalid a this point,
+     but everython else works.
+
+   After installation, it is put in:
+
+     coriolis-2.x/Linux.x86_64/Release.Shared/install/share/doc/coriolis2/en/html/index.html
+
+# Installing python3.7 into debian/stretch chroot
+
+python 3.6 is a prerequisite for nmigen however something
+weird is going on, and it can't be installed.  instead,
+python 3.7 has to be installed instead.  we do this by
+adding debian/testing but setting the default release
+as "stretch".
+
+as root, in the
+chroot, add the following to /etc/apt/sources.list
+
+    deb http://ftp.de.debian.org/debian testing main
+
+then, also as root:
+
+    echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local
+    sudo apt-get update
+    apt-get -t testing install python3.7 python3-setuptools \
+               python3-jinja2 python3-pip
+
+At this point it becomes possible to follow the main
+instructions in [[HDL_workflow]] for installing nmigen,
+ieee754fpu, soc and nmutil.
+
+# Upgrading to latest yosys and nmigen in the chroot
+
+yosys in debian/stretch may not be enough to work with nmigen,
+therefore it's probably a good idea to upgrade.   if this was
+not a debian/stretch chroot (i.e. was a debian 10), it would be
+a simple matter of "apt-get install yosys" however it's probably best,
+here to install from source.
+
+**however**.. there is another way: once the instructions
+for installing python3.7 have been carried out.  As root,
+in the chroot:
+
+   apt-get -t testing install yosys
+
+That's all. 
+
+To install instead from source, add the following to
+/etc/apt/sources.list:
+
+   deb-src http://ftp.uk.debian.org/debian stretch main
+
+then as root, in the chroot, run the following:
+
+    apt-get update
+    apt-get build-dep yosys
+    apt-get install clang
+    apt-get remove yosys
+
+this will remove debian/stretch yosys however getting the build
+dependencies is quick and easy enough.
+
+then, as the ordinary user, the following instructions can be followed
+(<http://www.clifford.at/yosys/download.html>)
+
+    cd ~
+    git clone https://github.com/cliffordwolf/yosys.git
+    cd yosys
+    make config-clang
+    make -j4
+
+as root, run:
+
+    make install
+
+# Check out the libresoc "soclayout" repository
+
+See [[HDL_workflow]] for git clone instructions
+
+    $ git clone ssh://gitolite3@git.libre-riscv.org:922/libresoc.git
+
+TODO further, here.