Skip to content

multitenancy-project/menshen-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

P4C Extension

We test the scripts below on Ubuntu 20.04 LTS with protobuf 3.6.1 as suggested in p4c of the commit we build atop.

Build

Suppose you have installed all the dependencies for p4c.

  1. Scripts for installing the dependecies
sudo apt install -y cmake g++ git automake libtool libgc-dev bison flex libfl-dev libgmp-dev \
libboost-dev libboost-iostreams-dev libboost-graph-dev llvm pkg-config \
python python3-scapy python3-pip tcpdump

Here is the official instruction to install protobuf 3.6.1.

  1. Clone the repo of p4c and be sure to add the --recursive flag and checkout to the commit that we are working at
git clone --recursive https://github.com/p4lang/p4c.git
cd p4c
git checkout cc0741d722c2fc99513716e86170d70d000503d6
git submodule update --recursive
  1. Clone the repo under p4c/backends
cd p4c/backends
git clone git@github.com:multitenancy-project/menshen-compiler.git FPGA-backend
  1. add the following to the line 276 of p4c/CMakeLists.txt
add_subdirectory (backends/FPGA-backend)
  1. build
cd p4c
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=DEBUG -DENABLE_DOCS=OFF
make -j10

Test

  1. set the path to your compiled p4c-fpga
export P4C_FPGA=/path/to/p4c/build/p4c-fpga
  1. generate stateful memory conf and system conf
$P4C_FPGA --outputfile stateconf.txt --conffile allocate.txt --statefulconf 1
$P4C_FPGA ./sys.p4 --vid 15 --outputfile confsys.txt --conffile allocate.txt --onlysys 1
  1. generate conf for user program
# generate conf for the program
$P4C_FPGA ./calc.p4 --vid 1 --outputfile conf1.txt --conffile allocate.txt

Miscs

  1. lkupconf --> vid, [start, end)
  2. statefulmem --> vid, offset, range

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published