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

vppreproc corner-case comment issue #311

Closed
veripoolbot opened this issue Jan 6, 2011 · 4 comments
Closed

vppreproc corner-case comment issue #311

veripoolbot opened this issue Jan 6, 2011 · 4 comments
Assignees

Comments

@veripoolbot
Copy link
Collaborator


Author Name: Gene Sullivan
Original Redmine Issue: 311 from https://www.veripool.org
Original Date: 2011-01-06
Original Assignee: Wilson Snyder (@wsnyder)


Consider the following Verilog code in a file I named "tb.v":

module tb;
     reg/* nasty comment */foo;
endmodule

There is a block comment between a keyword and an identifier, with
no whitespace surrounding the block comment.

Using vppreproc to remove the comments produces output which is not legal
Verilog syntax.

vppreproc --nocomment --noline tb.v

module tb;
     regfoo;
endmodule

The deleted block comment effectively concatenates the keyword and the identifier,
leaving illegal Verilog code. I used the --noline option to simplify the
output; the issue remains if --noline is not used.

The Verilog LRM (1800-2009) is not specific enough to describe what should
be done in the case. However, the two simulators I used (VCS and NC-Verilog)
compiled the code with the nasty comment cleanly. I also used the NC decompile
utlilty (ncdc), which shows that it replaced the block comment with a single space.
Running ncverilog/ncdc produces:

module tb;
     reg foo;
endmodule

For what it's worth, gcc also replaces the comment with a space:

gcc -x c -E tb.v

Ideally, I guess vppreproc should replace the block comment with a single
space in this case.

Since I didn't have much luck digging through the source code to try a track down
where comments are removed, I can not provide a patch.


I am using recent (2010) versions of VCS (Synopsys) and NC-Verilog (Cadence).
I am using the latest version of vppreproc (3.305).

$ perl -v

This is perl, v5.8.9 built for x86_64-linux

Copyright 1987-2008, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

$ vppreproc --version
Version 3.305

$ ncverilog -version
TOOL:   ncverilog       10.20-p008

$ vcs tb.v | head -5
                          Chronologic VCS (TM)
             Version D-2010.06 -- Thu Jan  6 11:55:32 2011
                Copyright (c) 1991-2010 by Synopsys Inc.
                          ALL RIGHTS RESERVED


@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2011-01-06T19:53:17Z


Thanks for the report, I think you're right it should become a space. I'm always amazed how the preprocessor which is given so few pages in the spec, causes so many issues.

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2011-01-06T20:48:13Z


Fixed in git for 3.306.

Give it a try; it adds spaces at every removed comment, block or line, though only block should be strictly required.

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Gene Sullivan
Original Date: 2011-01-14T19:32:11Z


I have not been able to give it a try.
I retrieved the files from git, but when I try to
install, the make dies with the bison error, although
I have bison version 1.875c installed.

If it works on my small contrived module,
that should be good enough.

Next time, I'll try to remember to create (or patch) a test
for you.

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2011-03-07T14:00:45Z


In 3.306.

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

No branches or pull requests

2 participants