Checksum extern proposal discussion on May 8th

31 views
Skip to first unread message

Shirshyad, Mahesh

unread,
May 4, 2023, 6:28:01 PM5/4/23
to p4-...@lists.p4.org, Fingerhut, John Andy, Baldi, Mario

Mahesh Shirshyad

unread,
May 15, 2023, 2:47:25 PM5/15/23
to p4-arch, Shirshyad, Mahesh, Fingerhut, John Andy, Baldi, Mario
As requested in the last week's checksum proposal presentation, I have uploaded example code. Pls check.


/mahesh

On Thursday, May 4, 2023 at 3:28:01 PM UTC-7 Shirshyad, Mahesh wrote:

Andy Fingerhut

unread,
Jul 25, 2023, 2:36:39 AM7/25/23
to Mahesh Shirshyad, p4-arch, Shirshyad, Mahesh, Fingerhut, John Andy, Baldi, Mario
Mahesh, I tried out some snippets of code in the open source p4c compiler, and checked in the P4 language spec in Appendix F.

It appears it is legal to pass extern object instances as parameters to extern method calls.  See Appendix F of the language spec, the third table in that appendix.  The row "extern" and column "extern" contains "yes", which means that an extern instance can be a run-time parameter to an extern method call, or extern function call.

Here is a public issue I created with some code snippets showing that open source p4c today accepts without error an extern method call taking an extern object instance as a parameter: https://github.com/p4lang/p4-spec/issues/1262

Unfortunately, p4c gives a compile-time error if you try to declare an extern object method that takes its OWN extern type as the type of a method parameter, as shown by my second code snippet in that linked issue.  That is what we discussed verbally today, and will not work without some enhancement or bug fix to p4c (if it is a bug in p4c at all, which I'm not sure of).

We _could_ have an extern method that takes a string as a parameter, which we have done in PNA for the add_entry() extern function.  Such a string we could say "must be the name of an extern object instance in the progarm".  That is a bit hacky, I know, to use a string instead of the extern object instance itself, but as you can see from the add_entry() extern function we are not completely above such techniques already.

Andy


--
You received this message because you are subscribed to the Google Groups "p4-arch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to p4-arch+u...@lists.p4.org.
To view this discussion on the web visit https://groups.google.com/a/lists.p4.org/d/msgid/p4-arch/b2a15a45-40dd-499b-9960-8335e804ba21n%40lists.p4.org.
Reply all
Reply to author
Forward
0 new messages