(no commit message)
[libreriscv.git] / HDL_workflow / nextpnr-xilinx.mdwn
1 # nextpnr-xilinx
2
3 Installation instructions for Nextpnr-xilinx with Xilinx Artix7 100T Board
4
5 * Source code: <https://github.com/gatecat/nextpnr-xilinx>
6 * Bugzilla page <https://bugs.libre-soc.org/show_bug.cgi?id=790>
7 * Auto-install script: <https://git.libre-soc.org/?p=dev-env-setup.git;a=blob;f=nextpnr-xilinx;hb=HEAD>
8 * Prerequisites: yosys <https://git.libre-soc.org/?p=dev-env-setup.git;a=blob;f=hdl-tools-yosys;hb=HEAD>
9
10
11 ## Page under work
12
13 ## Setting up new debootstrap and chroot into it
14
15 Run the following if you wish to isolate the nextpnr-xilinx build
16 from other software (reproducible builds) or use the schroot
17 auto-preparation script here:
18 <https://git.libre-soc.org/?p=dev-env-setup.git;a=blob;f=mk-deb-chroot;hb=HEAD>
19
20 export MY_CHROOT=/stable-chroot
21 mkdir $MY_CHROOT
22 debootstrap buster $MY_CHROOT http://deb.debian.org/debian/
23 mount -t proc proc $MY_CHROOT/proc
24 mount -t sysfs sysfs $MY_CHROOT/sys
25 mount -t devpts devpts $MY_CHROOT/dev/pts/
26 chroot $MY_CHROOT /bin/bash
27
28 ## Download neccessary softwares
29
30 apt-get install -y libcurl3-gnutls/buster git/buster
31
32 git clone https://github.com/YosysHQ/yosys.git
33 git clone https://github.com/YosysHQ/abc.git
34 git clone https://github.com/f4pga/prjxray.git
35 git clone https://github.com/SymbiFlow/prjxray-db.git
36 git clone https://github.com/gatecat/nextpnr-xilinx.git
37
38 ## Steps to compile prjxray
39
40 ### Necessary software to install
41
42 apt-get install -y python3-pip
43
44 ### Build prjxray
45
46 cd prjxray
47 git checkout 18b92012afe2b03f3f975a78c4372c74b60dca0c
48 git submodule update --init --recursive
49 mkdir build; cd build
50 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/nx ..
51 make -j$(nproc)
52 make install
53 install -d -m 0755 /usr/local/nx/build/tools
54 install -m 0755 tools/{bitread,bittool,frame_address_decoder,gen_part_base_yaml,segmatch,xc7frames2bit,xc7patch} \
55 /usr/local/nx/build/tools
56 cd ..
57 cp -dpr utils /usr/local/nx
58 sed -i -e '/^# Vivado /,$d' /usr/local/nx/utils/environment.sh
59 pip3 install .
60 cd ..
61
62 ## Steps to compile prjxray-db
63
64 ### Install prjxray-db
65
66 cd prjxray-db
67 git archive --format=tar --prefix=database/ \
68 0a0addedd73e7e4139d52a6d8db4258763e0f1f3 | \
69 tar -C /usr/local/nx -xf -
70 cd ..
71
72 ## Steps to compile nextpnr-xilinx
73
74 ### Necessary software to install
75
76 apt-get install -y libboost-thread-dev libboost-iostreams-dev \
77 libboost-program-options-dev libeigen3-dev
78
79 ### Build nextpnr-xilinx
80
81 cd nextpnr-xilinx
82 git checkout 565588a69ea95a52f7c7592f4ed81d9bef6cfb60
83 cmake -DARCH=xilinx -DBUILD_GUI=OFF -DCMAKE_INSTALL_PREFIX=/usr/local/nx .
84 make -j$(nproc)
85 make install
86 python3 xilinx/python/bbaexport.py --device xc7a100tcsg324-1 \
87 --bba xilinx/xc7a100t.bba
88 ./bbasm --l xilinx/xc7a100t.bba xilinx/xc7a100t.bin
89 install -d -m 0755 /usr/local/nx/share/xilinx
90 install -m 0755 xilinx/xc7a100t.bin /usr/local/nx/share/xilinx
91 export XRAY_DIR=/usr/local/nx
92
93 # build attosoc example; it should build attosoc.bit as final bitstream
94
95 cd xilinx/examples
96 cp -dpr arty-a35 arty-a100
97 cd arty-a100
98 sed -i -e 's@xc7a35tcsg324-1@xc7a100tcsg324-1@g' \
99 -e 's@../../../nextpnr-xilinx@nextpnr-xilinx@g' \
100 -e 's@../../xc7a35t.bin@/usr/local/nx/share/xilinx/xc7a100t.bin@g' \
101 attosoc.sh
102 ./attosoc.sh
103
104 # see file attosoc.bit; it is the bitstream file and if built then success