The P4 language specification (v1.2.5, §8.25) states:
The result of reading a value in any of the situations below is that some unspecified value will be used for that field.
- reading a field from a header that is currently invalid.
- ...
The behavioral model currently returns that last written value when reading a field from an invalid header.
I propose adding two additional modes when reading from invalid headers:
- Return 0: All reads of fields in invalid headers return 0. (Likely mirrors some hardware implementations.)
- Return the last written value and print a warning.
I suggest that the choice of mode is a compile-time setting (e.g., via a cmake parameter).
The P4 language specification (v1.2.5, §8.25) states:
The behavioral model currently returns that last written value when reading a field from an invalid header.
I propose adding two additional modes when reading from invalid headers:
I suggest that the choice of mode is a compile-time setting (e.g., via a cmake parameter).