[question] Verilog RTL parser in Ruby?

K

Kev Jackson

Hi all,

We're about to start a project and we need to be able to parse RTL
files. We want to use ruby, but to save effort we're looking for a
pre-built open-source parser for RTL grammar. If not we'll have to
write our own (no big problem - it'd be an interesting learning
experience at least!).

So first, are there any tools we should be looking at to help us out?
(we're looking at coco-ruby and parsetree at the moment)
Second, if there are no tools currently available and we can build a
Ruby RTL parser would anyone be interested in us releasing it? (I only
work here, I'm not sure if the company would allow us to, but if it's
possible would people be interested?)

Kev
 
E

Eric Mahurin

I'd be interested. I'm in the IC design industry. I wrote a
verilog-2005 parser using antlr/java about a year ago (never
released it). Now I'm into ruby and writing a general parser
that has a superset of the features in antlr. Here is my first
cut at it:

http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/138450

Now that my cursor package (using this for both my character
and token streams) is to a good point, I'm back to working on
my grammar package (renamed because of another rubyforge
"syntax" project).

I wouldn't mind making a verilog parser the first target of
this.

--- Kev Jackson said:
Hi all,
=20
We're about to start a project and we need to be able to
parse RTL=20
files. We want to use ruby, but to save effort we're looking
for a=20
pre-built open-source parser for RTL grammar. If not we'll
have to=20
write our own (no big problem - it'd be an interesting
learning=20
experience at least!).
=20
So first, are there any tools we should be looking at to help
us out? =20
(we're looking at coco-ruby and parsetree at the moment)
Second, if there are no tools currently available and we can
build a=20
Ruby RTL parser would anyone be interested in us releasing
it? (I only=20
work here, I'm not sure if the company would allow us to, but
if it's=20
possible would people be interested?)
=20
Kev
=20
=20



=09
____________________________________________________
Start your day with Yahoo! - make it your home page=20
http://www.yahoo.com/r/hs=20
=20
 
P

Phil Tomson

Hi all,

We're about to start a project and we need to be able to parse RTL
files. We want to use ruby, but to save effort we're looking for a
pre-built open-source parser for RTL grammar. If not we'll have to
write our own (no big problem - it'd be an interesting learning
experience at least!).

So first, are there any tools we should be looking at to help us out?
(we're looking at coco-ruby and parsetree at the moment)

I've been wondering about wrapping the Icarus Verilog parser (I believe
it's in C). I haven't looked into it much, but if Icarus' parser is
easily seperable from the simulation parts it could be a good way to go.
Swig might be a good way of doing this.

Second, if there are no tools currently available and we can build a
Ruby RTL parser would anyone be interested in us releasing it? (I only
work here, I'm not sure if the company would allow us to, but if it's
possible would people be interested?)

Definitely. Though, I'm more of a VHDL person, I would like to see some
sort of 'Ruby for EDA' website sometime in the future.

Phil
 
P

Phil Tomson

I'd be interested. I'm in the IC design industry. I wrote a
verilog-2005 parser using antlr/java about a year ago (never
released it). Now I'm into ruby and writing a general parser
that has a superset of the features in antlr. Here is my first
cut at it:

http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/138450

Now that my cursor package (using this for both my character
and token streams) is to a good point, I'm back to working on
my grammar package (renamed because of another rubyforge
"syntax" project).

I see a file that is downloadable (syntax.rb) on the RAA link, but
there are no downloadable files at the grammar page on RubyForge. Will
you be releasing an update soon?

I wouldn't mind making a verilog parser the first target of
this.


How close is it to EBNF? I'm interested in doing a VHDL parser - how much
tweaking would I need to do to the VHDL EBNF to get something working?


After we've got Verilog and VHDL parsers working would anyone be
interested in a RubySynthesis package? Maybe verification? Or perhaps
more realistically just translation between VHDL <-> Verilog? An
automatic testbench generator would be nice (and certainly doable) as
well.

Phil
 
J

Jim Freeze

* Phil Tomson said:
Definitely. Though, I'm more of a VHDL person, I would like to see some
sort of 'Ruby for EDA' website sometime in the future.

I have considered putting one of those together, but am
not sure of the payoff. Most sites like that are full of
dead links and are extremely inactive.

I can host the site if someone can suggest a good infrastructure.
Maybe a Typo frontend and we just require that all the code
has a rubyforge project and can be obtained thru a gem.
 
E

Eric Mahurin

--- Phil Tomson said:
=20
I see a file that is downloadable (syntax.rb) on the RAA
link, but=20
there are no downloadable files at the grammar page on
RubyForge. Will=20
you be releasing an update soon?

within the next few weeks.
=20
=20
How close is it to EBNF? I'm interested in doing a VHDL
parser - how much=20
tweaking would I need to do to the VHDL EBNF to get something
working?

The grammar is specified in pure ruby using operators to
combine grammars ("|": alternation, "+": sequence, etc). It
looks kind of like BNF, but you are really just building ruby
objects using methods.

After we've got Verilog and VHDL parsers working would anyone
be=20
interested in a RubySynthesis package? Maybe verification?=20
Or perhaps=20
more realistically just translation between VHDL <-> Verilog?
An=20
automatic testbench generator would be nice (and certainly
doable) as=20
well. =20


dream on :)
=20
=20
=20
=20



=09
____________________________________________________
Start your day with Yahoo! - make it your home page=20
http://www.yahoo.com/r/hs=20
=20
 
P

Phil Tomson

I have considered putting one of those together, but am
not sure of the payoff. Most sites like that are full of
dead links and are extremely inactive.

Yup. I've seen'em too.
I can host the site if someone can suggest a good infrastructure.
Maybe a Typo frontend and we just require that all the code
has a rubyforge project and can be obtained thru a gem.

Yes, this requirement is a good idea. No need for it to actually host the
code, but the code should be available on RubyForge.

Maybe using Typo could actually influence it to be a blog where there are
a few contributors? Maybe having 3 or 4 contributors initially would be a
nice start. That way perhaps we could avoid the common blogging problem
where you start a blog and then either lose interest or get busy and then
quit posting. Having 3 or 4 people contribute (and potentially
more in the future) could keep it more active. As such it could be a
site for EDA-related Ruby development/activity (or Ruby-related EDA
activity?)

....or would it make more sense for it to be a wiki?


Phil
 
T

tsuraan

I'd be interested. I'm in the IC design industry. I wrote a
verilog-2005 parser using antlr/java about a year ago (never
released it).

I'm wondering, what did you use this for? I've been looking for free
(open source preferably) synthesis tools for my FPGA collection, and
have found nothing. I figured it was because "compiling" verilog to
netlists for use on an FPGA is really hard, and the FPGAs themselves
are not well documented internally. What do you do with a Verilog or
VHDL parser, if you can't actually implement your designs?
 
P

Phil Tomson

I'm wondering, what did you use this for? I've been looking for free
(open source preferably) synthesis tools for my FPGA collection, and
have found nothing. I figured it was because "compiling" verilog to
netlists for use on an FPGA is really hard, and the FPGAs themselves
are not well documented internally.

Certainly and this is by design. Xilinx and Altera are very secretive,
they don't want people reverse engineering their FPGAs. Not that it would
be a huge problem because they're well protected by patents.

That said, I believe you can use Icarus (open source Verilog
simulator and now synthesis tool) to synthesize to some of the older
Xilinx architectures. Also, it can't be impossible to get the needed
information (Synplicity, for example, makes FPGA synthesis tools that
target Xilinx, Altera and others' parts), but there may be NDA forms to
sign. I suspect the bitstream files are the tricky part.
What do you do with a Verilog or
VHDL parser, if you can't actually implement your designs?

Actually there are lots of possibilities if you have Verilog/VHDL parsers:

1) You could create translators between the two or to cycle-based
C or SystemC.
2) You could create a testbench generation tool. The tool would look at
your toplevel entity/module and then it could create the skeleton for your
testbench. Of course, you don't need a full parser for this, but if you
have one it'll make things easier.
3) It would be possible to create verification and code analysis tools.
4) Synthesis/Tech mapping. Nothing would stop you from creating
VHDL/Verilog or EDIF netlists (gate level). Because Ruby is a very
flexible language it would be interesting to use it to develop an
experimental synthesis platform where you could easily try new algorithms,
datastructures, etc.

