netlist translation via XML/XSLT

"Andrew Plumb" <[email protected]>
Newsgroups gmane.comp.gnu.gnucap.devel
Message-ID <[email protected]>
Hi Everyone,

Jonathan David pinged me on this one (re. Re: [Gnucap-devel] Verilog -
was: Re: Use of M as suffix for Mega, Date: 	Thu, 24 Aug 2006 17:11:18
-0700 (PDT)).  It's probably not a good idea for me to contribute the
actual code I wrote a while back to do netlist translation, but I'm quite
willing to start from scratch to create something formally GPL'd.

The way I originally structured things was as command-line, Java-based
tool to keep things platform independent.  I coded up a JavaCC-based
parser to convert Spectre-syntax and SPICE-syntax into an XML-intermediate
format, then used Java's built-in XSLT parser to transform the resulting
XML into whatever textual output was needed, including Verilog-AMS.

For a GPL'd set of tools, I think the approach I'll take is to create a
simple lex/yacc-based parser to read SPICE format from STDIN and write XML
to STDOUT.  Then anyone can use xsltproc to create/modify/enhance their
own output format, or possibly re-use the parser code to write directly to
a BSD/MySQL database or equivalent for other funky stuff.

Probable usage examples:

spice2xml < netlist.cir > netlist.xml
spice2xml -i netlist.cir -o netlist.xml
spice2xml -i netlist.cir > netlist.xml
spice2xml < netlist.cir -o netlist.xml
cat netlist.cir | spice2xml > netlist.xml

...then all you would have to do is:

xsltproc spice2vams.xsl netlist.xml > netlist.vams

...where spice2vams.xsl is the XSL transform that converts the output of
spice2xml into a Verilog-AMS equivalent.

For documentation purposes (e.g. scripted generation of design summaries),
it would be useful to also have an equivalent vams2xml.  Experience has
proven it makes a lot more sense (and saves a lot of time) to re-use the
simulator's own parser so everything stays in sync, so that would be a
lower priority on my part, not being familiar with that parser and all.

I'll be doing my development work on my (Intel-based) MacBook Pro and
check that it compiles on one of my Fedora-based machine.  That should
help keep me out of any trouble w.r.t. work conflict of interest, since
Mac isn't a supported platform. ;-)

Later!

Andrew.

-- 

E-mail:    [email protected]
Photos:    http://www.flickr.com/photos/aplumb/

Victory!  The bits shall ring out, the message of my domain...
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.