Why is this an issue?

case statement with too many cases may produce design with poor performance and/or hard to understand. Design should be rethought to split large case statements.

How to fix it

Code examples

Noncompliant code example

With maxNumberOfCases parameter set to 4:

architecture a of e is
begin
  process (data_in)
  begin
    case data_in is
      when s1 | s2 | s3 | s4 =>
        data_out <= "000";
      when s5 => -- Noncompliant: 5 cases (s1, s2, s3, s4 and s5)
        data_out <= "010";
    end case;
  end process;
end architecture;

Compliant solution

With maxNumberOfCases parameter set to 4:

architecture a of e is
begin
  process (data_in)
  begin
    case data_in is
      when s1 | s2 | s3 =>
        data_out <= "000";
      when s4 =>
        data_out <= "010";
    end case;
  end process;
end architecture;

Resources

Related rules