Skip to content

Latest commit

 

History

History
54 lines (45 loc) · 1.5 KB

README.md

File metadata and controls

54 lines (45 loc) · 1.5 KB

P4test Backend

The P4Test Backend is a tool designed for testing and debugging P4 programs. It supports both the P4-14 and P4-16 standards and can translate P4 code from one version to another. Additionally, it provides a syntax checker for P4 code, enabling the verification of the correctness of your P4 programs.

Auto-translate P4-14 source to P4-16 source:

You can automatically translate a P4-14 program to a P4-16 program using the following command:

p4test --std p4-14 my-p4-14-prog.p4 --pp auto-translated-p4-16-prog.p4

This command takes the P4-14 program (my-p4-14-prog.p4) and generates a corresponding P4-16 program (auto-translated-p4-16-prog.p4).

Check syntax of P4-16 or P4-14 source code

The P4test Backend can check the syntax of P4 programs without being restricted by any specific compiler back end. This is useful for ensuring that your P4 code is syntactically correct.

For P4-16 code:

p4test my-p4-16-prog.p4

For P4-14 code:

p4test --std p4-14 my-p4-14-prog.p4

These commands will output error and/or warning messages if there are any issues with the syntax of your P4 code.