Replies: 2 comments
-
|
I think there are cases where symbols are flagged "compiler generated". Those might not have a distinct index. |
Beta Was this translation helpful? Give feedback.
-
|
It is mostly true but not 100% guaranteed. There are cases like, for example, enum members getting pulled into the parent scope where they all end up with the same index, or for implicit nets found in assign directives. It should be true for all cases where you'd want to know when performing a lookup whether a given symbol is before it, for purposes of use-before-declared errors. I guess it depends on what you're trying to do exactly? The approach I use in slang for things like this is to use the Symbol pointer in most places for performance, like keying into a hash table. Then if something becomes user visible I sort the results based on something deterministic like name or SourceLocation or whatever. There should be far fewer cases where the order matters and so the extra sort step isn't material. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I need to establish ordering over symbols in yosys-slang data structures, I'm wondering if
Symbol::getIndex()plus scope consideration can be used for this. Previously I have been comparing pointers which leads to non-determinism.Beta Was this translation helpful? Give feedback.
All reactions