You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is accepted by nvc and runs, I believe this should be compile error, otherwise I'm not sure what the return value would be expected to be.
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
package pack is
function matching_cases (
opcode: std_logic_vector
) return natural;
end package;
package body pack is
function matching_cases (
opcode: std_logic_vector
) return natural is
variable bytes : natural := 0;
begin
case? opcode is
when "00000000" =>
bytes := 1;
when "00000001" =>
bytes := 1;
when "010000--" =>
bytes := 1;
when "010000--" => -- SAME CONDITION AS ABOVE ARM!!!
bytes := 2; -
when others =>
bytes := 4;
end case?;
return bytes;
end;
end package body;
The text was updated successfully, but these errors were encountered:
Bounds checks were missing for case? statements. Now it reports:
** Error: duplicate choice in case statement
> ../test/bounds/issue966.vhd:27
|
25 | when "010000--" =>
| ^^^^^^^^^^ previous choice for this value
26 | bytes := 1;
27 | when "010000--" => -- SAME CONDITION AS ABOVE ARM!!!
| ^^^^^^^^^^ repeated here
|
= Note: each value of the subtype of the expression must be represented once and only
once in the set of choices
= Help: IEEE Std 1076-2008 section 10.9 "Case statement"
This is accepted by nvc and runs, I believe this should be compile error, otherwise I'm not sure what the return value would be expected to be.
The text was updated successfully, but these errors were encountered: