Search code examples
c++pythonverilogsystem-veriloghdl

Make HTTP Request from Verilog


Is it possible to call a C/C++/Python/Java function that makes an HTTP request inside of a Verilog module?


Solution

  • Yes, do some searching for 'DPI' or 'PLI'. If you have a SystemVerilog capable simulator the DPI solution is a lot less overhead. Basically the Verilog end of it will be:

    import "DPI" function void do_http(...)
    

    Where you can then call do_http within your Verilog like a normal task or function and you pass the .c file that implements do_http on the command line along with the rest of your sources. This of course is assuming that you're using a commercial Verilog simulator. I don't think Icarus supports DPI yet (could be wrong).

    Using VPI is a more portable but takes significantly more coding to put together. I encourage you to research that one on your own if that's what you need.