[P4-dev] [P4-discuss] problem for variable bits header field

Antonin Bas antonin at barefootnetworks.com
Mon Jul 24 13:35:10 EDT 2017


Removing p4-discuss, adding p4-dev

I was unable to reproduce your issue by integrating your code snippet to
one of my P4 programs.
Please make sure that you are using the latest version of p4-hlir + p4c-bm.
If the issue persists, please send use your full P4 program and your
command line invocation of p4c-bm.

Best,

Antonin

On Sat, Jul 22, 2017 at 10:44 PM, <jingy at zju.edu.cn> wrote:

> Hello!
>
>    I want to use p4_14 to write some codes.
>
>    It is my code:
>
>    header_type hash_head_t {
>        fields {
>             is_hash: 2;
>             hash_len: 6;
>             hash_field : *;
>             }
>        length: hash_len + 1;
>
>        max_length : 3;
>    }
>   header hash_head_t hash_head;
>
>
>
>   When I use bmv2, it reports:
>
> parsing successful
> semantic checking successful
> Header type standard_metadata_t not byte-aligned, adding padding
> Generating json output to /home/jingy/sdn/p4/work_space/
> project/p4_lab/hash_only_model/main.json
> Traceback (most recent call last):
>   File "/home/jingy/sdn/p4/work_space/p4c-bmv2/p4c_bm/__main__.py", line
> 203, in <module>
>     main()
>   File "/home/jingy/sdn/p4/work_space/p4c-bmv2/p4c_bm/__main__.py", line
> 195, in main
>     json.dump(json_dict, fp, indent=4, separators=(',', ': '))
>   File "/usr/lib/python2.7/json/__init__.py", line 189, in dump
>     for chunk in iterable:
>   File "/usr/lib/python2.7/json/encoder.py", line 434, in _iterencode
>     for chunk in _iterencode_dict(o, _current_indent_level):
>   File "/usr/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
>     for chunk in chunks:
>   File "/usr/lib/python2.7/json/encoder.py", line 332, in _iterencode_list
>     for chunk in chunks:
>   File "/usr/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
>     for chunk in chunks:
>   File "/usr/lib/python2.7/json/encoder.py", line 332, in _iterencode_list
>     for chunk in chunks:
>   File "/usr/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
>     for chunk in chunks:
>   File "/usr/lib/python2.7/json/encoder.py", line 442, in _iterencode
>     o = _default(o)
>   File "/usr/lib/python2.7/json/encoder.py", line 184, in default
>     raise TypeError(repr(o) + " is not JSON serializable")
> TypeError: auto_width is not JSON serializable
>
> I do not know how to solve it.
>
>
> Best wishes!
>
> _______________________________________________
> P4-discuss mailing list
> P4-discuss at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-discuss_lists.p4.org
>



-- 
Antonin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170724/1d1c84a2/attachment-0002.html>


More information about the P4-dev mailing list