Additional Utilities - 2022.2 English

Vitis Networking P4 User Guide (UG1308)

Document ID
2022.2 English

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

  • XilVitisNetP4DpiByteArrayCreate()
  • XilVitisNetP4DpiStringToByteArray()

These two functions help the testbench 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.