[P4-dev] Doubts Regarding use of Register

Swaroop Thool swaroopthool1991 at outlook.com
Wed Aug 5 15:08:55 EDT 2015

Hi all ,

Thanks for the answers. Few more questions:

If I write-

       register r {

            width : 9;

            static : table_which_invokes_register;

            instance_count : 500;

            attributes : saturating; }

1) If I create register array of 500(cells) as above, is it like 1-D array whose location can be read/write? How to access that because I am getting syntax error when I used modify_field(). What is the proper syntax if I want to put some value at run-time generated location of array, say 50?

2) Further extension to above,How can I store value 1 at location say, 50 in register array of 500
 created above and later increment value 1 to 2 when same location is 
encountered and maintain those values? 

3)What is layout declaration(instead of width declaration) means which require header_type_name?

4) If I create metadata for a packet to copy some value into its field, 
will value get updated with new one for another packet when same 
metadata is used for example : modify_field (metadata, somevalue) ?If yes, 
then how to maintain value of individual packets as I dont want to loose that values ? 

5)OR should I use add_field() in above. What is the difference between both? 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20150805/7d6c4e11/attachment-0001.html>

More information about the P4-dev mailing list