Introduce sub-parser to retain sanity [try1/inf]

This commit is contained in:
Nico Schottelius 2019-07-24 09:49:17 +02:00
parent 181870d14d
commit 44d74297ff

View file

@ -26,7 +26,21 @@ struct digest_data_t {
/******************************************************************************** /********************************************************************************
* Parser * Parser
*/ */
parser RealParser(
packet_in packet,
out Parsed_packet hdr,
out user_metadata_t meta,
out digest_data_t digest_data,
inout sume_metadata_t standard_metadata) {
inout sume_metadata_t sume_metadata) {
state start {
packet.extract(hdr.ethernet);
user_metadata.unused = 0;
digest_data.unused = 0;
}
}
@Xilinx_MaxPacketRegion(1024) @Xilinx_MaxPacketRegion(1024)
parser TopParser( parser TopParser(
@ -36,11 +50,10 @@ parser TopParser(
out digest_data_t digest_data, out digest_data_t digest_data,
inout sume_metadata_t sume_metadata) { inout sume_metadata_t sume_metadata) {
state start { RealParser() realparser;
b.extract(p.ethernet);
user_metadata.unused = 0;
digest_data.unused = 0;
state fakestart {
realparser.apply(b, p, user_metadata, digest_data, sume_metadata);
transition accept; transition accept;
} }
} }