関連: プロセス文でポジティブエッジトリガー型Dフリップフロップを作る -
pp.147-148
library ieee; use ieee.std_logic_1164.all; entity flip_flop is port( d, clk, arst: in std_logic; q : out std_logic ); end entity; architecture flip_flop of flip_flop is begin process(clk, arst) -- ()内の信号が変化したら以下の処理を実行する。 begin if arst='1' then --if arst then -- VHDL 2008はこれでいける。 q <= '0'; elsif rising_edge(clk) then -- else ifではなくelsif。 q <= d; end if; end process; end architecture;