Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[P4Testgen] Add struct and header expressions as a first-class expression to P4Testgen. #4231

Merged
merged 3 commits into from
Nov 29, 2023

Conversation

fruffy
Copy link
Collaborator

@fruffy fruffy commented Nov 8, 2023

This PR adds support for struct expressions in P4Testgen. Concretely, it adds utility functions to handle assignments and pass struct expressions as full argument. It also generalizes some utility functions to support BaseListExpressions, StructExpressions, and HeaderStackExpressions.

The goal of these changes is to enable two features:

  • Support of meta information of complex P4 objects (such as validity and the next index of header stacks)
  • Support of struct expressions as method call arguments. This will make implementation of externs significantly easier because we do not have to resolve the arguments within the extern any longer. Instead, we are able to access all necessary arguments directly.

It also introduces a new IR type. HeaderExpressions. HeaderExpressions track the validity of the header as an expression, which makes it possible to track validity of a header symbolically and not just as a boolean constant.

@fruffy fruffy added the p4tools Topics related to the P4Tools back end label Nov 8, 2023
@fruffy fruffy force-pushed the fruffy/testgen_structexpr branch 9 times, most recently from f23bf5b to 6f91dae Compare November 15, 2023 20:14
@fruffy fruffy force-pushed the fruffy/testgen_structexpr branch 4 times, most recently from 1ad879d to e665be1 Compare November 22, 2023 00:21
@fruffy fruffy changed the title [WiP] Add struct and header expressions as a first-class expression to P4Testgen. [P4Testgen] Add struct and header expressions as a first-class expression to P4Testgen. Nov 22, 2023
@fruffy fruffy requested a review from vlstill November 28, 2023 20:12
@fruffy fruffy merged commit ecc08c5 into main Nov 29, 2023
13 checks passed
@fruffy fruffy deleted the fruffy/testgen_structexpr branch November 29, 2023 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p4tools Topics related to the P4Tools back end
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants