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

Macro expansion question #89

Closed
veripoolbot opened this issue May 14, 2009 · 7 comments
Closed

Macro expansion question #89

veripoolbot opened this issue May 14, 2009 · 7 comments
Assignees

Comments

@veripoolbot
Copy link
Collaborator


Author Name: David A
Original Redmine Issue: 89 from https://www.veripool.org
Original Date: 2009-05-14
Original Assignee: Wilson Snyder (@wsnyder)


Hi!

On IEEE Std 1364-2005, section 19.3.1 page 350 here is what it says about multiline macro expansion:
"The newline preceded by a backslash shall be replaced in the expanded macro with a newline (but without the preceding backslash character)."

If Im not mistaken it seems that Verilog::Preproc expands multiline macros in a single line. If this is true, could it be modified?

Thanks,
David

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2009-05-14T21:17:11Z


I intentionally didn't add the newlines because it was messing up the line number count of downstream tools (that use `line).

What breaks?

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: David A
Original Date: 2009-05-14T22:10:12Z


Verilog-Perl isn't breaking... other scripts of my own were breaking, I think I have it under control now though.

Thanks,
David

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: David A
Original Date: 2009-05-18T22:36:24Z


Hi Wilson,

Here is the issue I'm having: some (old) tools I'm using don't support constant functions in a localparam declaration. My RTL has that. So basically I'm using the parser to construct a hash of all localparams declared and the values (RHS of the declaration expression), and later on I'm doing inline expansion of these localparams.

Currently the parser doesn't have any callback for expression termination (when a semi-colon is found). So on the RTL I was looking for linefeeds/newlines to determine when the expression ended. This works fine given the coding conventions in our RTL of only 1 expression per line.

When I try to do the same thing with macros (macros with RTL code as the macro text) it doesn't work because the preprocessor eliminates all the newlines and I still don't have any callbacks for the expression termination.

Could you provide this callback (expression termination / semi-colon callaback) or leave an option to expand macros in multiple lines? or is there any other way you can suggest I could use to solve this problem? this would be greately appreciated.

Thanks,
David

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2009-05-18T22:44:10Z


All of the Verilog::Parser callbacks should also be called when using Verilog::SigParser.
So, try adding an "sub operator" callback that detects the ";".

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2009-05-28T00:26:23Z


All set?

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: David A
Original Date: 2009-05-28T03:23:34Z


Yes thanks.

BTW, would it be possible for the Preproc to leave newlines when the `line are suppressed (line_directives=>0)?

Thanks in advance,
David

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2009-11-10T00:38:56Z


Settled months ago.

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