difference between --single_unit and other modes WRT pre-processor. #884
Replies: 5 comments 1 reply
-
There is already documentation on --single-unit here and here. Is there something additional I should add? Yes, macro definitions are part of a compilation unit. You can't parse a compilation unit without knowing the preprocessor definitions to apply to it. There is the --libraries-inherit-macros flag that I added upon request that is basically a hack to allow macros defined in the main compilation unit to be copied over to library units but there's no way to do this 100% reliably in the general case. |
Beta Was this translation helpful? Give feedback.
-
Thanks Mike Macro definitions are part of a compilation unit. If your code includes macros, and you do not use --single-unit, please ensure you have the macro definitions available for slang to recognize your code properly. or any variant of this, if it's ok with you but you get the idea. BTW: the vendors apparently seem to do something about this under the hood by leaving these pre-processor definitions in a seperate space somehow. The reason I say that is that slang errored out for me, whereas it didnt on a couple of the big vendors. Might be something specific to UVM library, i dont know. |
Beta Was this translation helpful? Give feedback.
-
thanks Mike. your comment about doing this under the hood emulating --single-unit may be on the mark. I didnt think of it that way. I'm still trying to get to the bottom of that nfs issue I reported earlier midst my other experiements |
Beta Was this translation helpful? Give feedback.
-
I added more docs in 8154635 |
Beta Was this translation helpful? Give feedback.
-
I think the vendors simply follow the same logic as You might also want to check #927 and #929 which also affects slang behavior compared with other vendors. |
Beta Was this translation helpful? Give feedback.
-
Mike:
This is a follow up question which is related to, but not the same as the work library question.
When loading the UVM or any other library which has macro definitions with --single-unit, essentially everything works.
you had mentioned that each syntax tree was it's own compilation unit.
I am trying to ascertain if that's true for Macro definitions also and whether they are tied to a compilation unit.
What I am observing is that if I dont use --single_unit, and there are multiple -f files, the
uvm_info macro definitions are essentially lost and I need to load the macro definitions again via a
include which means I got to edit all my source files.is there a way to retain all the macro definitions across multiple -f lists without --single-unit or a way to copy the definitions across the compilation units?
Also:
Can you possibly pen a couple of lines on the differnece in behaviour between --single_unit and not using --single_unit? i am sure this will be helpful to a lot of people.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions