hihi,
so the question as in $subj$ do you know a very simple p4-16 interpreter in .c or in .java hanging around??
not a full one but a very simple like 1000-2000 loc max… the use case is to test/develop the rare/freertr
emulated (bmv2) target more easily/quicky??? if nothing exists, then whats your opinion, would it be hard
for me (i dont think sooo:) to write one aaand would it worth the effort???
even is this allowed to have one?
surely it’ll be a way too incomplete etc, just to run the
which uses just a very small subset of p4-16… i was thinking to write the emulator for the .json
files but mehhh, i find the .p4 files more fun tbh…
vlad @ intel:
First of all, there can be no such thing as a “P4_16 interpreter” – at the very minimum you need to add the name of the architecture there. For example, BMv2 support P4_16/v1model and to a certain extent P4_16/PSA.
Secondarily, I do not quite understand what is that you are trying to achieve and what are you requirements. So, it is not clear to me what is that you do not like on BMv3, for example. Note also, that P4_DPDK can also be considered a P4_16/PSA(-subset) emulator, as are other targets, like P4_EBPF, etc.
me:
hmmmm so yesss P4_16/v1model for sure… not the tna* stuff, yet, nor the rest that bmv2 do, etc…
ooo my idea is the following in a quick example:
apply {
if (ig_md.mpls0_valid == 1) {
tbl_mpls_fib.apply();
if ((ig_md.mpls_op_type == 1) && (ig_md.mpls1_valid == 1)) {
tbl_mpls_fib_decap.apply();
}
}
}
}
seems easily implemented in an interpreter (not a compiler like you do mostly)
then one can realtime experiment with p4lang… i’ve done this b4 for tcl(sh):
h**ps://github.com/rare-freertr/freeRtr/blob/master/src/net/freertr/user/userScript.java
this one is here to make rare/freertr a bit more cisco-alike:
h**ps://www.cisco.com/c/en/us/td/docs/ios-xml/ios/ios_tcl/command/ios-tcl-cr-book/ios-tcl-cr-c1.html
but i even written a virtual machine to be compatible with an other stuff:
h**ps://github.com/rare-freertr/freeRtr/blob/master/src/net/freertr/user/userVM.java
it’s only 1500 loc and imho turing-complete if you know that stuff…
ps: i’ve just registered to the forum, but first i wanted to know if you’re
against a very incomplete p4 interpreter , not a compiler or anything…