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
can't determine constant for FUNCREF for function returning an enum #970
Comments
Original Redmine Comment I tried the simple thing:
And while I got enum item values to work with in the paramlink step, I also got:
Perhaps I can extract the enum value assignment from the width step and run that before paramlink? That's what I'll try next. |
Original Redmine Comment Constification causes calls to width as each individual item requires it. I suspect V3Const's AstEnumItemRef call is missing something, probably the enum item hasn't been made into a constant. Probably code line V3Const's AstFuncRef "if (m_param)" is needed in AstEnumItemRef. That is, when we see an EnumItemRef and there's no value yet, and we're parameter constifying, we need to iterate on the EnumItem to constify it. |
Original Redmine Comment Thanks for the pointers. It seems that once again, things are simpler than I assumed. However, I am a bit confused by what I'm currently seeing. I added an EnumItemRef visitor to V3Simulate with some debug just to see what's going on (pushed to GitHub). When I run the test while debugging V3Simulate, I get:
This seems strange to me because LOW_FIVE already seems to have the right enum item value (0xdeadbeef + 1), but I can't find this node in any of the tree dumps. Vt_static_elab_enum_007_link.tree shows :
In fact, no one has heard of this guy:
Where did LOW_FIVE's CONST node come from? And is it a problem that it doesn't show up in any of the tree dumps? Does it get created during paramlink? If so, why does paramlink say that there are no changes? Is this because the build fails? Sorry for all the questions, just trying to get my head around what is happening here. |
Original Redmine Comment Since the constant isn't part of the tree it was probably created by V3Simulate. It passes constants across itself to represent variable values related to the nodes it's simulating. |
Original Redmine Comment GitHub repo should be ready to go now. I combined the struct and enum parameter tests since I've seen a a few tests that roll up a few things like that. Please let me know if this isn't desirable and I'll break them apart. |
Original Redmine Comment Oh, that makes sense, simpler than I thought too. Fixed in git towards 3.877. |
Original Redmine Comment In 3.878. |
Author Name: Todd Strader (@toddstrader)
Original Redmine Issue: 970 from https://www.veripool.org
Original Date: 2015-09-29
Original Assignee: Todd Strader (@toddstrader)
I thought this would be more of the same from #�, but I don't think it is.
You can find the test (t_static_elab_enum) here:
https://github.com/toddstrader/verilator-enum-func
When returning an enum from a constant function, I get:
And sure enough, there is no ENUMITEMREF. However, I believe the deeper problem is that at the point which we're running the simulator, enum items don't appear to have values yet.
I believe this problem would be pretty trivial if the enum items had values at this stage. I haven't dug into this yet, but does anyone know if there is a reason enum items don't have values at 009_paramlink (it seems to happen at 011_width)? Also, does anyone know how is there is a major issue with moving this step earlier?
I'm still looking. I'll see what I can do.
The text was updated successfully, but these errors were encountered: