Open
Conversation
Signed-off-by: devalgupta404 <devalgupta4@gmail.com>
Signed-off-by: devalgupta404 <devalgupta4@gmail.com>
Signed-off-by: devalgupta404 <devalgupta4@gmail.com>
Signed-off-by: devalgupta404 <devalgupta4@gmail.com>
bd5533a to
0e992a5
Compare
Contributor
|
Hi @devalgupta404 thanks for the PR, unfortunately I've already implemented a lot of JSON conversion in my fork (https://github.com/PietroGhg/p4mlir-incubator/tree/pietro/bmv2_develop this is my develop branch and this is the first commit that adds some JSON printing). For BMv2 I'm working on getting e2e tests passing using p4mlir. I'll try to do a better job with keeping issues up to date. Please ping me on bmv2-related issues before picking them up and we can avoid duplication |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description for Issue #262
Implementation
Implements BMv2IR parser to JSON translation for issue #262.
Adds
bmv2irToJson()inlib/Targets/BMv2/Target.cppthat serializes P4 parsers to BMv2 JSON format. Supports all extract types (regular, stack, union_stack), all transition types (default, hexstr, parse_vset), and all transition key types (field, lookahead, stack_field, union_stack_field). State names use simple format ("start","accept") matching p4c BMv2 backend. Implementation follows BMv2 JSON spec.Testing
Added
test/Targets/BMv2/parser_json.mlirwith FileCheck validation of JSON output. Test covers basic parser flow: parser with two states (start → accept), regular extract operation, field-based transition keys, default transitions, and null next_state for parsing termination. Output verified against BMv2 JSON schema with compact JSON pattern matching.All 165 P4MLIR tests passing (100%). Test execution:
ninja check-p4mlirCloses #262