Example of how to code and run P4 program simulating ALU.
Presented at Software Router BoF @ IW2017 Japan
GitHub: https://github.com/ebiken/p4sandbox/tree/master/p4alu
This was originally uploaded to slideshare_com and moved here on Nov, 2022.
The original idea of implementing ALU on P4 was presented by many others before this slide. Sorry that I do not remember the exact presentation I was inspired from, but wanted to note this is not the first slide/code to share this idea. (it's most likely one of "P4 Language Consortium" event / preson)
Also, more sophisticated code exists as tutorial / exercises.
https://github.com/p4lang/tutorials/tree/master/exercises/calc