User Extern Example Design - 2022.2 English - UG1308

Vitis Networking P4 User Guide (UG1308)

Document ID
UG1308
Version
2022.2 English
Revision

Vitis Networking P4 installations include example code that can be used as a template for integrating custom functionality into Vitis Networking P4. The files required are located at:

{XILINX_VIVADO}/examples/vitis_net_p4_examples/user_externs

This directory contains:
  • user_externs.p4: a heavily commented P4 source file which demonstrates the use of a simple extern.
  • user_externs.cp: a heavily commented C++ source file which contains a minimal example of an extern software model.
  • include: a directory containing a set of header files from the behavioral model required to successfully compile an extern software model.
  • Makefile: a sample makefile that shows how to compile the extern software model into a shared object for use with the behavioral model.
It is strongly suggested that you copy this entire directory to a separate location before making any modifications to these files.
The makefile can be examined to understand the dependencies needed for compilation. In summary, these are:
  • Header files from the behavioral model that have been provided.
  • Header files for Boost version 1.72 (distributed with Vivado Design Suite).
  • Header files for GMP version 5.1.3 (distributed with Vivado Design Suite).
  • GCC version 8.3 (distributed with Vivado Design Suite).
  • GNU Binutils version 2.26 (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 Vivado Design Suite.