-
Notifications
You must be signed in to change notification settings - Fork 68
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
VHDL: Slicing and range attributes incorrectly identified as function calls. #140
Comments
Hello, I see two problems related to this issue:
|
Hi Nic, you're correct. The two cases show one problem, different places and conditions though.
|
That said, if it proves too hard to fix, then maybe we can just accept it the way it us and handle it ourselves outside hdlConvertor. |
Correct me if I am wrong but I think that the cases where we can not resolve if this () operator is index or call are only the cases where the operator could be the call. That means we can just use index operator everywhere by default. (instead of call operator) |
If you mean by scope then yes. Type declarations, Signal type definitions, assignment destinations all must have INDEX, not CALL. Only values of signal definitions, right hand sides of assignments can have it as CALL (or INDEX still, hard to distinguish) |
I run tests of all our tools based on hdlConvertor and all seems to be pasign because the check already had to be performed. I hope that everyone else does have this check as well, because this could be ultimate breaking change. |
Thanks Nic, I can confirm this works. The way I see it, there can still be CALLs instead of APOSTROPHEs sometimes, you just decreased the probability of this happening but didn't completely remove it (as you said, no one can until we look into it). So whoever doesn't have checks for this ran the risk of having bugs anyway. |
Hi Nic, I think you mistakenly included values of signal declarations into this. For example: CONSTANT SHIFT_AMOUNT_SIZE : NATURAL := LOG2(DOUBLEWORD_SIZE) gets converted to INDEX rather than CALL. This may actually be breaking to existing users. Signal type declaration should always be INDEX. While signal value declarations can be CALL or INDEX. although I think they should default to CALL for compatibility with existing user base. |
I think if this proves too hard to fix, then undoing your changes maybe the best option. |
Hello, for CONSTANT SHIFT_AMOUNT_SIZE : NATURAL := LOG2(DOUBLEWORD_SIZE) the However there could be a relatively simple transformation which resolves this, but the problem is that we need perform imports, which may require elaboration.
Can you provide an example? |
Hi Nic, you are correct. I just meant that this is different from what you had before. Before, there was ONLY the possibility of having INDEX incorrectly identified as CALL. The fix I suggested above should've decreased the probability of such thing happening by handling specific cases (destinations of assignments, type of signal declaration). But as you said, we could never get rid of it completely. That's also not breaking to users, because they should've already been handling this case. What we should have is the following:
That should be non breaking to users, and would also get rid of the problem for some of the cases. |
Hi Nic, any updates about this? |
Hello, If the CALL is a default and INDEX is only in cases you you mentioned, we need to always translate the expression or we need to pass some flag deep in to parsing functions. I have looked at several libraries which are using this library and everywhere was check in the format "== CALL or == INDEX", because it was mixed before. So I expect that this will not have any ridiculous implications. Because the check for this is probably already in correct format. (But of course, this is just my speculation. And I am more or less just waiting if some user complains in this issue.) |
Hi Nic,
CASE1:
This example is part of the standard library
numeric_bit-body.vhdl
, specifically from lines 2774 to 2781.the json output for the variable definition is:
you can see that the variable definition gets incorrectly identified as a function call. The function name in this case is the datatype which is
BIT_VECTOR
while the operand is the range which isvalue'range
.The correct output should be a
fn: INDEX
with the datatype as operand 0 and theAPOSTROPHE
as operand 1.CASE2:
The same issue happens in the left hand side of some assignments. This is an example from file
numeric_bit-body.vhdl
from lines 160 to 164:The left hand side of the assignment is mistakenly identified as a function call rather than INDEX. As follows:
Thanks Nic.
The text was updated successfully, but these errors were encountered: