[P4-dev] Switch.p4 compilation

Frédéric LOUI frederic.loui at renater.fr
Fri Feb 1 13:49:47 EST 2019


Hi Mihai,

> It’s indeed a complicated story.
That is precisely why it is fun. (no pain no gain… :-) )

> There are also several versions of switch.p4
I saw indeed some occurrence, could you if it is not a too long list tell me the version of switch.p4 ?

> If you want to compile for another device (than the bmv2 simulator) then you will have to find a compiler that supports your target.
I guess that at some point I’ll use TOFINO target from BAREFOOT.

> You should be able to install all the compilers at the same time, they won’t interfere with each other.

This is what I’ve done.

And so far, I managed to compile switch.p4 (version from https://github.com/p4lang/switch)

Now I’ll investigate NTF in order to test this switch next week. :-)

Thanks in advance for your valuable insight !

All the best,

--  Frederic LOUI / GIP RENATER
P²TI (Programs, Transversal Projects and Innovation)
Tel: +33 1 53 94 20 40 / Mob: +33 6 73 29 46 05
frederic.loui at renater.fr http://www.renater.fr 

> Le 1 févr. 2019 à 18:06, Mihai Budiu <mbudiu at vmware.com> a écrit :
> 
> It’s indeed a complicated story.
> 
> There are two compiler families, an old one, written in Python, which supports only P4-14, including p4-bmv2. This compiler is not changing much. There are proprietary back-end for this compiler for various devices.
> 
> The new family is written in C++ and supports P4-14 and P4-16, including p4c, p4c-bm2-ss. This compiler is changing a lot. There are also proprietary back-ends for this compiler as well.
> 
>  
> 
> There are also several versions of switch.p4. This program is written in P4-14, and it should compile with both compilers. However, the newer compilers have had some regressions lately, and since we are not testing the output produced when compiling switch.p4 it may be that today they won’t generate code that works correctly on the bmv2 simulator.
> 
>  
> 
> If you want to compile for another device (than the bmv2 simulator) then you will have to find a compiler that supports your target.
> 
>  
> 
> You should be able to install all the compilers at the same time, they won’t interfere with each other.
> 
>  
> 
> Mihai
> 
>  
> 
> From: P4-dev <p4-dev-bounces at lists.p4.org> On Behalf Of Frédéric LOUI
> Sent: Friday, February 1, 2019 2:13 AM
> To: p4-dev at lists.p4.org
> Subject: [P4-dev] Switch.p4 compilation
> 
>  
> 
> Hi !
> 
>  
> 
> I’m fairly new to p4 language so sorry if I could not find the complete answer using my Google-fu skills …
> 
>  
> 
> I studied various tutorial and manage to have the examples working.
> 
> As an exercise, I would like to study switch.p4 reference program.
> 
>  
> 
> As a first step I’d like to compile and run switch.p4 reference here: https://github.com/p4lang/switch
> 
>  
> 
> The problem is that in my environment I installed:
> 
>  
> 
> * p4c able to compile p4_14 and p4_16
> 
> * p4c-bm2-ss for simple_switch target
> 
>  
> 
> In switch.p4 it is referenced that I should use:p4c-bmv2 that can be found here: https://github.com/p4lang/p4c-bm
> 
> In some thread I saw that p4-bmv2 is the official.  Compiler for p4_14.
> 
>  
> 
> So my question: can I use the more versatile p4c instead of p4-bmv2 in order to compile switch.p4 ?
> 
> Or should I try to user p4c-bm-ss ? (Not sure if simple_switch target can be use the full fledge switch.p4 reference though :-) ) 
> 
>  
> 
> In that case, I’ll consider to install also p4c-bmv2 via https://github.com/p4lang/p4c-bm
> 
>  
> 
> Last question:
> 
>  
> 
> Is p4c-bm (for p4_14 program) can coexist in the same machine as p4c or should I take some precaution while installing both on the same machine ?
> 
>  
> 
> Again sorry if these are « simple » question. If the issue has been discussed many times before I’d like to get a referent link or doc.
> 
>  
> 
>  
> 
> Thanks for your help !
> 
>  
> 
> All the best
> 
> --  Frederic
> 
>  
> 
>  
> 
>  
> 




More information about the P4-dev mailing list