new latches and flip-flopsb93076/chap11_p2.pdf · 2006. 11. 20. · 11.4 edge-triggered d flip-flop...

18
Unit 11 Latches and Flip-Flops 1 Latches and Flip-Flops 11.1 Introduction 11.2 Set-Reset Latch 11.3 Gated D Latch 11.4 Edge-Triggered D Flip-Flop 11.5 S-R Flip-Flop 11.6 J-K Flip-Flop 11.7 T Flip-Flop 11.8 Flip-Flops with additional Inputs Unit 11 Latches and Flip-Flops 2 Edge-Triggered D Flip-Flop 邊緣觸發D型正反器

Upload: others

Post on 15-Oct-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: New Latches and Flip-Flopsb93076/chap11_p2.pdf · 2006. 11. 20. · 11.4 Edge-Triggered D Flip-Flop 11.5 S-R Flip-Flop 11.6 J-K Flip-Flop 11.7 T Flip-Flop 11.8 Flip-Flops with additional

1

Unit 11 Latches and Flip-Flops 1

Latches and Flip-Flops

11.1 Introduction11.2 Set-Reset Latch11.3 Gated D Latch11.4 Edge-Triggered D Flip-Flop11.5 S-R Flip-Flop11.6 J-K Flip-Flop11.7 T Flip-Flop11.8 Flip-Flops with additional Inputs

Unit 11 Latches and Flip-Flops 2

Edge-Triggered D Flip-Flop邊緣觸發D型正反器

D型正反器有2個輸入:

D(資料)和

Ck(時脈)。

正反器的輸出只對時脈有反應,與D的變化無關。

Page 2: New Latches and Flip-Flopsb93076/chap11_p2.pdf · 2006. 11. 20. · 11.4 Edge-Triggered D Flip-Flop 11.5 S-R Flip-Flop 11.6 J-K Flip-Flop 11.7 T Flip-Flop 11.8 Flip-Flops with additional

2

Unit 11 Latches and Flip-Flops 3

Edge-Triggered

active edge(作用邊緣):指觸發正反器讓狀態改變的時脈邊緣rising edge(上緣)或

falling edge(下緣)。

Rising Edge-Triggered上升邊緣(正緣)觸發:如果輸出變化對時脈輸入從0到1轉換有反應,稱此正反器被時脈的上升邊緣觸發。

Falling Edge-Triggered下降邊緣(負緣)觸發:如果輸出變化只對時脈輸入從1到0的轉換有反應,稱此正反器被時脈的下降邊緣觸發。

Unit 11 Latches and Flip-Flops 4

Timing for D Flip-Flop(Falling-Edge Trigger)D型正反器的時序:

Page 3: New Latches and Flip-Flopsb93076/chap11_p2.pdf · 2006. 11. 20. · 11.4 Edge-Triggered D Flip-Flop 11.5 S-R Flip-Flop 11.6 J-K Flip-Flop 11.7 T Flip-Flop 11.8 Flip-Flops with additional

3

Unit 11 Latches and Flip-Flops 5

D Flip-Flop(Rising-Edge Trigger)上升邊緣觸發D型正反器:

用2個gated D latches和一個inverter組成。

Unit 11 Latches and Flip-Flops 6

當CLK= 0,G1=1,第1個latch直接穿透,所以輸出P 緊跟著D 輸入。

因為G2=0,第2個latch維持Q目前的值。

當CLK 變成1,G1變成0,D目前的值儲存在第1個latch中。

因為G2=1,P的值流經第2個latch到達輸出Q。

當CLK 變回成0,第2個latch取得P 的值並保存該值,

接著第1個latch開始再次跟隨D 的輸入。如果第1個latch在第2個latch取得P的值之前跟隨D 的輸入,則正反器的功能不正確。

Page 4: New Latches and Flip-Flopsb93076/chap11_p2.pdf · 2006. 11. 20. · 11.4 Edge-Triggered D Flip-Flop 11.5 S-R Flip-Flop 11.6 J-K Flip-Flop 11.7 T Flip-Flop 11.8 Flip-Flops with additional

4

Unit 11 Latches and Flip-Flops 7

Review Question

【習題11.5】 (page 311):What change must be made to Figure 11-15(a) to implement a falling-edge triggered D flip-flop?Complete the following timing diagram for the modified flip-flop.

