17#ifndef FRONTENDS_P4_CORELIBRARY_H_
18#define FRONTENDS_P4_CORELIBRARY_H_
20#include "frontends/common/model.h"
22#include "lib/cstring.h"
25enum class StandardExceptions {
37inline std::ostream &operator<<(std::ostream &out, P4::StandardExceptions e) {
39 case P4::StandardExceptions::NoError:
42 case P4::StandardExceptions::PacketTooShort:
43 out <<
"PacketTooShort";
45 case P4::StandardExceptions::NoMatch:
48 case P4::StandardExceptions::StackOutOfBounds:
49 out <<
"StackOutOfBounds";
51 case P4::StandardExceptions::HeaderTooShort:
52 out <<
"HeaderTooShort";
54 case P4::StandardExceptions::ParserTimeout:
55 out <<
"ParserTimeout";
58 BUG(
"Unhandled case");
67using namespace literals;
72 : Extern_Model(
"packet_in"_cs),
73 extract(
"extract"_cs),
74 lookahead(
"lookahead"_cs),
75 advance(
"advance"_cs),
76 length(
"length"_cs) {}
81 int extractSecondArgSize = 32;
86 PacketOut() : Extern_Model(
"packet_out"_cs), emit(
"emit"_cs) {}
92 const StandardExceptions exc;
95 std::stringstream str;
107 : noAction(
"NoAction"_cs),
108 exactMatch(
"exact"_cs),
109 ternaryMatch(
"ternary"_cs),
111 noError(StandardExceptions::NoError),
112 packetTooShort(StandardExceptions::PacketTooShort),
113 noMatch(StandardExceptions::NoMatch),
114 stackOutOfBounds(StandardExceptions::StackOutOfBounds),
115 headerTooShort(StandardExceptions::HeaderTooShort) {}
Definition frontends/common/model.h:64
Definition coreLibrary.h:103
Definition coreLibrary.h:90
Definition coreLibrary.h:69
Definition coreLibrary.h:84
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24
Definition frontends/common/model.h:28
Extern_Model : Type_Model.
Definition frontends/common/model.h:52