i am using this particular program to find the which modules are referenced and which are defined
#!/usr/bin/perl use Verilog::Netlist; # set up options so that files can be found use Verilog::Getopt; #push(@INC,'pwd'); my $opt=new Verilog::Getopt; $opt->parameter("-y","i2c",); # prepare netlist #$file='home/vp/roopa/i2c/i2c_master_byte_ctrl.v'; my $nl=new Verilog::Netlist(options=>$opt); foreach my $file('/home/vp/roopa/i2c/i2c_master_top.v') { $nl->read_file(filename=>$file); } #read in any sub modules $nl->link(); $nl->lint(); $nl->exit_if_error(); foreach my $mod($nl->top_modules_sorted) { show_hier($mod, " ","",""); } sub show_hier { my $mod=shift; my $indent=shift; my $hier =shift; my $cellname=shift; if(!$cellname) { $hier=$mod->name; #print "\n",$hier; } else { $hier.=".$cellname"; } printf("%45s %s\n",$indent."Module ".$mod->name,$hier); foreach my$cell($mod->cells_sorted) { printf($indent." Cell %s\n", $cell->name); show_hier($cell->submod,$indent." ", hier,$cell->name) if $cell->submo +d; } }
Apologize if it is difficult to read becoz of the indentation.copy paste in windows from vi!
OUTPUT Module i2c_master_top i2c_master_top Cell byte_controller Module i2c_master_byte_ctrl i2c_master_top.byte_cont +roller Cell bit_controller Module i2c_master_bit_ctrl i2c_master_top.byte_cont +roller.bit_controller Cell myarbiter Module arbiter i2c_master_top.myarbiter Cell mypli1 Module mypli i2c_master_top.mypli1 Module mymux mymux
The script identifies all the modules defined and referenced. The O/p is interpreted as folllows i2c_master_top.v has the following referenced modules-(the ones given as cells)hierarchy given by top_module.cellname
i2c_master_byte_ctrl i2c_master_bit_ctrl myarbiter mypli
The problem lies with the module mymux The module mymux is defined in i2c_master_byte_ctrl.v But it shows up as a module in i2c_master_top whereas it is defined only in the child module Only if I remove the mymux module from i2c_master_byte_ctrl,then it does not show I first thought that just comparing the outputs from each file would give me the modules which have been duplicated. But mymux is not duplicated and still it shows up in the outputs of i2c_master_top and i2c_master_byte_ctrl. Could you please help me with this? Thanks for your time

In reply to Re^2: verilog-perl vhier usage by perlvoyager
in thread verilog-perl vhier usage by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.