p4lang / p4-hlir

Apache License 2.0
32 stars 40 forks source link

shift_left and shift_right primitives #32

Closed thantry closed 7 years ago

thantry commented 7 years ago

It appears that these primitives should be allowed in actions by P4-14 (see page #41) ,

https://p4lang.github.io/p4-spec/p4-14/v1.0.4/tex/p4.pdf

but don't seem to be supported by the frontend compiler?

Also, it would be nice for the language to allow for these (value1, value2) to also include control plane args, in addition to immediates & fields.

jafingerhut commented 7 years ago

Try getting a copy of this file: https://github.com/jafingerhut/p4lang-tests/blob/master/v1.0.3/switch-orig/primitives.json

Then add the command line option "--primitives primitives.json" to your compilation command line.

thantry commented 7 years ago

Thanks! Any reason (given that is part of the standard language) to not directly add it to: https://github.com/p4lang/p4-hlir/blob/master/p4_hlir/frontend/primitives.json and merge to master?

jafingerhut commented 7 years ago

I don't know the history here. Perhaps someone else can answer that.

antoninbas commented 7 years ago

there's no reason for not having support really; these primitives were just added later to the spec i'll update the primitives.json file in this repo