User Extern Example Design - 2025.1 English - UG1308

Vitis Networking P4 User Guide (UG1308)

Document ID
UG1308
Release Date
2025-05-29
Version
2025.1 English

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

This directory contains:
  • 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.
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 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.