Hi

RTL module

module top; buff b0 (); endmodule module buff (buf_in, buf_out); input buf_in; inout out; `ifdef SYNTHESIS wire a; `endif inv i0 (.in(buf_in), .out(a )); inv i1 (.in(a ), .out(buf_out)); endmodule module inv (in, out); input in; output out; assign out = ~in; endmodule

Sample Perl code

#!/usr/bin/env perl use Verilog::Netlist; # Setup options so files can be found use Verilog::Getopt; my $opt = new Verilog::Getopt; $opt->parameter( "+incdir+verilog", "-y","verilog", ); # Prepare netlist my $nl = new Verilog::Netlist (options => $opt,); foreach my $file ('top.v') { $nl->read_file (filename=>$file); } # Read in any sub-modules $nl->link(); #$nl->lint(); # Optional, see docs; probably not wanted $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;} #top modules get the des +ign name else {$hier .= ".$cellname";} #append the cellname printf ("%-45s %s\n", $indent."Module ".$mod->name,$hier); foreach my $sig ($mod->ports_sorted) { printf ($indent." %sput %s\n", $sig->direction, $sig-> +name); } foreach my $cell ($mod->cells_sorted) { printf ($indent. " Cell %s\n", $cell->name); foreach my $pin ($cell->pins_sorted) { printf ($indent." .%s(%s)\n", $pin->name, $pin->ne +tname); } show_hier ($cell->submod, $indent." ", $hier, $cell->name +) if $cell->submod; } }
I am unable to get where the `ifdef is defined.

In reply to Re^2: how to preserve `defines in verilog -perl by justrajdeep
in thread how to preserve `defines in verilog -perl by justrajdeep

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.