意図しないラッチのinferenceを防ぐ / if文

p.508

infer /ɪnfɚ́ː|-fə́ː/
inference /ɪ́nf(ə)rəns/
コンパイラーがコードから回路を導き出すこと。ここでは「生成」「合成」「挿入」「出来上がる」「作られる」と置き換えてもほぼ同じ。

library ieee;
use ieee.std_logic_1164.all;

entity latch_inference_test is
    port (
        d: in std_logic;
        cond: in boolean;
        q1: out std_logic;
        q2: out std_logic;
        q3: out std_logic
    );
end entity;

architecture rtl of latch_inference_test is
begin

   -- condがfalseのときの処理がなくアサインが不完全なため、意図しないラッチがinferされる。
    process (d, cond)
    begin
        if cond then
            q1 <= d;
        end if;
    end process;
    
   -- elseでラッチを回避
    process (d, cond)
    begin
        if cond then
            q2 <= d;
        else
            q2 <= '0';
        end if;
    end process;
    
   -- デフォルト値でラッチを回避。上のprocessとまったく同じ。
    process (d, cond)
    begin
        q3 <= '0';
        if cond then
            q3 <= d;
        end if;
    end process;
    
end architecture;

一往警告が出る:
Warning (10631): VHDL Process Statement warning at latch_inference_test.vhd(18): inferring latch(es) for signal or variable "q1", which holds its previous value in one or more paths through the process