Module for doing some Parsing in Python

  • Thread starter Boris Boutillier
  • Start date
B

Boris Boutillier

Hi all,

I'm looking for parsing a Verilog file in my python module,
is there already such a tool in python (a module in progress) to
help instead of doing a duplicate job.
And do you know of some generic parsing module in python, in which you
give some kind of grammar and callbacks ?

Thanks for the help

Boris
 
S

Skip Montanaro

Boris> I'm looking for parsing a Verilog file in my python module, is
Boris> there already such a tool in python (a module in progress) to
Boris> help instead of doing a duplicate job. And do you know of some
Boris> generic parsing module in python, in which you give some kind of
Boris> grammar and callbacks ?

Check out the SPARK toolkit:

http://pages.cpsc.ucalgary.ca/~aycock/spark/

Skip
 
C

Corey Coughlin

I actually wrote a gate level verilog parsing module as part of a
generic netlist manipulating/translating package for work a while
back. It allowed me to do fun stuff like translate verilog to spice
and vice versa, construct netlists from python scripts, and so on.
Although it was one of my earlier python projects, so it was awfully
C-like, not particularly pythonic. I recently wrote up a new version
that was a lot more pythonic, but I haven't added verilog input or
output routines yet, just spice. And my boss might not like me
sending out that code. But in general, verilog gate level stuff isn't
too tricky to parse, buses make things kind of tricky, and there are a
lot of different variations (mine was only really reliable with
Synopsys output). And behavioral level code would be a real nightmare
to parse, I'm sure. It's a shame no one has come up with a nice BNF
to python parser package yet, although I'm pretty sure the BNF for
verilog is pages and pages (well, OK, 12 pages in my verilog book), so
doing a full parser would be a real pain regardless. Anyway, good
luck to you, if you do come up with something good, be sure to keep us
posted! :D
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top