in reply to verilog perl usage
To get help on vhier:
$ vhier --help
To show all the Verilog modules in a file:
$ cat top.v module top; dff i0 (); endmodule module dff; endmodule $ $ vhier top.v --modules dff top
Adapting the EXAMPLE code from Verilog::Parser:
use warnings; use strict; package MyParser; use Verilog::Parser; our @ISA = qw(Verilog::Parser); # parse, parse_file, etc are inherited from Verilog::Parser sub new { my $class = shift; #print "Class $class\n"; my $self = $class->SUPER::new(); bless $self, $class; return $self; } sub symbol { my $self = shift; my $token = shift; $self->{symbols}{$token}++; } sub report { my $self = shift; foreach my $sym (sort keys %{$self->{symbols}}) { printf "Symbol %-30s occurs %4d times\n", $sym, $self->{symbol +s}{$sym}; } } package main; my $text = <<"EOF"; module m; reg ina, inb; endmodule EOF my $parser = MyParser->new(); $parser->parse($text); $parser->eof(); $parser->report(); __END__ Output: Symbol ina occurs 1 times Symbol inb occurs 1 times Symbol m occurs 1 times
See also: http://www.veripool.org/wiki/verilog-perl
What are you trying to do?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: verilog perl usage
by perlvoyager (Initiate) on Feb 26, 2009 at 00:19 UTC | |
by toolic (Bishop) on Feb 26, 2009 at 01:23 UTC | |
by Anonymous Monk on Mar 03, 2009 at 19:35 UTC | |
|
Re^2: verilog perl usage
by mahurshi (Initiate) on Mar 14, 2009 at 05:43 UTC | |
by toolic (Bishop) on Mar 15, 2009 at 01:31 UTC | |
by mahurshi (Initiate) on Mar 15, 2009 at 06:14 UTC | |
by toolic (Bishop) on Mar 15, 2009 at 14:13 UTC | |
by Anonymous Monk on Mar 15, 2009 at 18:53 UTC | |
by perl vams (Initiate) on Apr 13, 2016 at 09:22 UTC |