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

Obtaining module handle based on the full name of the instance #1080

Open
mysoreanoop opened this issue Jun 28, 2024 · 1 comment
Open

Obtaining module handle based on the full name of the instance #1080

mysoreanoop opened this issue Jun 28, 2024 · 1 comment

Comments

@mysoreanoop
Copy link
Contributor

For a separate/temporary need, is there a way to obtain a submodule instance's vpiHandle based on the full name of the submodule instance?

I have parsed the submodules and have stored their full names in a list.
At some point later, I need to recurse into the submodule (conditionally).

I tried saving vpiHandle in the list instead, but it does not seem to link back to the same node when used later (perhaps because I release the handles in the middle, I don't know).

I know the alternative is to recurse into every submodule and match the full names, but that feels inefficient.

@Thomasb81
Copy link
Contributor

I tried saving vpiHandle in the list instead, but it does not seem to link back to the same node when used later (perhaps >because I release the handles in the middle, I don't know).

It is forbidden to continue to use an handle after having free. See handle like a pointer which is return by malloc function in C. Once you free the pointer and the associate memory space, the space is return to the system and could be recycle for another malloc call in your application.

If keeping track of handle to free them only when you do not need them anymore is too complicate to do it yourself, you need to consider smartptr. Or you can use the python UHDM api : python will do that for you when no more reference on the handle exist in user application, the python runtime will free it.

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

2 participants