The Verilog to html converter
The Rough Verilog Parser
The Rough Verilog Parser is a perl module that makes it easy to extract information from verilog designs. For instance, to print a list of all the modules in a set of verilog filse you could write a script like this:
#!/usr/bin/perl -w use rvp; # use the rough verilog parser # Read in all the files specified on the command line $vdb = rvp->read_verilog(\@ARGV,[],{},1,[],[],''); # Print out all the modules found foreach $module ($vdb->get_modules()) { print "$module\n"; }
Other things that it can do are:
- Give you back a list of instantiations in a module.
- Give you back a list of signals in a module.
- Tell you what type a signal is.
- Tell you which ports of which instantiations a signal is connected to.
- Tell you what each port of a particular instantiation is connected to.
- Give you back a list of all the tasks and functions in a module.
- Give you back a list of all the modules in a file.
It does all this in a comment and whitespace insensitive way, and it understands verilog, so it won't be confused by stuff like this.
Here are the links to save to get the Rough Verilog Parser:
- A compressed tar file with all the following files in.
- The Perl Module rvp.pm.
- An example script that uses rvp.pm.
- The documentation generated using pod2man on rvp.pm.
- An example script that makes a makefile for synthesis.
- A simple script that prints a design's hierarchy.
- A more advanced hierarchy printing script that can handle more command line options.
- Simple script to print input files with comments removed..
In order to use this perl module you need to put it somewhere perl can find it. You can put it:
- In the directory you run your script in (clunky, but good for getting started).
- In one of perl's standard include directories. Find out where these are
on your system by executing:
perl -e 'print join "\n",@INC'
(or just try running a script that uses rvp and you will get an error message that tells you where perl looked). - In a directory of your choice which you then tell perl about. One
way of doing this is with the -I switch on the first line of
your script. For instance:
#!/usr/bin/perl -I/home/me/perl_modules
If you send me your rvp scrips I'll add them into my regression tests, so I can make sure I don't break them when I change things. Also if you like, I can put them up here so other people can use them.
So far one person offered a script to be put here:
- Vince Parrilla:
Changes in 7.61
There are no important changes, just one small change I had to make to get v2html 7.30 to work with the newer rvp.
Changes in 7.60
Note: the function get_define behaviour has changed for command line defines. It used to return an empty list, but it now returns ("",0,value).
New features:
- You can now use proper object-oriented syntax (->) to access RVP - see any of the examples for how to do it (the old way of calling still should work). Also made 'use' version work.
- New read_chunk function makes it easy to extract comments or verilog code.
- get_module_signal now also returns an array of memory sizes
Fixed Bugs:
- it got cofused by statements like: mem[0][0] <= 1'b0;
- it wouldn't accept a signal def after and ansi_port_list in a task or function
- it couldn't handle a null ansi_port_list in t/f (although this isn't legal according to the BNF, I did it anyway)
- it was adding localparams to the parameter order when it shouldn't (localparams can't be assigned to during instantiation)
- made it handle semicolon-less statements before endtask/endfunction (just like it can before end/join)
- always (*) was triggering the start of a (* attribute.
- Fixed useless push warning that appeared in perl 5.8.1
- it was detecting input_foo as an input declaration (in port list) - also fixed some similar bugs.
Changes in 7.30
New features:
- Multiple defines are now handled correctly - get_define can now take a file and line as arguments.
- New experimental RVP functions get_current_instantiations_parameters and get_modules_parameters.
- Parses about 50% faster.
Support for language constructs I missed in 7.0:
- Signals local to a block are now ignored (instead of giving parse errors).
- Instance lists.
- Functions returning time/realtime.
- Continuation lines in defines.
- Hierarchical identifiers.
- ifdef and endif on same line.
- Single instance parameter without brackets - illegal but accepted by other tools (prints a warning).
- warn about registers that are also inputs.
- Parameters in tasks and functions.
- Signal drive strength and charge strength.
Bugs fixed:
- First character of signal driving a port got cut off.
- Command file ending in single line comment with no new-line.
- Delay values didn't accept decimals.
- Port con capturing was unreliable.
- // with no newline at end of file.
- Infinite loop with $ in define name.
- Relative file names in includes now are treated as relative to the included file, not the execution directory as they were in 7.0.
- Multiple Brackets in named ports bug.
- default in signal name in case statement bug.
- UDPs without names being skipped.
- Problems with signal popup in Mozilla 1.0 and Netscape 7.0.
- File names with spaces.
- Problems when a directory name matched a module name.
© 1999-2009 Costas Calamvokis