The P4C-Vitisnet Compiler takes as input a P4 file and produces an output .json file for use by the P4 Behavioral Model. The compiler is executed as a command line application. It can be run in the Vivado Hardware Flow or in the CLI software flow as follows:
p4c-vitisnet
The application supports the command line parameters described in the following table.
| Parameter | Description |
|---|---|
| --help | Print this help message. |
| --version | Print compiler version. |
| -I path | Specify include path (passed to preprocessor). |
| -D arg=value | Define macro (passed to preprocessor). |
| -U arg | Undefine macro (passed to preprocessor). |
| -E | Preprocess only, do not compile (prints program on stdout). |
| --nocpp | Skip preprocess, assume input file is already preprocessed. |
| --pp file | Pretty-print the program in the specified file. |
| --toJSON file | Dump the compiler IR after the midend as JSON in the specified file. |
| --Wdisable[=diagnostic] | Disable a compiler diagnostic, or disable all warnings if no diagnostic is specified. |
| --Wwarn[=diagnostic] | Report a warning for a compiler diagnostic, or treat all warnings as warnings (the default) if no diagnostic is specified. |
| --Werror[=diagnostic] | Report an error for a compiler diagnostic, or treat all warnings as errors if no diagnostic is specified. |
| --testJson | [Compiler debugging] Dump and undump the IR. |
| -T loglevel | [Compiler debugging] Adjust logging level per file (see below). |
| -v | [Compiler debugging] Increase verbosity level (can be repeated). |
| --top4 pass1[,pass2] | [Compiler debugging] Dump the P4 representation after passes whose name contains one of `passX' substrings. When '-v' is used this will include the compiler IR. |
| --dump folder | [Compiler debugging] Folder where P4 programs are dumped. |
| --emit-externs | [VNP4 back-end] Force externs to be emitted by the backend. The generated code follows the VNP4 JSON specification. |
| -o outfile | Write output to outfile. |
loglevel format is: sourceFile:level,...,sourceFile:level
where sourceFile is a compiler source
file and level is the verbosity level for LOG messages
in that file.