Skip to content

Commit

Permalink
Content for P4test Backend
Browse files Browse the repository at this point in the history
Signed-off-by: Adarsh <Adarshbunny293@gmail.com>
  • Loading branch information
AdarshRawat1 committed Aug 12, 2024
1 parent 7581570 commit b7c6aec
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
38 changes: 37 additions & 1 deletion backends/p4test/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
# P4test Backend

This is a "fake" backend, whose sole purpose is to test the P4-16 front-end.
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. It supports both the P4_14 and
P4_16 standards and can translate P4 code from one version to another.

## 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:
```bash
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:
```bash
p4test my-p4-16-prog.p4
```

For P4_14 code:
```bash
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, enabling you to
verify the correctness of your P4 programs, due to that it is
possible to verify the correctness of your P4 programs.
4 changes: 2 additions & 2 deletions docs/doxygen/p4c_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<tab type="modulelist" visible="yes" title="" intro=""/>
<tab type="modulemembers" visible="yes" title="" intro=""/>
</tab>
<tab type="namespaces" visible="no" title="">
<tab type="namespaces" visible="yes" title="">
<tab type="namespacelist" visible="yes" title="" intro=""/>
<tab type="namespacemembers" visible="yes" title="" intro=""/>
</tab>
Expand All @@ -21,7 +21,7 @@
<tab type="interfaceindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="interfacehierarchy" visible="yes" title="" intro=""/>
</tab>
<tab type="classes" visible="no" title="">
<tab type="classes" visible="yes" title="">
<tab type="classlist" visible="yes" title="" intro=""/>
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="hierarchy" visible="yes" title="" intro=""/>
Expand Down

0 comments on commit b7c6aec

Please sign in to comment.