samb31 has asked for the wisdom of the Perl Monks concerning the following question:

I tried Verilog-Perl module but I am facing an issue
to get comment "My comment" after the port definition:
input in; //My comments
It seems that $pt->comment() return undef where $pt is a Verilog::Netlist::Port.
I am using Verilog-Perl-3.312
Thanks

Replies are listed 'Best First'.
Re: Verilog-Perl get verilog comment
by toolic (Bishop) on Oct 29, 2011 at 17:02 UTC
    I got it to work (on version 3.306, which is older than yours). First, you need to use "keep_comments=>1" in the constructor, as the Verilog::Netlist::Port POD states. Then, it seems like you also need to use the "net" method in conjunction with "comment", although I didn't find this documented. I used the "grep" CPAN feature to hunt that down:
    my $nl = new Verilog::Netlist(keep_comments=>1); ... $pt->net->comment();
    Data::Dumper is also handy to see if your comment was correctly parsed.

    Update: 3 nov 2011: Related (same?) issue: http://www.veripool.org/issues/409-Verilog-Perl-Print-verilog-comment

      It works with net!
      In the doc of Verilog::Netlist::Port there is a description
      of the accessor "comment":
      $self->comment
      Returns any comments following the definition.
      keep_comments=>1 must be passed to Verilog::Netlist::new for comments to be retained
      Thanks again toolic!