[P4-dev] Simulate FOR and/or WHILE cycles (p4-14)

Diogo Pinto diogo.f1.p2 at gmail.com
Thu Apr 13 09:17:33 EDT 2017


Hello,

I need to perform several multiplications and additions over a subset of
bits and packets.

For instance:

1. Grab X bits of packet Y and perform several additions/multiplications
over them
2. Repeat 1 for several other packets Z
3. Store all the results for later use


The main issue is that Z can reach hundreds, and so the problem is:

   - The quantity of registers I need to store all the bits,
   - All the metadata required, to copy the values from registers, in order
   to be able to use it as a parameter to multiplications and additions,
   - And all the metadata required to store intermediate results.

Also, I cant even have stacks of metadata headers. You can see the problem
of manually store all values and perform all operations. It will take ages
to write the code. Not to say, the complexity of it.

As far as I know P4 doesnt implement cycles. Is there any way of simulating
one ?

Also, is there any strategy to organize my metadata, so that I can use some
kind of index to access some field, instead of manually specify the field I
want to manipulate ?? That way, maybe I could write some generic actions,
to be used in several contexts.

Thank you,
Diogo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170413/4e9346a0/attachment-0002.html>


More information about the P4-dev mailing list