add verilog-wishbone (for async bridge) to hdl-dev-ls2
[dev-env-setup.git] / nextpnr-xilinx-install
1 #!/bin/bash
2 if [ "$EUID" -ne 0 ]
3 then echo "Please run as root using 'sudo bash'"
4 exit
5 fi
6
7 # change into $SUDO_USER home directory
8 cd /home/$SUDO_USER
9 mkdir -p src/nextpnr-xilinx
10 cd src/nextpnr-xilinx
11
12 apt-get install -y libcurl3-gnutls git git-man
13
14 git clone https://github.com/f4pga/prjxray.git
15 git clone https://github.com/SymbiFlow/prjxray-db.git
16 git clone https://github.com/gatecat/nextpnr-xilinx.git
17
18 ## Steps to compile prjxray
19
20 ### Necessary software to install
21
22 apt-get install -y build-essential make cmake python3 python3-setuptools \
23 python3-dev python3-numpy cython3 python3-pip
24
25 pip3 install textx fasm
26
27 ### Build prjxray
28
29 cd prjxray
30 git checkout 18b92012afe2b03f3f975a78c4372c74b60dca0c
31 git submodule update --init --recursive
32 mkdir build; cd build
33 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/nextpnr-xilinx ..
34 make -j$(nproc)
35 make install
36 install -d -m 0755 /usr/local/nextpnr-xilinx/build/tools
37 install -m 0755 tools/{bitread,bittool,frame_address_decoder,gen_part_base_yaml,segmatch,xc7frames2bit,xc7patch} \
38 /usr/local/nextpnr-xilinx/build/tools
39 cd ..
40 cp -dpr utils /usr/local/nextpnr-xilinx
41 sed -i -e '/^# Vivado /,$d' /usr/local/nextpnr-xilinx/utils/environment.sh
42 python3 setup.py develop
43 cd ..
44
45 ## Steps to compile prjxray-db
46
47 ### Install prjxray-db
48
49 cd prjxray-db
50 git archive --format=tar --prefix=database/ \
51 0a0addedd73e7e4139d52a6d8db4258763e0f1f3 | \
52 tar -C /usr/local/nextpnr-xilinx -xf -
53 cd ..
54
55 ## Steps to compile nextpnr-xilinx
56
57 ### Necessary software to install
58
59 apt-get install -y libboost-thread-dev libboost-iostreams-dev \
60 libboost-program-options-dev libeigen3-dev libboost-python-dev \
61 libboost-filesystem-dev
62
63 ### Build nextpnr-xilinx
64
65 cd nextpnr-xilinx
66 git checkout 565588a69ea95a52f7c7592f4ed81d9bef6cfb60
67 git submodule init
68 git submodule update
69 cmake -DARCH=xilinx -DBUILD_GUI=OFF \
70 -DCMAKE_INSTALL_PREFIX=/usr/local/nextpnr-xilinx .
71 make -j$(nproc)
72 make install
73 ln -s xc7a100tcsg324-1 xilinx/external/prjxray-db/artix7/xc7a100t
74 python3 xilinx/python/bbaexport.py --device xc7a100tcsg324-1 \
75 --bba xilinx/xc7a100t.bba
76 ./bbasm --l xilinx/xc7a100t.bba xilinx/xc7a100t.bin
77 install -d -m 0755 /usr/local/nextpnr-xilinx/share/xilinx
78 install -m 0755 xilinx/xc7a100t.bin /usr/local/nextpnr-xilinx/share/xilinx
79 export XRAY_DIR=/usr/local/nextpnr-xilinx
80 cd ..
81
82 cd /home/$SUDO_USER/src/nextpnr-xilinx
83 chown -R $SUDO_USER .
84 chgrp -R $SUDO_USER .
85