Additional Utilities - 2025.1 English - UG1308

Vitis Networking P4 User Guide (UG1308)

Document ID
UG1308
Release Date
2025-05-29
Version
2025.1 English
A new set of helper functions and tasks have been added to vitis_net_p4_dpi_pkg.sv to ease the table and register DPI calls from a SystemVerilog test bench. For example:
  • XilVitisNetP4DPIinit()
  • XilVitisNetP4DPIexit()
  • XilVitisNetP4DPItableAdd()
  • ...

These functions/tasks were part of vitis_net_0_pkg.sv on previous releases (named differently). These are optional wrapper functions/tasks that can be used instead of the previously mentioned DPI control plane functions, if so desired. Note that these new helper functions/tasks require the use of the new XilVitisNetP4DPIHandle struct to hold various pointers and other memory and driver related information.

In addition to the control plane drivers, the DPI binary library provides the following optional utility functions:

  • XilVitisNetP4DpiByteArrayCreate()
  • XilVitisNetP4DpiStringToByteArray()
  • ...

These functions help the test bench consume key-response entries from a text file and convert them into byte arrays before passing them to a control plane driver function such as XilVitisNetP4BcamInsert(). It is possible to implement this code solely in SystemVerilog, if so desired.

Any function described above with a name ending in *Create() has a counterpart that ends with *Destroy(). The *Create() functions allocate memory inside the DPI library and the *Destroy() counterparts release the memory. It is good practice to call the *Destroy() functions after the memory that has been allocated is no longer required, such as towards the end of the simulation's execution.