Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #542 #544

Merged
merged 3 commits into from
Mar 5, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions p4-16/spec/P4-16-spec.mdk
Original file line number Diff line number Diff line change
Expand Up @@ -2982,6 +2982,10 @@ Variable-length bit-strings support a limited set of operations:
- The `emit` method of a `packet_out` extern object, which
inserts a variable-sized bit-string with a known dynamic width into
the packet being constructed (see Section [#sec-deparse]).
- Comparison for equality or inequality with another `varbit` field.
Two `varbit` fields can be compared only if they have the same type.
Two varbits are equal if they have the same dynamic width and all
the bits up to the dynamic width are the same.

## Casts { #sec-casts }

Expand Down Expand Up @@ -3281,6 +3285,11 @@ copying `struct`s using assignment when the source and target of the
assignment have the same type. Finally, `struct`s can be initialized
with a list expression, as discussed in Section [#sec-list-exprs].

Two structs can be compared for equality (==) or inequality (!=) only
if they have the same type and all of their fields can be recursively
compared for equality. Two structures are equal if and only if all
their corresponding fields are equal.

## Operations on headers { #sec-ops-on-hdrs }

Headers provide the same operations as `struct`s. Assignment between
Expand Down Expand Up @@ -3352,6 +3361,11 @@ H h;
h = { 10, 12 }; // This also makes the header h valid
~ End P4Example

Two headers can be compared for equality (==) or inequality (!=) only
if they have the same type. Two headers are equal if and only if they
are both invalid, or they are both valid and all their corresponding
fields are equal.

## Operations on header stacks { #sec-expr-hs }

A header stack is a fixed-size array of headers with the same
Expand Down Expand Up @@ -3471,6 +3485,11 @@ void pop_front(int count) {
}
~ End P4Pseudo

Two header stacks can be compared for equality (==) or inequality (!=)
only if they have the same element type and the same length. Two
stacks are equal if and only if all their corresponding elements are
equal. Note that the `nextIndex` value is not used in the equality comparison.

## Operations on header unions { #sec-expr-hu }

A variable declared with a union type is initially invalid. For example:
Expand Down Expand Up @@ -3673,6 +3692,12 @@ parser Tcp_option_parser(packet_in b, out Tcp_option_stack vec) {
}
~End P4Example

Two header unions can be compared for equality (==) or inequality (!=)
if they have the same type. The unions are equal if and only if all
their corresponding fields are equal (i.e., either all fields are
invalid in both unions, or in both unions the same field is valid, and
the values of the valid fields are equal as headers).

## Method invocations and function calls { #sec-functions }

Method invocations and function calls can be invoked using standard
Expand Down