diff --git a/p4-16/spec/P4-16-spec.mdk b/p4-16/spec/P4-16-spec.mdk index fb28c1e6ce..89f6379e1e 100644 --- a/p4-16/spec/P4-16-spec.mdk +++ b/p4-16/spec/P4-16-spec.mdk @@ -3489,6 +3489,10 @@ Bit-strings also support the following operations: The effect of this statement is to set bits `H` through `L` (inclusive of both) of `e` to the bit-pattern represented by `x`, and leaves all other bits of `e` unchanged. A slice of an unsigned integer is an unsigned integer. + A slice may also be specified as `[L+:W]` where L is the lowest bit of the slice + and W is the width of the slice. In this case, only W must be a non-negative compile-time + known numeric value. L must also be a numeric value and some architectures may require + it to likewise be compile-time know. Some architectures may allow variable indexing. - Concatenation of bit-strings and/or fixed-width signed integers, denoted by `++`. The two operands must be either `bit` or `int`, and they can be of different signedness and width. The result has the same signedness as the diff --git a/p4-16/spec/grammar.mdk b/p4-16/spec/grammar.mdk index 72370142be..03bccf6242 100644 --- a/p4-16/spec/grammar.mdk +++ b/p4-16/spec/grammar.mdk @@ -1003,6 +1003,7 @@ lvalue | lvalue "." member | lvalue "[" expression "]" | lvalue "[" expression ":" expression "]" + | lvalue "[" expression "+" ":" expression "]" | "(" lvalue ")" ; // END:lvalue @@ -1036,6 +1037,7 @@ expression | prefixedNonTypeName | expression "[" expression "]" | expression "[" expression ":" expression "]" + | expression "[" expression "+" ":" expression "]" | "{" expressionList optTrailingComma "}" | "{#}" | "{" kvList optTrailingComma "}" @@ -1086,6 +1088,7 @@ nonBraceExpression | prefixedNonTypeName | nonBraceExpression "[" expression "]" | nonBraceExpression "[" expression ":" expression "]" + | nonBraceExpression "[" expression "+" ":" expression "]" | "(" expression ")" | "!" expression %prec PREFIX | "~" expression %prec PREFIX