Unit 11 Latches and Flip-Flops 8

Setup and Hold Times

正反器只在時脈觸發邊緣改變狀態,正反器的傳播延遲是時脈觸發邊緣到輸出改變之間的時間。

為了能正常動作,邊緣觸發正反器的D 輸入在時脈作用邊緣前後一段時間內必須維持定值。

setup time (tsu):在觸發邊緣之前D 必須穩定的時間。hold time (th):在觸發邊緣之後D 必須維持的時間。

Page 5: New Latches and Flip-Flopsb93076/chap11_p2.pdf · 2006. 11. 20. · 11.4 Edge-Triggered D Flip-Flop 11.5 S-R Flip-Flop 11.6 J-K Flip-Flop 11.7 T Flip-Flop 11.8 Flip-Flops with additional

5

Unit 11 Latches and Flip-Flops 9

Determination of Minimum Clock Period

不違反時序限制的最小時脈週期。

EX:假設

inverter的傳播延遲為2ns,同時假設flip-flop的傳播延遲為5ns,setup time為3ns(hold time不影響計算)。若時脈週期為9ns,則flip-flop也許無法取得正確的值。

Unit 11 Latches and Flip-Flops 10

Determination of Minimum Clock Period(Cont’d)若時脈週期為15ns,則flip-flop能正常動作。10ns是電路能動作的最小時脈週期。

Page 6: New Latches and Flip-Flopsb93076/chap11_p2.pdf · 2006. 11. 20. · 11.4 Edge-Triggered D Flip-Flop 11.5 S-R Flip-Flop 11.6 J-K Flip-Flop 11.7 T Flip-Flop 11.8 Flip-Flops with additional

6

Unit 11 Latches and Flip-Flops 11

Latches and Flip-Flops

11.1 Introduction11.2 Set-Reset Latch11.3 Gated D Latch11.4 Edge-Triggered D Flip-Flop11.5 S-R Flip-Flop11.6 J-K Flip-Flop11.7 T Flip-Flop11.8 Flip-Flops with additional Inputs

Unit 11 Latches and Flip-Flops 12

S-R Flip-Flop

S-R正反器:

Page 7: New Latches and Flip-Flopsb93076/chap11_p2.pdf · 2006. 11. 20. · 11.4 Edge-Triggered D Flip-Flop 11.5 S-R Flip-Flop 11.6 J-K Flip-Flop 11.7 T Flip-Flop 11.8 Flip-Flops with additional

7

Unit 11 Latches and Flip-Flops 13

S-R Flip-Flop implementation

2個S-R latch和邏輯閘組成的S-R flip-flop(主從式正反器):當CLK= 0,S 和R 輸入將master的輸出設成適當的值,而slave維持之前的Q值。當時脈從0變成1,P 的值保留在master ,且此值轉送到slave 。當CLK= 1, master維持P 的值,也因此Q 不會改變。當時脈從1變成0,Q 的值被鎖在slave ,讓master可以處理新的輸入。

master slave

Unit 11 Latches and Flip-Flops 14

Timing for S-R Flip-Flop

主從式正反器之時序:

Page 8: New Latches and Flip-Flopsb93076/chap11_p2.pdf · 2006. 11. 20. · 11.4 Edge-Triggered D Flip-Flop 11.5 S-R Flip-Flop 11.6 J-K Flip-Flop 11.7 T Flip-Flop 11.8 Flip-Flops with additional

8

Unit 11 Latches and Flip-Flops 15

Review Question【習題11.6】 (page 311):A reset-dominant flip-flop behaves like an S-R flip-flop, except that the input S=R=1 is allowed, and the flip-flop is reset when S=R=1.

Derive the characteristic equation for a reset-dominant flip-flopShow how a reset-dominant flip-flop can be constructed by adding gate(s) to an S-R flip-flop.

Unit 11 Latches and Flip-Flops 16

Latches and Flip-Flops

11.1 Introduction11.2 Set-Reset Latch11.3 Gated D Latch11.4 Edge-Triggered D Flip-Flop11.5 S-R Flip-Flop11.6 J-K Flip-Flop11.7 T Flip-Flop11.8 Flip-Flops with additional Inputs

Page 9: New Latches and Flip-Flopsb93076/chap11_p2.pdf · 2006. 11. 20. · 11.4 Edge-Triggered D Flip-Flop 11.5 S-R Flip-Flop 11.6 J-K Flip-Flop 11.7 T Flip-Flop 11.8 Flip-Flops with additional

9

Unit 11 Latches and Flip-Flops 17

J-K Flip-Flop

J-K正反器:

J-K正反器有三個輸入,J、K和時脈(CK)。

J輸入對應到S,K對應到R。

Unit 11 Latches and Flip-Flops 18

J-K Flip-Flop Timing

J-K正反器的時序:

Q changes on the rising edge

Page 10: New Latches and Flip-Flopsb93076/chap11_p2.pdf · 2006. 11. 20. · 11.4 Edge-Triggered D Flip-Flop 11.5 S-R Flip-Flop 11.6 J-K Flip-Flop 11.7 T Flip-Flop 11.8 Flip-Flops with additional

10

Unit 11 Latches and Flip-Flops 19

Master-Slave J-K Flip-flop

利用2個S-R latch聯結成圖11-21所示的主-從(master-slave)式架構,實現J-K flip-flop。

masterslave

Unit 11 Latches and Flip-Flops 20

Review Question

【習題11.7】 (page 311):Complete the following timing diagram for the flip-flop of Figure 11-20(a).

Page 11: New Latches and Flip-Flopsb93076/chap11_p2.pdf · 2006. 11. 20. · 11.4 Edge-Triggered D Flip-Flop 11.5 S-R Flip-Flop 11.6 J-K Flip-Flop 11.7 T Flip-Flop 11.8 Flip-Flops with additional

11

Unit 11 Latches and Flip-Flops 21

Latches and Flip-Flops

11.1 Introduction11.2 Set-Reset Latch11.3 Gated D Latch11.4 Edge-Triggered D Flip-Flop11.5 S-R Flip-Flop11.6 J-K Flip-Flop11.7 T Flip-Flop11.8 Flip-Flops with additional Inputs

Unit 11 Latches and Flip-Flops 22

T Flip-Flop

T型正反器(切換(toggle)正反器):有1個T 輸入和1個時脈輸入。

當T= 1時,正反器在時脈觸發邊緣之後改變狀態。

當T= 0時,不會發生狀態改變。

Page 12: New Latches and Flip-Flopsb93076/chap11_p2.pdf · 2006. 11. 20. · 11.4 Edge-Triggered D Flip-Flop 11.5 S-R Flip-Flop 11.6 J-K Flip-Flop 11.7 T Flip-Flop 11.8 Flip-Flops with additional

12

Unit 11 Latches and Flip-Flops 23

Timing Diagram for T Flip-flop

T型正反器的時序: falling edge trigger

Unit 11 Latches and Flip-Flops 24

Implementation of T Flip-flop

利用

1)J-K正反器、

2)D型正反器和XOR閘實現T flip-flop。

Page 13: New Latches and Flip-Flopsb93076/chap11_p2.pdf · 2006. 11. 20. · 11.4 Edge-Triggered D Flip-Flop 11.5 S-R Flip-Flop 11.6 J-K Flip-Flop 11.7 T Flip-Flop 11.8 Flip-Flops with additional

13

Unit 11 Latches and Flip-Flops 25

Latches and Flip-Flops

11.1 Introduction11.2 Set-Reset Latch11.3 Gated D Latch11.4 Edge-Triggered D Flip-Flop11.5 S-R Flip-Flop11.6 J-K Flip-Flop11.7 T Flip-Flop11.8 Flip-Flops with additional Inputs

Unit 11 Latches and Flip-Flops 26

Flip-Flops with additional Inputs具有額外輸入的正反器

正反器通常具有額外的輸入,可以用來設置與時脈無關的正反器初始狀態。

clear (ClrN) and preset (PreN)

Page 14: New Latches and Flip-Flopsb93076/chap11_p2.pdf · 2006. 11. 20. · 11.4 Edge-Triggered D Flip-Flop 11.5 S-R Flip-Flop 11.6 J-K Flip-Flop 11.7 T Flip-Flop 11.8 Flip-Flops with additional

14

Unit 11 Latches and Flip-Flops 27

Timing Diagram for D Flip-Flopwith Asynchronous Clear and Preset具有非同步清除和預置輸入動作的D型正反器時序圖。

Unit 11 Latches and Flip-Flops 28

Review Question【習題11.9】 (page 312):

a) Complete the following timing diagram for a J-K flip-flop with a falling-edge trigger and asynchronous ClrN and PreNinputs.

Page 15: New Latches and Flip-Flopsb93076/chap11_p2.pdf · 2006. 11. 20. · 11.4 Edge-Triggered D Flip-Flop 11.5 S-R Flip-Flop 11.6 J-K Flip-Flop 11.7 T Flip-Flop 11.8 Flip-Flops with additional

15

Unit 11 Latches and Flip-Flops 29

Review Question【習題11.9】 (page 312):

b) Complete the timing diagram for the following circuit. Note that the Ck inputs on the two flip-flops are different.

Unit 11 Latches and Flip-Flops 30

D Flip-Flop with Clock Enable

欲設計同步數位系統(synchronous)當即使正反器的資料輸入有變化,我們仍希望某些正反器能維持現在的資料--利用閘控時脈(gating the clock)。

當En= 0時,正反器的時脈輸入為0,Q不會改變。

Page 16: New Latches and Flip-Flopsb93076/chap11_p2.pdf · 2006. 11. 20. · 11.4 Edge-Triggered D Flip-Flop 11.5 S-R Flip-Flop 11.6 J-K Flip-Flop 11.7 T Flip-Flop 11.8 Flip-Flops with additional

16

Unit 11 Latches and Flip-Flops 31

Two Potential Problems

使用閘控時脈的缺點:

首先,閘控延遲會讓時脈在不同的時間抵達不同的正反器,造成同步性的缺失。

其次,若En在錯誤的時間點改變,正反器也許會因En改變而被觸發,而非因時脈的改變,再一次導致同步性的缺失。

改善方式:

採用具有 時脈致能(CE)的正反器。

Unit 11 Latches and Flip-Flops 32

D Flip-flop with Clock Enable

D-CE flip-flop :具有時脈致能的D型正反器當CE= 0時,時脈被禁能,不會發生狀態變化,所以Q+=Q。當CE= 1時,正反器的動作像一般的D正反器,所以Q+=D。因此特性方程式為Q+= Q‧CE’ + D‧CE。

Page 17: New Latches and Flip-Flopsb93076/chap11_p2.pdf · 2006. 11. 20. · 11.4 Edge-Triggered D Flip-Flop 11.5 S-R Flip-Flop 11.6 J-K Flip-Flop 11.7 T Flip-Flop 11.8 Flip-Flops with additional

17

Unit 11 Latches and Flip-Flops 33

Review Question【習題11.8】 (page 312):Complete the following diagrams for the falling-edge triggered D-CE flip-flop of Figure 11-27(c). Assume Q begins at 1.

a) First draw Q based on your understanding of the behavior of a D flip-flop with clock enable.

b) Now draw the internalsignal D from Figure 11-27(c), and confirmthat this gives the same Q as in a).

Unit 11 Latches and Flip-Flops 34

Summary (總結)

正反器的特性(next state)方程式可以推導如下:首先,製作一個真值表,

表中next state (Q+)為current state (Q)和輸入之函數,任何不合規定的輸入組合則用不理會項來處理。

接著繪出Q+的圖,從圖中導出特性方程式。

特性方程式適用於閂和正反器,但是兩者的解釋方式不同。

例如,對gated D latch而言,Q+代表latch在某個輸入改變短暫時間之後的狀態。

但是對D flip-flop而言,Q+代表flip-flop在時脈觸發邊緣短暫時間之後的狀態。

Page 18: New Latches and Flip-Flopsb93076/chap11_p2.pdf · 2006. 11. 20. · 11.4 Edge-Triggered D Flip-Flop 11.5 S-R Flip-Flop 11.6 J-K Flip-Flop 11.7 T Flip-Flop 11.8 Flip-Flops with additional

18

Unit 11 Latches and Flip-Flops 35

Characteristic Equations

latches與flip-flops的特性方程式:

Unit 11 Latches and Flip-Flops 36

Review Question【習題11.10】 (page 313):Covert by adding external:

a) a D flip-flop to a J-K flip-flop.b) a T flip-flop to a D flip-flop.c) a T flip-flop to a D flip-flop with clock enable.