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

Initializing Header Stacks #198

Closed
3 of 9 tasks
vgurevich opened this issue May 11, 2017 · 5 comments
Closed
3 of 9 tasks

Initializing Header Stacks #198

vgurevich opened this issue May 11, 2017 · 5 comments

Comments

@vgurevich
Copy link
Contributor

vgurevich commented May 11, 2017

Personnel

Design

  • Document: See below

Implementation

  • p4-spec:
  • p4c:

Process

  • LDWG discussed:
  • LDWG approved:
  • Merged into p4-spec:
  • Merged into p4c:

Hello,

I was wondering if it is possible to initialize header stacks, and if yes, how.

Obviously, we can initialize headers using tuples:

vlan_tag_t vtag = { 3w5, 1w0, 12w100, 16w0x0800 };

However, it is not clear what to do with a stack. I tried a tuple of tuples, which didn't go well:

vlan_tag_t[2] vtag = {
    { 3w5, 1w0, 12w100, 16w0x0800 },
    { 3w5, 1w0, 12w100, 16w0x0800 }
};

The compiler said: "Cannot unify Tuple(2) to header vlan_tag_t[]"

I tried to flatten the initializer, by removing the internal braces. In that case the compiler could not unify Tuple(8) to vlan_tag_t[].

Casting didn't work either.

Is there any kind of tuple that can be unified with a header stack?

Thanks,
Vladimir

@mihaibudiu
Copy link
Contributor

There are no array initializers, you have to initialize each element by hand.

@vgurevich
Copy link
Contributor Author

This is definitely an inconsistency, (since other compound types can be initialized), but the one we can live with. Something for the future?

@jnfoster
Copy link
Contributor

jnfoster commented May 11, 2017 via email

@mihaibudiu
Copy link
Contributor

Let's implement something.

@jnfoster
Copy link
Contributor

In the interest of tidying up the set of active issues on the P4 specification repository, I'm marking this as "stalled" and closing it. Of course, we can always re-open it in the future if there is interest in resurrecting it.

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