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

0-width bitstrings #931

Merged
merged 3 commits into from May 4, 2021
Merged

0-width bitstrings #931

merged 3 commits into from May 4, 2021

Conversation

mihaibudiu
Copy link
Contributor

@mihaibudiu mihaibudiu commented Apr 2, 2021

Personnel

Design

  • Document: See spec changes

Implementation

Process

positive integer greater than 0. When using an expression for the
size they must be parenthesized.
positive integer greater or equal to 0. When using an expression for
the size they must be parenthesized. Bitstrings with width 0 are
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"expression" is singular, so "they" should be "it".

@mihaibudiu
Copy link
Contributor Author

Implement this check in the compiler.

@mihaibudiu
Copy link
Contributor Author

I realized that varbit<0> should also be supported.

@mihaibudiu
Copy link
Contributor Author

The compiler supports this now in p4lang/p4c#2724

@mihaibudiu
Copy link
Contributor Author

If I can get a review on this PR we can probably merge it as well.

@mihaibudiu mihaibudiu mentioned this pull request May 4, 2021
9 tasks
Copy link
Contributor

@jnfoster jnfoster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Thanks!

@@ -2038,7 +2040,7 @@ values, P4 provides a special bit-string type whose size is set at
runtime, called a `varbit`.

The type `varbit<W>` denotes a bit-string with a width of at most `W`
bits, where `W` must be a positive integer that is a compile-time
bits, where `W` must be a positive or zero integer that is a compile-time
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"non-negative"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird, I was pretty sure I had made this change.

@mihaibudiu mihaibudiu merged commit b053cfb into main May 4, 2021
@mihaibudiu mihaibudiu deleted the bit0 branch May 4, 2021 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants