Issue #89
Macro expansion question
| Status: | Closed | Start date: | 05/14/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | Wilson Snyder | % Done: | 0% |
|
| Category: | - | |||
| Target version: | - |
Description
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
History
Updated by Wilson Snyder about 3 years ago
I intentionally didn't add the newlines because it was messing up the line number count of downstream tools (that use `line).
What breaks?
Updated by David A about 3 years ago
Verilog-Perl isn't breaking... other scripts of my own were breaking, I think I have it under control now though.
Thanks, David
Updated by David A about 3 years ago
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
Updated by Wilson Snyder about 3 years ago
All of the Verilog::Parser callbacks should also be called when using Verilog::SigParser. So, try adding an "sub operator" callback that detects the ";".
Updated by Wilson Snyder almost 3 years ago
- Status changed from New to AskedReporter
- Assignee set to Wilson Snyder
All set?
Updated by David A almost 3 years ago
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
Updated by Wilson Snyder over 2 years ago
- Status changed from AskedReporter to Closed
Settled months ago.
Also available in: Atom
![[logo]](/img/veripool_small.png)