Why is this an issue?

Nested conditional branching statements:

are difficult to understand because you can easily confuse the conditions of an inner construct as belonging to an outer statement. Therefore too deeply nested conditional branching statements should be avoided.

You should structure your code to avoid the need for nested conditional branching statements. But, if you cannot, consider moving the inner conditional branching statements to dedicated functions.

Also, nesting too many branching statements could lead to issues with timing closure.

How to fix it

Code examples

Noncompliant code example

With the default value of maximum number of authorized nested levels: 1
if a = 5 then
  z <= a;
  if b = 6 then
    y <= b;
    if c = 7 then -- Noncompliant: Two nesting levels
      x <= c;
    end if;
  else
    y <= 0;
  end if;
end if;

With a custom value of maximum number of authorized nested levels: 0 (no nesting allowed)

if a = 5 then
  z <= a;
  if b = 6 then -- Noncompliant: Nested "if" statement
    y <= b;
  else
    y <= 0;
  end if;
end if;

With a custom value of maximum number of authorized nested levels: 0 (no nesting allowed)

if a = 5 then
  z <= a;
  case b is  -- Noncompliant: "case" statement nested in "if" statement
    when '0' => y <= b;
    when '1' => y <= 0;
    when others => y <= 0;
  end case;
end if;

Compliant solution

With the default value of maximum number of authorized nested levels: 1
if a = 5 then
  z <= a;
  if b = 6 then
    y <= b;
  else
    y <= 0;
  end if;
end if;