Tフリップフロップ

掲載ページ:104、リスト番号:5.5


※ T_FFは、外部から直接値を設定できないため、実際には初期値を設定するためのリセット機構が必要になります。

【VHDL記述】


library IEEE;

use IEEE.std_logic_1164.all;


entity T_FF is

port( T : in std_logic;

Q : out std_logic );

end T_FF;


architecture BEHAVIOR of T_FF is


signal TMP : std_logic := '0';


begin

process ( T ) begin

-- 実際にはリセット機構が必要

if ( T = '1' ) then

TMP <= not TMP;

end if;

end process;

Q <= TMP;

end BEHAVIOR;

【Verilog-HDL記述】


module T_FF (

T,

Q

);


input T;

output Q;


reg Q;


always @ ( T ) begin

// 実際にはリセット機構が必要

if ( T == 1'b1 ) begin

Q <= ~Q;

end

end

endmodule

【合成結果】