From d8975d4978b56c1335d93312c03efaaf86641a3c Mon Sep 17 00:00:00 2001 From: kishanps Date: Thu, 21 Nov 2024 20:42:43 +0530 Subject: [PATCH] [P4_Symbolic] Adding p4_symbolic/ir/expected/set_parser_operation.txt [Extend IR proto and translation to support parsers] --- .../ir/expected/set_parser_operation.txt | 449 ++++++++++++++++++ 1 file changed, 449 insertions(+) create mode 100644 p4_symbolic/ir/expected/set_parser_operation.txt diff --git a/p4_symbolic/ir/expected/set_parser_operation.txt b/p4_symbolic/ir/expected/set_parser_operation.txt new file mode 100644 index 00000000..834b535e --- /dev/null +++ b/p4_symbolic/ir/expected/set_parser_operation.txt @@ -0,0 +1,449 @@ +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" + fields { + key: "local_metadata_t.dst_mac" + value { + name: "local_metadata_t.dst_mac" + bitwidth: 48 + } + } + fields { + key: "local_metadata_t.ether_type" + value { + name: "local_metadata_t.ether_type" + bitwidth: 16 + } + } + fields { + key: "local_metadata_t.signed_integer1" + value { + name: "local_metadata_t.signed_integer1" + bitwidth: 16 + signed: true + } + } + fields { + key: "local_metadata_t.signed_integer2" + value { + name: "local_metadata_t.signed_integer2" + bitwidth: 16 + signed: true + } + } + fields { + key: "local_metadata_t.src_mac" + value { + name: "local_metadata_t.src_mac" + bitwidth: 48 + } + } + } +} +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__" + } +} +parsers { + key: "parser" + value { + name: "parser" + initial_state: "start" + parse_states { + key: "parse_ipv4" + value { + name: "parse_ipv4" + parser_ops { + extract { + header { + header_name: "ipv4" + } + } + } + transitions { + default_transition { + next_state: "__END_OF_PARSER__" + } + } + } + } + parse_states { + key: "start" + value { + name: "start" + parser_ops { + set { + lvalue { + header_name: "scalars" + field_name: "local_metadata_t.ether_type" + } + lookahead_rvalue { + bitwidth: 16 + } + } + } + parser_ops { + set { + lvalue { + header_name: "scalars" + field_name: "local_metadata_t.signed_integer1" + } + hexstr_rvalue { + value: "0x0001" + negative: true + } + } + } + parser_ops { + set { + lvalue { + header_name: "scalars" + field_name: "local_metadata_t.signed_integer2" + } + hexstr_rvalue { + value: "0x0002" + } + } + } + parser_ops { + extract { + header { + header_name: "ethernet" + } + } + } + parser_ops { + set { + lvalue { + header_name: "scalars" + field_name: "local_metadata_t.dst_mac" + } + field_rvalue { + header_name: "ethernet" + field_name: "dst_addr" + } + } + } + parser_ops { + set { + lvalue { + header_name: "scalars" + field_name: "local_metadata_t.src_mac" + } + expression_rvalue { + binary_expression { + operation: BIT_AND + left { + field_value { + header_name: "ethernet" + field_name: "src_addr" + } + } + right { + hexstr_value { + value: "0xffffffffff00" + } + } + } + } + } + } + transition_key_fields { + field { + header_name: "scalars" + field_name: "local_metadata_t.ether_type" + } + } + transitions { + hex_string_transition { + value: "0x0800" + next_state: "parse_ipv4" + } + } + transitions { + default_transition { + next_state: "__END_OF_PARSER__" + } + } + } + } + } +} +