The behavioral model can be used to verify the functionality of a P4 program before progressing to synthesis. See the Vitis Networking P4 User Guide (UG1308), Chapter 3, for more information on the behavioral model.
- Compile the P4 program using p4c-vitisnet.
This generates a JSON file that can be used in the behavioral model:
p4c-vitisnet <testname>.p4 -o <json_name>.json
- Create a <testcase>.txt text file containing a command to run the
traffic data, ensuring that the input packet data file follows the <name>_in.<pcap|user> naming
convention. If there are any tables in the P4 program, the table entries should
be added to this testcase file (before the run_traffic command):
echo 'run_traffic <packetname>' > <testcase>.txt
table_add <table_name> <action_name> <key0> <key1> <key2>... => <response0> <response1>...
- Run the run-p4bm-vitisnet application to
generate outputs from the model:
run-p4bm-vitisnet -j <json_name>.json -s <testcase>.txt
If successful, this generates <packetname>_out.<pcap|user> and <packetname>_out.meta files, which can be verified against simulated design data.