Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  IPC::Locker
  Parallel::Forker
  Voneline
General Info
  Papers

Verilator + SWIG = Python wrapper?

Added by Chase Meadors almost 6 years ago

Hi,

I was wondering if anyone had successfully used SWIG to generate a python wrapper around Verilator's output.

I experimented a little with the issue last night. I know how to use Verilator, and I know how to use SWIG, but I had the feeling it was going to be a non-trivial task to get them working together with Verilator's build process and all.

Has anyone covered this ground already?


Replies (6)

RE: Verilator + SWIG = Python wrapper? - Added by Wilson Snyder almost 6 years ago

There's Verilog-Perl of course. This uses perl-XS but could be converted to SWIG, and the support library ported, and then it would work on python. A decent sized project but not too bad; it would certainly make many people happy including myself if you would take this on.

There's no Verilator interface. People often want an elaborated netlist with Verilog-Perl which it is incapable of, so there would be value in using Verilator instead for that.

Another possibility is to suck in the XML output of verilator and write the related parsing into Python.

RE: Verilator + SWIG = Python wrapper? - Added by Chase Meadors almost 6 years ago

What is this about XML output from Verilator? I would like to look into that.

RE: Verilator + SWIG = Python wrapper? - Added by Wilson Snyder almost 6 years ago

Use --xml and it will dump the internal data structures. It's experimental and low-level in that the output will change each release, but it could be sucked into python for example. If we did that, we'd want to release the python that uses the data along with Verilator, otherwise it would break with each verilator change.

RE: Verilator + SWIG = Python wrapper? - Added by Aaron Kelly about 1 year ago

I know this is 4 years old but this was the method used in my Python-Verilator testbench generator

https://github.com/AaronKel/Nirah

It uses SWIG to wrap the output for Python

RE: Verilator + SWIG = Python wrapper? - Added by Yehowshua Immanuel 3 months ago

Actually, verilator now has built in support for exporting a Python class here. https://github.com/patstew/verilator/tree/python/examples/make_python

    (1-6/6)