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 stumbles on certain 'protect' code #348

Closed
veripoolbot opened this issue May 11, 2011 · 2 comments
Closed

vppreproc stumbles on certain 'protect' code #348

veripoolbot opened this issue May 11, 2011 · 2 comments

Comments

@veripoolbot
Copy link
Collaborator


Author Name: David Richter
Original Redmine Issue: 348 from https://www.veripool.org
Original Date: 2011-05-11


I have code from a vendor which uses protected envelopes legally yet poorly, and vppreproc stumbles on this code. I think vppreproc could be tweaked to yield workable, albeit only incompletely processed, code.

The vendor's code in question apparently contains ifdef directives in protected regions with the matching endif in a different protected region, or even in an unprotected region. There is one include directive in unprotected code for a file (and directory) which is simply not in our distribution. Since this compiles in the simulator, we can infer the existence of an ifdef/endif pair in the protected envelopes which come before and after the include.

There is another file in this same vendor's code which contains a endif in unprotected code; the matching ifdef is nowhere to be seen in unprotected code and must be within a protected envelope.

The practice of overlapping `ifdef regions and protection envelopes is probably indefensible, but it's there and it appears to be legal. I found a quote from section 34.3.2 (Decryption) from the 1800-2009-D8 spec which seems to permit this dodgy construction:

The substituted text may contain usages of text macros, which shall be substituted after replacement of the decryption envelope[...]

Since vppreproc will never be able to decode the protected blocks, our only hope to handle this code is to do something ugly. I suggest a list of "don't try" files which would be passed through verbatim, without attempting to preprocess them. The set of files could be specified individually or by regexp, and the tool could also have a mode which adds a file to the "don't try" list when it sees that the file contains any `protect directive (or a protect pragma).

With something like this, I would be able to preprocess the entire testbench and see the 99% of the code which interests me. Sure, there would still be a few include and endif occurring in the output of vppreproc, but the result would still be valid for my simulator. I could debug those goldarn UVM macros and still be able to compile the result.

Admittedly this is not a complete fix because `ifdef regions could still overlap file boundaries. But this would be far better than nothing.

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2011-05-12T10:17:02Z


I wonder if the dangling endif was really the vendor's intent? Seems more likely they just didn't realize where their protection region was; maybe they can fix it.

Anyhow, I don't have a personal need for this feature, but if you'd like to provide patches to support the list of files to not process I'll take it.

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2011-10-18T13:16:50Z


Closing due to age.

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

1 participant