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

What types can be used as indexes into header stacks? #915

Closed
jnfoster opened this issue Feb 26, 2021 · 3 comments
Closed

What types can be used as indexes into header stacks? #915

jnfoster opened this issue Feb 26, 2021 · 3 comments

Comments

@jnfoster
Copy link
Contributor

The spec doesn't say... for example, is varbit allowed?

@jfingerh
Copy link
Contributor

jfingerh commented Mar 1, 2021

For compile-time known values, I would think that a reasonably conservative proposal would explicitly support only these types:

  • int
  • bit<W> for any W >= 1
  • int<W> for any W >= 1
  • Any enum type defined with an explicit storage representation that was one of the above
    For header stack index expressions that are not compile-time known values, they could not be type int, of course.

@jnfoster
Copy link
Contributor Author

jnfoster commented Mar 1, 2021

@jnfoster and @jafingerhut will take this design and flesh it out into a full-fledged PR.

@mihaibudiu
Copy link
Contributor

mihaibudiu commented Apr 30, 2021

Compiler implementation fixed in p4lang/p4c#2738

jafingerhut added a commit to jafingerhut/p4-spec-1 that referenced this issue May 3, 2021
mihaibudiu pushed a commit that referenced this issue May 3, 2021
…of-header-stack-index-expressions

Address spec issue #915 - Specify the types allowed for header stack indexes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants