Why is this an issue?

This rule allows to check if there is an else statement in each if statement, in combinational processes to avoid undesired latch inference.

How to fix it

Code examples

Noncompliant code example

process is
begin
  if cond = '1' then
    q <= '0';
  end if;
end process;

Compliant solution

process is
begin
  if cond = '1' then
    q <= '0';
  else
    q <= '1';
  end if;
end process;

Note

The below process is not a combinational process but a clocked process. Thus, the rule does not apply and no issue is raised against the "missing" else statement.

process is
begin
  if rising_edge(clk) then
    if cond = '1' then -- Compliant because it is within a clocked process
      q <= '0';
    end if;
  end if;
end process;

Known false positives

For now, the rule does not check if all signals have been initialized prior to the "if" statement. It raises an issue even if the else statement is not necessary as in the below example.

process is
begin
  q <= '1';
  if cond = '1' then
    q <= '0';
  end if;
end process;

Resources

Articles & blog posts