veripool / verilog-perl

Verilog parser, preprocessor, and related tools for the Verilog-Perl package
https://www.veripool.org/verilog-perl
Artistic License 2.0
121 stars 34 forks source link

Comments not retained properly for last input/output declaration #917

Closed veripoolbot closed 9 years ago

veripoolbot commented 9 years ago

Author Name: Raj G Original Redmine Issue: 917 from https://www.veripool.org Original Date: 2015-05-08


Consider the following example

module top( input wire a, // First output wire b // Second ); // Third endmodule

When I try to display the comments of each port/net, then it displays incorrectly. Attached is the script that I used

The output of this script is as shown below a Comment = // First b Comment = // Third

As you can see, the comment is displayed as // Third, instead of // Second. I'm using version 3.412

veripoolbot commented 9 years ago

Original Redmine Comment Author Name: Raj G Original Date: 2015-05-08T08:58:06Z


Attaching the verilog file as well

veripoolbot commented 9 years ago

Original Redmine Comment Author Name: Wilson Snyder (@wsnyder) Original Date: 2015-05-09T15:45:01Z


I agree this is wrong, but unfortunately I don't see a straightforward way to fix it given the internal design. The problem is without a terminating , or ), the parser cannot know that a variable declaration has occurred, and until that happens it likewise can't attach a comment. Ideally comments could be ordered with the parser, but that would need a fundamental redesign.

If you know each comment is one line, you could use the filename and lineno attribute of each signal to read the specified filename and grab comments from that lineno, or make a custom comment callback to collect all the comments.

Sorry. Leaving it open in case some solution comes to me.

veripoolbot commented 9 years ago

Original Redmine Comment Author Name: Wilson Snyder (@wsnyder) Original Date: 2015-06-25T13:56:30Z


Figured out how to work around this for the common cases.

Fixed in git towards 3.413.

veripoolbot commented 9 years ago

Original Redmine Comment Author Name: Wilson Snyder (@wsnyder) Original Date: 2015-06-26T10:31:11Z


In 3.414.