Skip to content

hanw/p4c-bm

 
 

Repository files navigation

p4c-bm

image

Generates the JSON configuration for the behavioral-model (bmv2), as well as the PD (Protocol Dependent) library C/C++ files, if needed.

Usage

  • To install p4c-bm on your machine:
    • sudo pip install -r requirements.txt
    • sudo python setup.py install
  • Using p4c-bm
    • Try p4c-bm -h
    • --json to generate a JSON representation of the P4 program
    • --pd to generate the PD C++ code
  • Compiling the PD

    You can copy the generated C++ PD file to your project directory (and compile them with your app).

    You can also use the pd_mk directory to compile the PD code:

    • cd pd_mk/
    • ./configure --includedir=<target_dir_for_headers> --libdir=<target_dir_for_libraries>
    • make 'P4_PATH=<path_to_p4_program>' 'P4_PREFIX=<prefix_for_apis>'
    • make install

    You will find the PD headers (fixed and generated) in target_dir_for_headers and the libraries (libpdfixed and libpd) in target_dir_for_libraries.

    If your main project also uses autotools, you may be able to integrate pd_mk directly in your infrastructure with AC_CONFIG_SUBDIRS

About

Generates the JSON configuration for the behavioral-model (bmv2), as well as the PD library C/C++ files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 53.7%
  • Python 26.5%
  • C 11.7%
  • Thrift 7.6%
  • Shell 0.5%