## What to do to be able to get the NetFPGA running

* State as of 2019-05-10.
* With Ubuntu 19.04
* Vivado 2018.3
* SDNET 2018.2

There are a variety of hard coded scripts flying around in the
Internet, so try to stick to the proposed paths below.

Various things are likely to fail on your path,
so take a good bag of good nerves.

### Get Vivado, SDNET

* Go xilinx.com
* Create an account
* Browse/dig through the website until you find a HUGE sdnet download
* Browse/dig through the website until you find a REALLY HUGE vivado
  download

WARNING: do this is a first step. You are downloading more than 20 GB
of installation files and the connection seems to be throttled to
around 1 MiB/s - so it will take around 3h to just get the install
files.

### Hardware notes

* The card DOES need external PCI-E power
* If you did not connect the power, it will not start
* The card has a switch (!) to power it on
* If you don't power it on... you get the picture.
* The card will NOT show up in lspci when it comes to you freshly

### Hardware notes 2

If you happen to have the card powered up ("the fan is spinning"),
then connect it via tha microusb cable to a host. Two serial devices
will appear, both running at 115200 8N1. Connect to the second one,
then press the PROG button on the card. You should see some debug.

Don't continue until you do see the debug messages above.


### Install SDNnet

* Unpack the file, run xsetup, put stuff below /opt/Xilinx

### Install Vivado

* Install libtinfo5 manually (if you don't, the vivado install hangs
  forever)
* Unpack the file, run xsetup, put stuff below /opt/Xilinx

### Get the NetPFGA repo

This is a private repo, you will need to ask permission for it
[Nico: add the URL to the form in here].

```
mkdir -p ~/projects
cd ~/projects
git clone git@github.com:NetFPGA/P4-NetFPGA-live.git
```

Do NOT trust manuals to checkout a specific version, especially not
v1.2.0, it is broken with vivado 2018.3. Also, DO NOT trust this
manual, it might already be outdated at the time reading.

### Configure your PATHs

You do want to use the tools and you do want to have some settings
files to help you running the compiler. Create a shell script
*similar* to the following (adapt paths to your need):

```
#### SDNet ####
. /opt/xilinx/SDNet/2018.2/settings64.sh
export PATH=$PATH:/opt/xilinx/SDNet/2018.2/bin

##### Vivado #####
. /opt/Xilinx/Vivado/2018.3/settings64.sh
export PATH=$PATH:/opt/Xilinx/Vivado/2018.3/bin

#### P4-NetFPGA #####
. ~/projects/P4-NetFPGA/tools/settings.sh


# set DISPLAY env variable so that xsct works properly from cmdline
if [ -z "$DISPLAY" ]; then
    export DISPLAY=dummy
fi

```

### Compile "SUME hardware library cores and some software to access registers"


```
cd $SUME_FOLDER/lib/hw/xilinx/cores/tcam_v1_1_0/ && make update && make
cd $SUME_FOLDER/lib/hw/xilinx/cores/cam_v1_1_0/ && make update && make
cd $SUME_SDNET/sw/sume && make
cd $SUME_FOLDER && make
```

### Compile SUME drivers

```
cd $DRIVER_FOLDER
make all
sudo make install
sudo modprobe sume_riffa
lsmod | grep sume_riffa
```

### Install packages for P4

```
root@loch:~# apt install python-scapy
```


## Known / encountered BUGS

### Failing to compile tcam

### Failing to compile tcam


### Failing to compile cam
