[P4-dev] How to write a back-end compiler for P4_16?

Wu, Xiaoban Xiaoban_Wu at student.uml.edu
Fri Dec 30 15:41:24 EST 2016


Dear P4 Developers,


Since nobody has replied my previous email, I just played it for a while.


I found that in the link http://p4.org/wp-content/uploads/2016/12/P4_16-prerelease-Dec_16.html , there are some errors that need to be fixed. The following are how I attempted to fix them.


First,


extern Checksum16 {
    void clear();           // prepare unit for computation
    void update<T>(T data); // add data to checksum
    void remove<T>(T data); // remove data from existing checksum
    bit<16> get(); // get the checksum for the data added since last clear
}


fixed as


extern Checksum16 {
    Checksum16(); //constructor
    void clear();
    void update<T>(in T data); //for parameter binding
    void remove<T>(in T data); //for parameter binding
    bit<16> get();
}


Second,

action Drop_action()
      { outCtrl.port = DROP_PORT; }

fixed as

action Drop_action()
      { outCtrl.outputPort = DROP_PORT; }

I have used the back-end compiler "p4test" to get its JSON file, it seems much more complicated than the JSON file of the simple_router.p4, since they tired to do the similar things.

I still expect some detailed documentations or explanations on the format of the JSON file. It would be very helpful for the understanding of the IR and the development of a back-end compiler. Thank you very much.

Best wishes,
Xiaoban
________________________________
From: P4-dev <p4-dev-bounces at lists.p4.org> on behalf of Wu, Xiaoban <Xiaoban_Wu at student.uml.edu>
Sent: Wednesday, December 28, 2016 12:14:43 AM
To: p4-dev at lists.p4.org
Subject: [P4-dev] How to write a back-end compiler for P4_16?

        This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing<http://aka.ms/LearnAboutSpoofing>      Feedback<http://aka.ms/SafetyTipsFeedback>

Dear P4 developers,


I am a beginner of P4_16 https://github.com/p4lang/p4c, I would like to know if there is hlir for P4_16 like the hlir for P4_14?


If so, is there any documentation talking about the details of the hlir, i.e. how to generate the hlir for the given P4_16 files, the structure of each object in the hlir?

If not, in general, how do we write a back-end compiler for P4_16?

Thank you very much for your help.

Best wishes,
Xiaoban
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161230/a34c7508/attachment-0002.html>


More information about the P4-dev mailing list