....lots of possibilities.


Phil
 
T

tsuraan

That said, I believe you can use Icarus (open source Verilog
simulator and now synthesis tool) to synthesize to some of the older
Xilinx architectures. Also, it can't be impossible to get the needed
information (Synplicity, for example, makes FPGA synthesis tools that
target Xilinx, Altera and others' parts), but there may be NDA forms to
sign. I suspect the bitstream files are the tricky part.

That's cool to know. I'll have a look that those projects.
Actually there are lots of possibilities if you have Verilog/VHDL parsers= :
=20
1) You could create translators between the two or to cycle-based
C or SystemC.
2) You could create a testbench generation tool. The tool would look at
your toplevel entity/module and then it could create the skeleton for you= r
testbench. Of course, you don't need a full parser for this, but if you
have one it'll make things easier.
3) It would be possible to create verification and code analysis tools.
4) Synthesis/Tech mapping. Nothing would stop you from creating
VHDL/Verilog or EDIF netlists (gate level). Because Ruby is a very
flexible language it would be interesting to use it to develop an
experimental synthesis platform where you could easily try new algorithms= ,
datastructures, etc.
=20
....lots of possibilities.

Ok, that's cool. I was sort of hoping you'd point me towards the
elusive OpenXilinxTools, the mythical totally free implementation of
the Xilinx software, but I guess I'll have to keep looking :)
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top