Hi,
when I want to parse header stack, I compare the header field value with the [ .lastIndex ]value of header stack, It returns [Use of uninitialized parser value] error ,I could not solve this, could you please help me?
I use the same parser logic as ng-sdn tutorial, I don’t know why it was wrong, my code is as follows
error: Use of uninitialized parser value [ ingress::parse_ipv4 : (bit<1>)(0 ++ ingress::hdr.srh.segment_left + 4294967295 == ingress::hdr.srh_segment_list.lastIndex); (bit<1>)(0 ++ hdr.srh/srh.segment_left + 4294967295 == hdr.srh_segment_list.lastIndex); ]
Number of errors exceeded set maximum of 1
I think that if you need help with any Tofino-related topic, Intel has a very friendly forum that can help you with this particular issue. Here: Intel Connectivity Research Program .
The P4 compiler for some target devices in some cases accept different subsets of the P4 language features. I do not know if that is the case here, but if you want to know if the code you have written can be accepted by the most general P4 compiler, you can try the open source p4test command on your program, which is part of the open source p4c compiler. If you do not already have it installed on a system accessible to you, probably the fastest way to try it out is to install a fresh Ubuntu 20.04 Linux system, e.g. in a VM, and run the install-p4dev-v5.sh script on it (takes about 3 minutes if your Internet connection is not too slow – only downloads about 250 MBytes in the install process), documented here: p4-guide/README-install-troubleshooting.md at master · jafingerhut/p4-guide · GitHub
@aoiland – if you just want to check if the program is a formally valid P4 code, you can always use p4test backend that comes as a part of p4c. For TNA the verification would be done like this:
Having said that, each target backend has the right to reject any P4 program if it can’t be compiled for that target, irrespective of whether it is syntactically valid or not. Therefore, if you want your P4 program to work on a certain target, you need to follow it’s rules and constraints, which I’ll be happy to discuss in the appropriate forum.