How do I get the module type from SymbolKind.UninstantiatedDef node? #1442
Replies: 4 comments 4 replies
-
|
It sounds like you want the |
Beta Was this translation helpful? Give feedback.
-
|
First off, thanks for the quick reply! I didn't know definitionName was what I wanted, but yes that is what I need. That simple comment helped me figure it out. Here's how I did it in case anyone else stumbles like I did: One thing I have noticed as I worked on this, is that the root of a Tree is different than the root of a Compilation. Thinking about that a bit more, it makes intuitive sense but I'd like to understand it more. For example I don't understand why I can only find the UninstantiatedDef in the Compilation, but it doesn't appear in the Tree. Can you point me to where the difference is clearly explained in the documentation? |
Beta Was this translation helpful? Give feedback.
-
|
I see. I really appreciate you taking the time to help me out. I just want to talk about one more thing - you've really helped me this morning. When I look at the SyntaxTree of code like this: I don't see any nodes that hint at the INCLUDE_CHILD_B define (maybe I'm doing something wrong here). And when I look at the Compilation, I don't see child_b - which makes sense, since it didn't see INCLUDE_CHILD_B so it wasn't included in the design. My questions:
|
Beta Was this translation helpful? Give feedback.
-
|
Ok, I think I answered my previous two questions. Q: How do you discover INCLUDE_CHILD_B?A: Look in the trivia. This script can do it: Q: How do you pass INCLUDE_CHILD_B to the preprocessor?A: Use a bag to collect preprocessor options and pass it to the Compilation object. Example: Now, even though these examples work - are they the recommended/best practice ways to do it? Just looking for some validation here - I used Codex to arrive at these examples so it's very possible I missed a better way. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am trying to understand pyslang. I started by editing one of the example scripts.
Here is the relevant portion of my script:
When I run this on a toy verilog file, I get this printed to screen:
Here's the toy code:
I am struggling to figure out how to extract "child_a/b/c" as the module types of their respective instances. Is there a different data structure I need to look through? I thought that by doing root.visit() I'd be looking at every single node on the tree, but It seems like only lands on the leaves.
Beta Was this translation helpful? Give feedback.
All reactions