[P4-discuss] problem for variable bits header field

jingy at zju.edu.cn jingy at zju.edu.cn
Sun Jul 23 01:44:20 EDT 2017


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!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-discuss_lists.p4.org/attachments/20170723/91da57ab/attachment-0002.html>


More information about the P4-discuss mailing list