Re: Python plugin for Gnucap
Thomas Ibbotson <[email protected]>
| Newsgroups | gmane.comp.gnu.gnucap.devel |
|---|---|
| Message-ID | <[email protected]> |
henrik johansson wrote: > Hi all, > > My name is Henrik Johansson and I have been lurking on this list for > quite a long time. I am an analog/RF IC designer by trade > and I normally work with commercial simulators like Spectre and Eldo. > > I think Gnucap is really the best open-source simulator out there but > unfortunately the open-source EDA world lacks a post-processing > framework like the Ocean library in Cadence and a nice > waveform-viewer. According to me this should be written in Python. > > I have seen that there have been some fruitless attempts to write a > python module for gnucap but I don't know how far they came. Anyway, > I gave it a shot myself and wrote a plugin for gnucap which registers > a new "python" command that starts a Python interpreter and > runs a python script where the filename is given as an argument. I > have already talked to Al about it and he urged me to write to the > list instead so here it comes! > > In order to do something interesting in the embedded Python > interpreter I also wrote a Swig wrapper for some of the gnucap > classes. Currently this allows you to extend the CMD class in python > and register new commands written in Python. As an example I wrote a > new plot function that plots a stored waveform using matplotlib. > > I also tried a different approach, to compile gnucap as a shared > library and write a gnucap extension for Python that calls that > basically replaces the gnucap command main function. This way could be > useful if gnucap is called from a high level simulation environment. > The modifiaction is only in the autoconf/automake files so no code is > changed. Along with the shared library, the header files are also > installed in $PREFIX/include/gnucap which makes it possible to compile > plugins freely without relying on the gnucap source tree. The gnucap > command now contains only the main function and is dependent on the > share library libgnucap.so. > > The modified gnucap source tree can be found at > http://github.com/henjo/gnucap. > > The python plugin is here: > http://github.com/henjo/gnucap-python. You can download tar-balls of > all github repos directly. > > I think this can also be used to implement new analyses like periodic > steady state which can run as a Python defined command and run > transients from gnucap. The performance penalty should be minimal. > > Best regards, > > Henrik Johansson > > Thanks for this, I am currently using python and gnucap together by running gnucap via a pipe, writing the results to a file and then plotting with matplotlib. I will be very interested to try your Python interface once I have more time. Thanks, Tom