25
L4: 6.111 Spring 2009 1 Introductory Digital Systems Laboratory L4: Sequential Building Blocks (Flip-flops, Latches and Registers) Acknowledgements: ¾Lecture material adapted from R. Katz, G. Borriello, “Contemporary Logic Design” (second edition), Prentice-Hall/Pearson Education, 2005. ¾Lecture material adapted from J. Rabaey, A. Chandrakasan, B. Nikolic, “Digital Integrated Circuits: A Design Perspective” Copyright 2003 Prentice Hall/Pearson. ¾Lecture notes prepared by Professor Anantha Chandrakasan

L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 1Introductory Digital Systems Laboratory

L4: Sequential Building Blocks

(Flip-flops, Latches and Registers)

Acknowledgements:

Lecture material adapted from R. Katz, G. Borriello, “Contemporary Logic Design” (second edition), Prentice-Hall/Pearson Education, 2005.

Lecture material adapted from J. Rabaey, A. Chandrakasan, B. Nikolic, “Digital Integrated Circuits: A Design Perspective” Copyright 2003 Prentice Hall/Pearson.

Lecture notes prepared by Professor Anantha Chandrakasan

Page 2: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 2Introductory Digital Systems Laboratory

Combinational Logic Review

Combinational logic circuits are memorylessNo feedback in combinational logic circuits Output assumes the function implemented by the logic network, assuming that the switching transients have settledOutputs can have multiple logical transitions before settling to the correct value

CombinationalCircuit

in0

in1

inN-1

in0

in1

inM-1

Page 3: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 3Introductory Digital Systems Laboratory

A Sequential System

Sequential circuits have memory (i.e., remember the past)The current state is “held” in memory and the next state is computed based the current state and the current inputsIn a synchronous systems, the clock signal orchestrates the sequence of events

Memory element

Page 4: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 4Introductory Digital Systems Laboratory

A Simple Example

in0

in1

in2 inN-1

Adding N inputs (N-1 Adders)

inD Q

reset

clk

Current_Sum

Using a sequential (serial) approach

Page 5: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 5Introductory Digital Systems Laboratory

Implementing State: Bi-stability

Vi1

A

C

B

Vo2

Vi1 = Vo2

Vo1 Vi2

Vi2 = Vo1

Vo1 = Vi2

Vo2 = Vi1

Point C is Metastable

Vi2

=V

o

Vi1 = V o2

A

δ

Vi2

=V

o1

Vi1 = Vo2

C

δ

1

Points A andB are stable(represent 0 & 1)

B

Page 6: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 6Introductory Digital Systems Laboratory

NOR-based Set-Reset (SR) Flipflop

Flip-flop refers to a bi-stable element (edge-triggered registers are also called flip-flops) – this circuit is not clocked and outputs change “asynchronously” with the inputs

Forbidden State

S

S

R

Q

Q

Q QRS Q

Q00 Q

101 0

010 1011 0

R Q

Reset Hold Set SetReset

R

S

Q

Q ??

Page 7: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 7Introductory Digital Systems Laboratory

Making a Clocked Memory Element:Positive D-Latch

CLK

D Q

D Q

clk

A Positive D-Latch: Passes input D to output Q when CLK is high and holds state when clock is low (i.e., ignores input D)A Latch is level-sensitive: invert clock for a negative latch

S

R

clock

R and S

sample hold sample holdhold

G

Page 8: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 8Introductory Digital Systems Laboratory

Multiplexer Based Positive & Negative Latch

1

0in0

in1

out

SEL

Out = sel * in1 + sel * in0

2:1 multiplexer

1

0

DQ

CLK

Positive Latch

0

1

DQ

CLK

Negative Latch

"remember"

"load""data" "stored value"

clkclk

Page 9: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 9Introductory Digital Systems Laboratory

74HC75 (Positive Latch)

Page 10: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 10Introductory Digital Systems Laboratory

Building an Edge-Triggered Register

Master-Slave RegisterUse negative clock phase to latch inputs into first latchUse positive clock to change outputs with second latch

View pair as one basic unitmaster-slave flip-flop twice as much logic

D

G

Q D

G

Q

Clk

DNegative latch Positive latch

QD

Clk

Q QDQM

Page 11: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 11Introductory Digital Systems Laboratory

Latches vs. Edge-Triggered Register

Edge triggered device sample inputs on the event edge

Transparent latches sample inputs as long as the clock is asserted

Timing Diagram:

Behavior the same unless input changes while the clock is high

7474

7475

Bubble herefor negative

edge triggeredregister

Positive edge-triggered register

Level-sensitive latch

D Q

D Q

C

Clk

Clk

D

Clk

Q

Q

7474

7475

Page 12: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 12Introductory Digital Systems Laboratory

Important Timing Parameters

Setup Time (Tsu)

Clock: Periodic Event, causes state of memoryelement to change

memory element can be updated on the: rising edge, falling edge, high level, low level

There is a timing "window" around the

clocking event during which the

input must remain stable and

unchanged in order to be recognized

Minimum time before the clocking event by which the input must be stable

Hold Time (Th)Minimum time after the clocking event during which the input must remain stable

Input

Clock

T su T h

Propagation Delay (Tcq for an edge-triggered register and Tdq for a latch)

