You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
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 oneinclude 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:
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.
The text was updated successfully, but these errors were encountered: