Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
2005/10/17 ©2006, Masaharu Imai 1
第3章 フリップ・フロップ
大阪大学 大学院情報科学研究科
今井 正治
[email protected]://www-ise1.ist.osaka-u.ac.jp/~imai/
2005/10/17 ©2006, Masaharu Imai 2
講義内容
フリップ・フロップの基本原理
RSフリップ・フロップ
Dラッチ
Dフリップ・フロップ
JKフリップ・フロップ
Tフリップ・フロップ
まとめ
2005/10/17 ©2006, Masaharu Imai 3
フリップ・フロップの基本原理(1/2)
帰還を持つインバータ回路(1個の場合)
スイッチング遅延(2 ns)を仮定
発振する
H
L
2 4 6 8 10 12 14 16
2005/10/17 ©2006, Masaharu Imai 4
フリップ・フロップの基本原理(2/2)
帰還を持つインバータ回路(2個の場合)2つの安定状態を持つ
インバータの個数と安定/発振の関係奇数個の場合: 発振
偶数個の場合: 2つの安定状態を持つ
H L H L H L
2005/10/17 ©2006, Masaharu Imai 5
講義内容
フリップ・フロップの基本原理
RSフリップ・フロップ
Dラッチ
Dフリップ・フロップ
JKフリップ・フロップ
Tフリップ・フロップ
まとめ
2005/10/17 ©2006, Masaharu Imai 6
RSフリップ・フロップ (RSFF)MIL記号
74279 (出力Qのみ)
4043 (NAND)
4044 (NOR)
動作表
R Q
S
RSFF
Q
R S Q’ Q’
‘0’ Q
‘0’
‘1’
‘X’
‘1’
‘1’ ‘0’ ‘0’
‘1’ ‘1’ ‘X’
‘0’ Q
‘0’ ‘1’
R=‘1’ & S=‘1’ は,禁止入力
2005/10/17 ©2006, Masaharu Imai 7
RSFFのNANDゲートによる実現
R S Q’ Q’
‘0’ Q
‘0’
‘1’
‘1’
‘1’
‘1’ ‘0’ ‘0’
‘1’ ‘1’ ‘1’
‘0’ Q
‘0’ ‘1’
R
QS
Q
2005/10/17 ©2006, Masaharu Imai 8
RSFFのNORゲートによる実現
R S Q’ Q’
‘0’ Q
‘0’
‘1’
‘0’
‘1’
‘1’ ‘0’ ‘0’
‘1’ ‘1’ ‘0’
‘0’ Q
‘0’ ‘1’
S
QR
Q
2005/10/17 ©2006, Masaharu Imai 9
RSFFのエンティティ記述
library IEEE;use IEEE.std_logic_1164.all;
entity RSFF isgeneric( Tpd: time := 1 ns );port(
s_in: in std_logic;r_in: in std_logic;q_out: out std_logic;qb_out: out std_logic );
end entity RSFF;
2005/10/17 ©2006, Masaharu Imai 10
RSFFのビヘイビア記述(1/2)architecture BEHAVIOR of RSFF isbegin
process( s_in, r_in )begin
if s_in = '0' and r_in = '0' thenNULL;
elsif s_in = '0' and r_in = '1' thenq_out <= '0';qb_out <= '1';
elsif s_in = '1' and r_in = '0' thenq_out <= '1';qb_out <= '0';
2005/10/17 ©2006, Masaharu Imai 11
RSFFのビヘイビア記述(2/2)else
q_out <= 'X';qb_out <= 'X';
end if;end process;
end architecture BEHAVIOR;
2005/10/17 ©2006, Masaharu Imai 12
RSFFのデータフロー記述(NANDゲートによる実装)
architecture DF_NAND of RSFF issignal temp1, temp2: std_logic;
begintemp1 <= ( not s_in ) nand temp2 after Tpd;temp2 <= ( not r_in ) nand temp1 after Tpd;q_out <= temp1;qb_out <= temp2;
end architecture DF_NAND;
R
QS
Q
2005/10/17 ©2006, Masaharu Imai 13
RSFFのデータフロー記述(NORゲートによる実装)
architecture DF_NOR of RSFF issignal temp1, temp2: std_logic;
begintemp1 <= r_in nor temp2 after Tpd;temp2 <= s_in nor temp1 after Tpd;q_out <= temp1;qb_out <= temp2;
end architecture DF_NOR;
S
QR
Q
2005/10/17 ©2006, Masaharu Imai 14
RSFFの動作
QNAND
S
QNOR
QNOR
QNAND
R
set hold rst hold set inh rst inhhold hold
‘1’
‘0’
‘0’
‘0’
‘1’
‘1’
‘1’
‘1’ ‘1’‘0’ ‘0’ ‘0’
‘0’
‘0’
‘0’
‘0’ ‘0’
‘0’
‘0’‘1’
‘0’
‘0’
‘0’
‘1’ ‘1’
‘1’
‘1’
‘1’
‘1’ ‘1’
‘1’
‘0’
‘1’
2005/10/17 ©2006, Masaharu Imai 15
RSFFへの「禁止入力」について
(S, R) = (‘1’, ‘1’) は「禁止入力」
(S, R) = (‘1’, ‘1’) が入力されると,出力は(Q, Q) = (‘1’, ‘1’) または (‘0’, ‘0’) となる
禁止入力自体には大きな問題はない
むしろ,禁止入力の直後に(S, R) = (‘0’, ‘0’) が入力されると回路が発振することが問題
2005/10/17 ©2006, Masaharu Imai 16
講義内容
フリップ・フロップの基本原理
RSフリップ・フロップ
Dラッチ
Dフリップ・フロップ
JKフリップ・フロップ
Tフリップ・フロップ
まとめ
2005/10/17 ©2006, Masaharu Imai 17
Dラッチ(D Latch)MIL記号
7475, 7477 など
4042, 4508
真理値表
D Q
G
D Latch
Q
G D Q’ Q’
‘0’ Q
Q
‘1’
‘0’
‘1’
‘1’ ‘0’ ‘0’
‘1’ ‘1’ ‘1’
‘0’ Q
‘0’ Q
別名: トランスペアレント・ラッチ
2005/10/17 ©2006, Masaharu Imai 19
Dラッチの動作
①Gの値が‘1’の間,Dの値をそのまま出力する(③Dの値は筒抜けになる)
②Gの値が‘1’から‘0’に変化すると,その時のDの値が保持される
D
Q
G
①①①
② ②②
③
2005/10/17 ©2006, Masaharu Imai 20
Dラッチのエンティティ記述
library ieee;use ieee.std_logic_1164.all;
entity D_LATCH isgeneric( Tpd_lh: time := 2 ns; -- Rising Delay ( '0' to '1' )
Tpd_hl: time := 4 ns -- Falling Delay ( '1' to '0' ));
port (en: in std_logic;d_in: in std_logic;q_out: out std_logic );
end entity D_LATCH;
2005/10/17 ©2006, Masaharu Imai 21
Dラッチのビヘイビア記述 (1/2)architecture BEHAVIOR of D_LATCH isbegin
P1: process( en, d_in )variable q_nxt: std_logic;
beginif en = '1' then
q_nxt := d_in;end if;
2005/10/17 ©2006, Masaharu Imai 22
Dラッチのビヘイビア記述 (2/2)if q_nxt = '1' then
q_out <= q_nxt after Tpd_lh;else
q_out <= q_nxt after Tpd_hl;end if;
end process P1;end architecture BEHAVIOR;
2005/10/17 ©2006, Masaharu Imai 23
Dラッチのデータフロー記述
architecture DATA_FLOW of D_LATCH isconstant DELAY: time := 1 ns;signal temp1, temp2, temp3, temp4: std_logic;
begintemp1 <= en nand d_in after DELAY;temp2 <= en nand not d_in after DELAY;temp3 <= temp1 nand temp4 after DELAY;temp4 <= temp2 nand temp3 after DELAY;q_out <= temp3;
end architecture DATA_FLOW;
2005/10/17 ©2006, Masaharu Imai 24
講義内容
フリップ・フロップの基本原理
RSフリップ・フロップ
Dラッチ
Dフリップ・フロップ
JKフリップ・フロップ
Tフリップ・フロップ
まとめ
2005/10/17 ©2006, Masaharu Imai 25
Dフリップ・フロップ(DFF)
MIL記号
7474, 74175 など
4013CKの端子の△印は
エッジトリガー型である事を表す
PR,CLRの○印は,Low Activeである事を
表す
D Q
CK
DFF
QCLR
PR
2005/10/17 ©2006, Masaharu Imai 26
DFFの動作表
入力 出力
CLOCK D PRESET CLEAR Q
‘1’ ‘1’
‘0’
Q
‘1’
‘-’ ‘-’ ‘0’ ‘1’ ‘1’ ‘0’
‘-’ ‘-’ ‘0’ ‘0’ ‘1’ ‘1’
‘1’
‘1’
‘0’
‘0’
‘1’
‘-’
‘-’
Q
‘1’ ‘0’
‘1’
‘1’ Q
‘-’ ‘1’ ‘0’
‘1’
2005/10/17 ©2006, Masaharu Imai 27
DFFのエンティティ記述
library ieee;use ieee.std_logic_1164.all;
entity DFF isport (
clock: in std_logic;pr_b: in std_logic; -- presetcl_b: in std_logic; -- cleard_in: in std_logic;q_out: out std_logic;qb_out: out std_logic );
end entity DFF;
2005/10/17 ©2006, Masaharu Imai 28
DFFのビヘイビア記述 (1/2)architecture BEH_PE_ASR of DFF isbegin
P1: process( clock, preset, clear )variable q_nxt, qb_nxt: std_logic;
beginif pr_b = ‘0' and cl_b = ‘0' then
q_nxt := '1';qb_nxt := '1';
elsif pr_b = ‘0' thenq_nxt := '1';qb_nxt := '0';
elsif cl_b = ‘0' thenq_nxt := '0';qb_nxt := '1';
2005/10/17 ©2006, Masaharu Imai 29
DFFのビヘイビア記述 (2/2)elsif rising_edge( clock ) then
q_nxt := d_in;qb_nxt := not d_in;
end if;
if q_nxt = '1' thenq_out <= q_nxt after Tpd_lh;
elseq_out <= q_nxt after Tpd_hl;
end if;
end process P1;end architecture BEH_PE_ASR;
2005/10/17 ©2006, Masaharu Imai 31
Dラッチを用いたDFFの構成
マスタースレーブ・データ・ロックアウト型
D Q
G Q
D Q
G Q
d_in
clock
q_out
clk_b
m_out
2005/10/17 ©2006, Masaharu Imai 32
Dラッチを用いたDFFの実現(1)library ieee;use ieee.std_logic_1164.all;use work.ALL;
entity DFF_MS isgeneric(
Tpd_lh: time := 2 ns; -- Rising Delay ( '0' to '1' )Tpd_hl: time := 4 ns ); -- Falling Delay ( '1' to '0' )
port (clock: in std_logic;d_in: in std_logic;q_out: out std_logic );
end entity DFF_MS;
2005/10/17 ©2006, Masaharu Imai 33
Dラッチを用いたDFFの実現(2)architecture STRUCTURE of DFF_MS is
component D_LATCH isport (
sel: in std_logic;d_in: in std_logic;q_out: out std_logic );
end component D_LATCH;
signal clk_b: std_logic;signal m_out: std_logic;
for M_LAT: D_LATCH use entity work.D_LATCH( DATA_FLOW );for S_LAT: D_LATCH use entity work.D_LATCH( DATA_FLOW );
2005/10/17 ©2006, Masaharu Imai 34
Dラッチを用いたDFFの実現(3)begin
clk_b <= not clock;M_LAT: D_LATCH port map(
en => clk_b,d_in => d_in,q_out => m_out );
S_LAT: D_LATCH port map(en => clock,d_in => m_out,q_out => q_out );
end architecture STRUCTURE;
2005/10/17 ©2006, Masaharu Imai 36
講義内容
フリップ・フロップの基本原理
RSフリップ・フロップ
Dラッチ
Dフリップ・フロップ
JKフリップ・フロップ
Tフリップ・フロップ
まとめ
2005/10/17 ©2006, Masaharu Imai 37
JKフリップ・フロップ(JKFF)
MIL記号
7473, 7476 など
4027, 4095, 4096
J Q
CK
JKFF
QCLR
PR
K
2005/10/17 ©2006, Masaharu Imai 38
JKFFの動作表
J K clock
‘0’
‘-’ ‘-’ ‘0’ ‘1’ ‘-’ ‘1’ ‘0’‘-’ ‘-’ ‘1’ ‘0’ ‘-’ ‘0’ ‘1’‘-’ ‘-’ ‘0’ ‘0’ ‘-’ ‘1’ ‘1’
‘1’
‘0’
‘1’
‘-’
‘0’
‘0’
‘1
‘1’
‘-’
preset clear Q Q
‘1’ ‘1’
‘1’
‘1’
‘1’
Q
‘1’
‘1’ ‘0’
Q
‘1’
‘0’
Q
‘1’ ‘1’
‘1’ Q
‘1’ QQ
2005/10/17 ©2006, Masaharu Imai 39
JKFFのエンティティ記述
library ieee;use ieee.std_logic_1164.all;
entity JKFF isport (
clock: in std_logic;pr_b: in std_logic;clr_b: in std_logic;J_in: in std_logic;K_in: in std_logic;Q_out: out std_logic;Qb_out: out std_logic );
end entity JKFF;
2005/10/17 ©2006, Masaharu Imai 40
JKFFのビヘイビア記述(1/4)architecture BEAVIOR of JKFF isbegin
P1: process( clock, pr_b, clr_b )variable q_nxt: std_logic;variable qb_nxt: std_logic;variable q_tmp: std_logic;
begin
2005/10/17 ©2006, Masaharu Imai 41
JKFFのビヘイビア記述(2/4)if pr_b = ‘0' and clr_b = ‘0' then -- Preset & Clear
q_nxt := '1';qb_nxt := '1';
elsif pr_b = ‘0' and clr_b = ‘1’then -- Presetq_nxt := ‘1';qb_nxt := ‘0';
elsif pr_b = ‘1’ and clr_b = ‘0' then -- Clearq_nxt := ‘0';qb_nxt := ‘1';
elsif pr_b = ‘1’ and clr_b = ‘1' then -- Normal Action
2005/10/17 ©2006, Masaharu Imai 42
JKFFのビヘイビア記述(3/4)if falling_edge( clock ) then -- Load New Data or Toggle
if j_in = '0' and k_in = '0' then -- No Change NULL;
elsif j_in = '0' and k_in = '1' then-- Set ‘0’q_nxt := '0';qb_nxt := '1';
elsif j_in = '1' and k_in = '0' then -- Set ‘1’q_nxt := '1';qb_nxt := '0';
elsif j_in = '1' and k_in = '1' then -- Toggleq_tmp := q_nxt;q_nxt := qb_nxt;qb_nxt := q_tmp;
end if;end if;
2005/10/17 ©2006, Masaharu Imai 43
JKFFのビヘイビア記述(4/4)else -- Unexpected Control Signals
q_nxt := 'X';qb_nxt := 'X';
end if;end if;
q_out <= q_nxt;qb_out<= qb_nxt;
end process P1;end architecture BEH_ARS;
2005/10/17 ©2006, Masaharu Imai 45
講義内容
フリップ・フロップの基本原理
RSフリップ・フロップ
Dラッチ
Dフリップ・フロップ
JKフリップ・フロップ
Tフリップ・フロップ
まとめ
2005/10/17 ©2006, Masaharu Imai 46
Tフリップ・フロップ(TFF)
入力パルスが入るたびに出力が反転
エッジ・トリガー・タイプ
CLR T Q’
‘0’ ー ‘0’
‘1’ QCLR
T Q
TFF
2005/10/17 ©2006, Masaharu Imai 48
TFFのエンティティ記述
library ieee;use ieee.std_logic_1164.all;
entity TFF isport (
clr_b: in std_logic;T_in: in std_logic;Q_out: out std_logic );
end entity TFF;
2005/10/17 ©2006, Masaharu Imai 49
TFFのビヘイビア記述 (1/2)architecture BEHAVIOR of TFF isbegin
P1: process( clr_b, T_in )variable d_nxt: std_logic;
beginif clr_b = ‘0' then -- Clear
d_nxt := '0';elsif clr_b = ‘1’ then -- Normal Action
if rising_edge( T_in ) then -- Toggled_nxt := not d_nxt;
end if;
2005/10/17 ©2006, Masaharu Imai 50
TFFのビヘイビア記述 (1/2)else -- Unexpected Control Signal
d_nxt := ‘X’;end if;
Q_out <= d_nxt;end process P1;
end architecture BEHAVIOR;
2005/10/17 ©2006, Masaharu Imai 52
DFFを用いたTFFの動作
clr_b
D_in
Q_out
10 200 30 40 50 60 70 80 90 100 ns
T_in
Qb_out
2005/10/17 ©2006, Masaharu Imai 55
講義内容
フリップ・フロップの基本原理
RSフリップ・フロップ
Dラッチ
Dフリップ・フロップ
JKフリップ・フロップ
Tフリップ・フロップ
まとめ
2005/10/17 ©2006, Masaharu Imai 56
まとめ (1/2)
フリップ・フロップの基本原理は,帰還を持つインバータ回路.
RSフリップ・フロップは,NANDゲートまたはNORゲートによって実現できる.
RSフリップ・フロップは禁止入力を持つ.
Dラッチは,レベルセンシティブな記憶素子.
Dフリップ・フロップは,クロック信号のエッジでトリガーされる記憶素子.