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

[P4_Symbolic] Adding p4_symbolic/testdata/parser/sai_parser.p4 [Extend IR proto and translation to support parsers.] #759

Merged
merged 11 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions p4_symbolic/ir/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ cc_library(
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
],
)

Expand Down Expand Up @@ -202,3 +203,18 @@ ir_parsing_test(
golden_file = "expected/table_hit_2.txt",
p4_program = "//p4_symbolic/testdata:conditional/table_hit_2.p4",
)

ir_parsing_test(
name = "sai_parser_test",
golden_file = "expected/sai_parser.txt",
p4_deps = ["//p4_symbolic/testdata:common/headers.p4"],
p4_program = "//p4_symbolic/testdata:parser/sai_parser.p4",
)

ir_parsing_test(
name = "hex_string_transition_test",
golden_file = "expected/hex_string_transition.txt",
p4_deps = ["//p4_symbolic/testdata:common/headers.p4"],
p4_program = "//p4_symbolic/testdata:parser/hex_string_transition.p4",
)

287 changes: 287 additions & 0 deletions p4_symbolic/ir/expected/hex_string_transition.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
headers {
key: "ethernet"
value {
name: "ethernet_t"
id: 2
fields {
key: "dst_addr"
value {
name: "dst_addr"
bitwidth: 48
}
}
fields {
key: "ether_type"
value {
name: "ether_type"
bitwidth: 16
}
}
fields {
key: "src_addr"
value {
name: "src_addr"
bitwidth: 48
}
}
}
}
headers {
key: "ipv4"
value {
name: "ipv4_t"
id: 3
fields {
key: "do_not_fragment"
value {
name: "do_not_fragment"
bitwidth: 1
}
}
fields {
key: "dscp"
value {
name: "dscp"
bitwidth: 6
}
}
fields {
key: "dst_addr"
value {
name: "dst_addr"
bitwidth: 32
}
}
fields {
key: "ecn"
value {
name: "ecn"
bitwidth: 2
}
}
fields {
key: "frag_offset"
value {
name: "frag_offset"
bitwidth: 13
}
}
fields {
key: "header_checksum"
value {
name: "header_checksum"
bitwidth: 16
}
}
fields {
key: "identification"
value {
name: "identification"
bitwidth: 16
}
}
fields {
key: "ihl"
value {
name: "ihl"
bitwidth: 4
}
}
fields {
key: "more_fragments"
value {
name: "more_fragments"
bitwidth: 1
}
}
fields {
key: "protocol"
value {
name: "protocol"
bitwidth: 8
}
}
fields {
key: "reserved"
value {
name: "reserved"
bitwidth: 1
}
}
fields {
key: "src_addr"
value {
name: "src_addr"
bitwidth: 32
}
}
fields {
key: "total_len"
value {
name: "total_len"
bitwidth: 16
}
}
fields {
key: "ttl"
value {
name: "ttl"
bitwidth: 8
}
}
fields {
key: "version"
value {
name: "version"
bitwidth: 4
}
}
}
}
headers {
key: "scalars"
value {
name: "scalars_0"
}
}
headers {
key: "standard_metadata"
value {
name: "standard_metadata"
id: 1
fields {
key: "_padding"
value {
name: "_padding"
bitwidth: 3
}
}
fields {
key: "checksum_error"
value {
name: "checksum_error"
bitwidth: 1
}
}
fields {
key: "deq_qdepth"
value {
name: "deq_qdepth"
bitwidth: 19
}
}
fields {
key: "deq_timedelta"
value {
name: "deq_timedelta"
bitwidth: 32
}
}
fields {
key: "egress_global_timestamp"
value {
name: "egress_global_timestamp"
bitwidth: 48
}
}
fields {
key: "egress_port"
value {
name: "egress_port"
bitwidth: 9
}
}
fields {
key: "egress_rid"
value {
name: "egress_rid"
bitwidth: 16
}
}
fields {
key: "egress_spec"
value {
name: "egress_spec"
bitwidth: 9
}
}
fields {
key: "enq_qdepth"
value {
name: "enq_qdepth"
bitwidth: 19
}
}
fields {
key: "enq_timestamp"
value {
name: "enq_timestamp"
bitwidth: 32
}
}
fields {
key: "ingress_global_timestamp"
value {
name: "ingress_global_timestamp"
bitwidth: 48
}
}
fields {
key: "ingress_port"
value {
name: "ingress_port"
bitwidth: 9
}
}
fields {
key: "instance_type"
value {
name: "instance_type"
bitwidth: 32
}
}
fields {
key: "mcast_grp"
value {
name: "mcast_grp"
bitwidth: 16
}
}
fields {
key: "packet_length"
value {
name: "packet_length"
bitwidth: 32
}
}
fields {
key: "parser_error"
value {
name: "parser_error"
bitwidth: 32
}
}
fields {
key: "priority"
value {
name: "priority"
bitwidth: 3
}
}
}
}
pipeline {
key: "egress"
value {
name: "egress"
initial_control: "__END_OF_PIPELINE__"
}
}
pipeline {
key: "ingress"
value {
name: "ingress"
initial_control: "__END_OF_PIPELINE__"
}
}

Loading
Loading