Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser bug in processing compiler directives in comments #524

Closed
veripoolbot opened this issue Jun 14, 2012 · 3 comments
Closed

Parser bug in processing compiler directives in comments #524

veripoolbot opened this issue Jun 14, 2012 · 3 comments

Comments

@veripoolbot
Copy link
Collaborator

@veripoolbot veripoolbot commented Jun 14, 2012


Author Name: Ramana Mokkapati
Original Redmine Issue: 524 from https://www.veripool.org
Original Date: 2012-06-14


Parser bug in processing compiler directive in comments.
The comment should have been ignored, but it is not.

See belowe more for detail and how to reproduce (in attachment)

Script to parse Verilog and output a new Verilog with all cells prefixed with "try_"

usage: test.pl bug.v output.v

Note output.v has "bbb" unprefixed becuase of the compiler directive inside the preceding comment line is not treated correctly.
If compile directive is broken (say) by inserting an extra space between ` and ifdef, the cell "bbb" is prefixed correctly.
Summary: Comments are not handled correctly by the parser.

[snip]
module top();
aaa();

ifdef FIRST assign i1 = 1'b1 ; else
assign i2 = 1'b1 ;
endif // ifdef XYZ

     bbb();
     ccc();

endmodule

module aaa();
endmodule

module bbb();
endmodule

module ccc();
endmodule

[/snip]

@veripoolbot

This comment has been minimized.

Copy link
Collaborator Author

@veripoolbot veripoolbot commented Jun 14, 2012


Original Redmine Comment
Author Name: Ramana Mokkapati
Original Date: 2012-06-14T00:55:46Z


Issue was verified with parser 3.315 (the latest one).

@veripoolbot

This comment has been minimized.

Copy link
Collaborator Author

@veripoolbot veripoolbot commented Jun 14, 2012


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2012-06-14T01:12:24Z


It looks like your code is the one doing the searching for `ifndef, etc, as you're writing a raw parser that doesn't use Verilog::Preproc. If I turn on your verbose code I get

comment = // `ifdef XYZ

which is correct parsing by Verilog-Perl.

Perhaps I'm confused, if so please make very explicit as to what Verilog-Perl itself, not your script, is returning that you believe is incorrect.

@veripoolbot

This comment has been minimized.

Copy link
Collaborator Author

@veripoolbot veripoolbot commented Jun 14, 2012


Original Redmine Comment
Author Name: Ramana Mokkapati
Original Date: 2012-06-14T01:57:20Z


Wilson,

Thanks for your quick attention and comments.
Yes, the derived class has the bug and I fixed it.

This ticket can be closed.

Regards,
Ramana

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.