Delay overhead of the memory element

Page 13: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 13Introductory Digital Systems Laboratory

74HC74 (Positive Edge-Triggered Register)

74HC74(courtesy TI)

D-FF with preset and clear

Page 14: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 14Introductory Digital Systems Laboratory

The J-K Flip-Flop

S

R

Q

Q

J

K

Eliminate the forbidden state of the SR Flip-flopUse output feedback to guarantee that R and S are never both one

J K Q+ Q+

0 0 Q Q

0 1 0 1

1 0 1 0

1 1 Q Q

Page 15: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 15Introductory Digital Systems Laboratory

J-K Master-Slave Register

S

R

Q

Q

J

K

S

R

Q

Q

CLK

Sample inputs while clock high Sample inputs while clock low

Correct ToggleOperation

P

P

Is there a problem with this circuit?

Page 16: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 16Introductory Digital Systems Laboratory

Pulse Based Edge-Triggered J-K Register

Page 17: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 17Introductory Digital Systems Laboratory

Pulse-Triggered Registers

Master-Slave Latches

D

Clk

Q D

Clk

Q

Clk

DataD

Clk

Q

Clk

Data

Pulse-Based Register

L1 L2 Latch

Ways to design an edge-triggered sequential cell:

Pulse registers are widely used in high-performance microprocessor chips (Sun Microsystems, AMD, Intel, etc.)The can have a negative setup time!

Short pulse around clock edge

Page 18: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 18Introductory Digital Systems Laboratory

D Flip-Flop vs. Toggle Flip-Flop

T

Clk

QT (Toggle)

Flip-Flop

0 1

1

1

0T QN

0 Q N-1

1 QN-1

0

D

Clk

QD Flip-Flop

0 1

0

1

0

D QN

0 01 1

1

Page 19: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 19Introductory Digital Systems Laboratory

Realizing Different Types of Memory Elements

Characteristic Equations

D:

J-K:

T:

Q+ = D

Q+ = J Q + K Q

Q+ = T Q + T Q

E.g., J=K=0, then Q+ = QJ=1, K=0, then Q+ = 1J=0, K=1, then Q+ = 0J=1, K=1, then Q+ = Q

Implementing One FF in Terms of Another

D implemented with J-K J-K implemented with D

Page 20: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 20Introductory Digital Systems Laboratory

Design Procedure

Excitation Tables: What are the necessary inputs to cause a particular kind of change in state?

Implementing D FF with a J-K FF:1) Start with K-map of Q+ = ƒ(D, Q)

2) Create K-maps for J and K with same inputs (D, Q)

3) Fill in K-maps with appropriate values for J and K to cause the same state changes as in the original K-map

E.g., D = Q= 0, Q+ = 0then J = 0, K = X

D 0 1 0 1

T 0 1 1 0

Q +

0 1 0 1

Q 0 0 1 1

K X X 1 0

J 0 1 X X

Page 21: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 21Introductory Digital Systems Laboratory

Design Procedure (cont.)

Implementing J-K FF with a D FF:1) K-Map of Q+ = F(J, K, Q)

2,3) Revised K-map using D's excitation tableits the same! that is why design procedure with D FF is simple!

Resulting equation is the combinational logic input to D to cause same behavior as J-K FF. Of course it is identicalto the characteristic equation for a J-K FF.

Page 22: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 22Introductory Digital Systems Laboratory

System Timing Parameters

D

Clk

QIn CombinationalLogic

D

Clk

Q

Register Timing Parameters

Tcq : worst case rising edge clock to q delay

Tcq, cd: contamination or minimum delay from clock to q

Tsu: setup timeTh: hold time

Logic Timing Parameters

Tlogic : worst case delay through the combinational logic network

Tlogic,cd: contamination or minimum delay through logic network

Page 23: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 23Introductory Digital Systems Laboratory

System Timing (I): Minimum Period

D

Clk

QIn CombinationalLogic

D

Clk

Q

CLK

Tsu

Th

Tsu

Th

Tcq

Tcq,cd

Tcq

Tcq,cd

FF1

IN

CLout

CLout

Tl,cdTsu2

Tlogic

T > Tcq + Tlogic + Tsu

Page 24: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 24Introductory Digital Systems Laboratory

System Timing (II): Minimum Delay

D

Clk

QIn CombinationalLogic

D

Clk

Q

CLK

Tsu

Th Th

Tcq,cd

FF1

IN

CLout

Tl,cd

Tcq,cd + Tlogic,cd > Thold

CLout

Page 25: L4: Sequential Building Blocks (Flip-flops, Latches and ...web.mit.edu/6.111/www/s2009/LECTURES/l4.pdf · Use negative clock phase to latch inputs into first latch Use positive clock

L4: 6.111 Spring 2009 25Introductory Digital Systems Laboratory

Shift-Register

all measurements are made from the clocking event that is,

the rising edge of the clock

Typical parameters for Positive edge-triggered D Register

Th5ns

Tw 25ns

Tplh25ns13ns

Tphl40ns25ns

Tsu20ns

D

CLK

Q

Tsu20ns

Th5ns

IN

Q0

Q1

CLK

100

CLK

INQ0 Q1

DQ DQ OUT

Shift-register