oxidecomputer / p4

A P4 compiler
Mozilla Public License 2.0
111 stars 5 forks source link

implement confused-endian semantics #12

Closed rcgoodfellow closed 2 years ago

rcgoodfellow commented 2 years ago

The p4 spec states that the first bit from a packet extracts into the last bit of bit-string types, this means that we go from protocol-endian to p4-endian and then back to protocol-endian on the way out.

This patch introduces reordering logic over bit<n> types to ensure that bits land in header fields in the expected order.

Fixes #5.