user2261693
user2261693

Reputation: 405

Verilog gate level parser

I want to parse Verilog gate level code and store the data in a data structure (ex. graph).

Then I want to do something on the gates in C/C++ and output a corresponding Verilog file.

(I would like to build one program which input and output are Verilog gate level code)

(input.v => myProgram => output.v)

If there is any library or open source code to do so?

I found that it can be done by Flex and Bison but I have no idea how to use Flex and Bison.

Upvotes: 4

Views: 6136

Answers (3)

toolic
toolic

Reputation: 62083

I have used Verilog-Perl successfully to parse Verilog code. It is well-maintained: it even supports the recent SystemVerilog extensions.

See also: How do I write a regex to match the module instantiation in a Verilog file?

Upvotes: 1

CliffordVienna
CliffordVienna

Reputation: 8245

Yosys (https://github.com/cliffordwolf/yosys) is a framework for Verilog Synthesis written in C++. Yosys is still under construction but if you only want to read and write gate-level netlists it can do what you need..

PS: A reference manual (that also covers the C++ APIs) is on the way. I've written ~100 pages already, but can't publish it before I've finished my BSc. thesis (another month or so).

Upvotes: 1

Morgan
Morgan

Reputation: 20514

There was a similar question a few days ago about doing this in ruby, in which I pointed to my Verilog parser gem. Not sure if it is robust enough for you though, would love feedback, bug reports, feature requests.

There are perl verilog parsers out there but I have not used any of them directly and avoid perl, hopefully others can add info about other parsers.

Upvotes: 1

Related Questions