Some confusion about P4 hardware implemention.
Hi, I try to implement the hardware version of Elastic Sketch in a P4 programmable switch. I note that the stateful ALU has following restrictions : 1. Each packet can only access a specific register once. 2. RegisterAction can only access 2 PHV container values and 4 constants, with not more than 2 comparsions. In my implemention, I realize it cannot read the <key, vote+> register first, because it must to perform read-test-write in one RegisterAction. So, I read vote_all first, dividing it by right-shift, and then put the result as the threshhold in a metadata field. Then , I perform the RegisterAction to read-test-write the <key, vote+> register. But here I meet a challenge: Challenge: In the RegisterAction, I need to read at least three PHV value (hdr, the computed threashold, and the count). And It cannot fit in one stateful ALU. I note that if I only want to measure the packet count, there is no problem. But what if I need to count the packet length? I am comfused of this question a few days. Thanks for any suggestions.
Best wishes, Hao Zheng.