Vitis Networking P4 installations include example code that can be used as a template for integrating custom functionality. The files required are located at:
{XILINX_VIVADO}/examples/vitis_net_p4_examples/user_externs
- user_externs.p4: a heavily commented P4 source file which demonstrates the use of a simple user extern.
- user_externs.cp: a heavily commented C++ source file which contains a minimal example of a user extern software model.
- include: a directory containing a set of header files from the behavioral model required to successfully compile a user extern software model.
- Makefile: a sample Makefile that shows how to compile the user extern software model into a shared object for use with the behavioral model.
The Makefile can be examined to understand the dependencies needed for compilation. In summary, these are:
- Header files from the behavioral model that are provided.
- Header files for Boost (distributed with AMD Vivado™ Design Suite).
- Header files for GMP (distributed with Vivado Design Suite).
- GCC (distributed with Vivado Design Suite).
- GNU Binutils (distributed with Vivado Design Suite).
The Makefile requires that you have access to a Vivado Design Suite installation and have sourced either the settings64.sh or settings64.csh file (depending on the shell used) provided with Vitis Networking P4. Sourcing either script results in an environment variable named XILINX_VIVADO being set, which allows the Makefile to locate all of the dependencies fulfilled by the Vivado Design Suite.