-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
Case expression with for loop variable #902
Comments
I'm pretty sure this error is correct. The subtype is not static (as the RiveraPRO message says), so the choices need to cover the full range since the value of Questa reports basically the same error for this code:
Because process
variable higher_bound : integer := 3;
begin
for i in 1 to higher_bound loop
case i is
when 1 => report "'i' is 1";
when 2 => report "'i' is 2";
when 3 => report "'i' is 3";
end case;
end loop;
higher_bound := higher_bound + 1;
wait;
end process; GHDL doesn't error on this either which is definitely wrong. If you make |
OK, I see. Thanks for explanation. Do you think it would be good to accept the behavior with |
|
I ran across an interesting issue. NVC does not seem to determine the range of iteration variable
i
correctly.Consider following example:
i
can only get values from 1 to 3. However, NVC expects full integer range:If I replace the
higher_bound
with literal constant3
, then no error occurs.I guess NVC determines range at compile time in such case.
Obviously, adding
others
choice solves the issue, but I am not sure it should be needed.In GHDL this "works" without complaining. If I bump-up the value of
higher_bound
to 4without adding corresponding case choice, GHDL accepts it too, and over-flows and when
i=4
, it prints the report fori=1
(which seems to me a GHDL bug).The code works OK also in VCS. In Riviera PRO, I get:
If I recompile with
-relax
Riviera PRO takes the code. If I bump-up thehigher_bound
value to 4without adding corresponding
case
alternative, it takes the code too, but does not print anythingin the iteration when
i=4
.I am not sure what does the LRM says on this topic, so this issue might be rubbish, but I would
guess it is valid since GHDL, VCS and Riviera accept the code.
The text was updated successfully, but these errors were encountered: