[P4-dev] P4 add header

Jeferson Santiago da Silva eng.jefersonsantiago at gmail.com
Sat May 13 20:31:17 EDT 2017

Hey Shahar,

you are right regarding to the primitives.cpp files. However, adding a
primitive in P4 would require a modification in the P4 backend compiler (I
am assuming your new primitive is declared in P4 as an extern function).
A easy way to add hardware specific primitives is using extern types. The
support to extern types was pushed to the p4c compiler this week and it is
a good time to test it out.
I have some extern types examples in my github page. You can check it out.


Date: Tue, 17 Jan 2017 11:30:45 +0200
> From: Shahar Schneor <schneor13 at gmail.com>
> To: p4-dev at lists.p4.org, Yamit Barshatz <yamitbarshatz at gmail.com>
> Subject: [P4-dev] P4 add header
> Message-ID:
>         <CAG1wChObb=hy27fyE17cYVPJmTXFrHcubnSXj=Xo
> apXmmE2aww at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
> Hi there,
> My partner and me are new to p4 and we are working on p4 project in our
> university.
> We are trying to change the simple_router example, in behavioral-model, to
> add another header for all messages and we are not succeed.
> We saw that we need to add a new primitive to the cpp file of it but in the
> compile we need this file as json file? If yes how we should make this json
> file for peimitives.cpp? And if not what the solution should be?
> Also we are trying to define new header to add it to the messages and when
> we comvert the p4 file - simple_router.p4 to json file with p4c it is
> ignored the header define(it is notice to other changes e.g. ttl reduction
> to 2).
> Hope the questions are not to messy and thanks anyway !!!
> Shahar Schneor
> Yamit Bar-Shatz
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/
> attachments/20170117/16953413/attachment-0001.html>

Jeferson Santiago da Silva, M.Sc.
Polytechnique Montréal
Ph.D. Candidate in Computer Engineering
Hardware and Programmable Logic Design Engineer
Phone: +1 (514) 581-1004
Skype: eng.jefersonsantiago
Montreal/QC - Canada
Lattes CV: http://lattes.cnpq.br/9568850258686622
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170513/caf1fc2b/attachment-0002.html>

More information about the P4-dev mailing list