Another purpose of P4's extern support is to provide a mechanism for users to extend their P4 program with custom functionality that necessarily resides outside of the P4 program - perhaps due to the difficulty of implementing efficiently in P4 code.
This purpose is supported in AMD Vitis™
Networking P4 by means of a UserExtern declaration
provided by VNP4 architecture. This declaration enables you to define the interface
between your P4 program and the custom functionality that has been implemented
externally, in this instance, in RTL. Furthermore, the VNP4 behavioral model can be
extended with a software model of the custom functionality, so that it can continue to
be a useful tool for verification of generated VNP4 designs.
The following sections describe how to use this mechanism to integrate custom functionality with a VNP4 design using User Externs.