Open danisrcnl opened 2 years ago
We do have the P4C
class at https://github.com/nsg-ethz/p4-utils/blob/master/p4utils/utils/compiler.py
You should check where the P4C class is being used in the code and how you can change the p4_bin
and opts
to use your custom compiler.
If you are using the python
interface, see examples that use network.py
you can set the compiler options with : https://github.com/nsg-ethz/p4-utils/blob/master/p4utils/mininetlib/network_API.py#L950
Otherwise, you can use the compiler_module
option to add your compiler. You can see the parsing code here:
https://github.com/nsg-ethz/p4-utils/blob/master/p4utils/p4run.py#L277
For the time being, if you do not manage to navigate the code you can simply modify this line (in your local code):
https://github.com/nsg-ethz/p4-utils/blob/master/p4utils/utils/compiler.py#L35
And replace p4c for p4c-bm2-ss
, in the case you have different default compiler options than '--target bmv2 --arch v1model --std p4-16'
you should also try to modify that.
I realized that with the p4app.json
changing the compiler it has become a bit harder than before. When we find time we will try to make it simpler.
I'm not sure this is a true issue, but as long as there's no documentation online I'd rather try to ask it to you. I need to compile using p4c-bm2-ss compiler to use my custom externs. I was capable of doing it with a previous version of p4utils (the one in the p4lang pre-built vm) by setting the "compiler" field in p4app.json file. But now that the "compiler_module" field should be filled, I'm not so sure I can force the usage of that compiler as no python class has been implemented for it in p4utils/utils/compiler subfolder.
Thank you in advance.