-
Notifications
You must be signed in to change notification settings - Fork 585
-
Notifications
You must be signed in to change notification settings - Fork 585
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
Parameter enum const functions fail #3999
Comments
This seems to fail in the second call to V3LinkDot, after initial elaboration. At that point the if signed test is not need, so try adding an additional test "if (nodep->getChildDTypep() && ...)". If that works (or if you find another fix) please submit a pull request with the fix and a test case, thanks for debugging. |
I think I've identified the problem better (i've modified the example program). It seems that when the function result is assigned to a parameter or localparam, it will duplicate the enum_next variable in the AST as such:
The
The next thing I think I should do is stop the ast from duplicating this variable and then make sure that the function that tried to use it pulls |
I tried analyzing the AST tree that comes out from when I add "if (nodep->getChildDTypep() && ...)" and what happens is that the duplicated VAR 0x5555579b0480 is removed from the tree but is still referenced by: Update: |
It shouldn't have gotten duplicated, especially not with an identical name, so that's one problem. I think the enum being referred to needs to be in the dtype table once it is referred to, so if that type goes away the function can still refer to it. Alternatively we'd somehow track which of these variables gets deleted if a enum data type gets deleted, but that seems a lot of new work to do. |
Full fix including this merged manually. |
I'm trying to write a const function to export the list of enum values as a string written to a parameter but I encountered a segmentaion fault when trying to compile. I think I've isolated that the issue has something to do with using the enum next function with data flow into parameter variables.
From gdb, I've found that the issue at this line
nodep->getChildDTypep()->numeric().isSigned()
at V3LinkDot.cpp:1256getChildDType()
is null andnodep->m_name = "__Venumtab_enum_next0"
. I'm stuck understanding what the LinkDot visitor is trying to do and how it affects the enum next function.The text was updated successfully, but these errors were encountered: