cs 151: digital design chapter 5: sequential circuits 5-3: flip-flops ii

13
CS 151: Digital Design Chapter 5: Sequential Circuits 5-3: Flip-Flops II

Upload: beryl-farmer

Post on 03-Jan-2016

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: CS 151: Digital Design Chapter 5: Sequential Circuits 5-3: Flip-Flops II

CS 151: Digital Design

Chapter 5: Sequential Circuits

5-3: Flip-Flops II

Page 2: CS 151: Digital Design Chapter 5: Sequential Circuits 5-3: Flip-Flops II

CS 151

Consists of two clockedS-R latches in serieswith the clock on the second latch inverted

The input is observedby the first latch with C = 1

The output is changed by the second latch with C = 0 The path from input to output is broken by the difference in

clocking values (C = 1 and C = 0). The behavior demonstrated by the example with D driven by

Y given previously is prevented since the clock must change from 1 to 0 before a change in Y based on D can occur.

C

S

R

Q

Q

C

R

Q

Q

C

S

R

QS

Q

Recall: S-R Master-Slave Flip-Flop Master Slave

Y

Page 3: CS 151: Digital Design Chapter 5: Sequential Circuits 5-3: Flip-Flops II

CS 151

1’s Catching Behavior

S sets to 1,

R,C are 0

When a pulse appears, master latch “catches” the 1 on S and sets it’s output Y. Q remains unchanged.S-R Master Slave flip-flop is said to be pulse-triggeredpulse-triggered,

since it can respond to input values anytime during its clock pulse.

Page 4: CS 151: Digital Design Chapter 5: Sequential Circuits 5-3: Flip-Flops II

CS 151

1’s Catching Behavior – Cont .

S goes back to 0,

A narrow 1 appears on R,

Pulse on C still present

Master responds to the 1 on R and

changes Y back to 0. Q remains unchanged.

Page 5: CS 151: Digital Design Chapter 5: Sequential Circuits 5-3: Flip-Flops II

CS 151

1’s Catching Behavior – Cont .

C changes to 0

Slave copies value on Y Q

still 0.

In general, the “correct” response is assumed to be the response to the input values when the clock

goes to 0. So, in this case, the response is correct.

Page 6: CS 151: Digital Design Chapter 5: Sequential Circuits 5-3: Flip-Flops II

CS 151

1’s Catching Behavior – Cont .

A narrow 1 appears on S,

Pulse on C active

Master sets,

Q still 0.

Page 7: CS 151: Digital Design Chapter 5: Sequential Circuits 5-3: Flip-Flops II

CS 151

1’s Catching Behavior – Cont .

C changes to 0

Slave copies value on Y

Q sets too.

Recall: the “correct” response is assumed to be the response to the input values when the clock goes to 0. 1. Before the pulse appeared, Q was 0.2. R and S were both low before the pulse returned to 0.3. Then, Q should store a 0.So, in this case, the response is not correct.

Page 8: CS 151: Digital Design Chapter 5: Sequential Circuits 5-3: Flip-Flops II

CS 151

Note that what caused the erroneous state in the latter case was the 0 input on both S and R, which caused storing an “expired” input to the slave…

How can we solve this?

Flip-Flop Analysis

Page 9: CS 151: Digital Design Chapter 5: Sequential Circuits 5-3: Flip-Flops II

CS 151

Flip-Flop Solution

Use edge-triggering instead of pulse-triggering (master-slave)

An edge-triggered flip-flop ignores the pulse while it is at a constant level and triggers only during a transition of the clock signal

Positive-edge (0-to-1 transition) Negative-edge (1-to-0 transition)

Edge-triggered flip-flops can be built directly at the electronic circuit level, or

A master-slave D flip-flop which also exhibits edge-triggered behavior can be used.

Page 10: CS 151: Digital Design Chapter 5: Sequential Circuits 5-3: Flip-Flops II

CS 151

Edge-Triggered D Flip-Flop The edge-triggered

D flip-flop is thesame as the master-slave D flip-flop

It can be formed by: Replacing the first clocked S-R latch with a clocked D latch or Adding a D input and inverter to a master-slave S-R flip-flop

The delay of the S-R master-slave flip-flop can be avoided since the 1s-catching behavior is not present with D replacing S and R inputs

The change of the D flip-flop output is associated with the negative edge at the end of the pulse

It is called a negative-edge triggered flip-flop

C

S

R

Q

QC

Q

QC

D QD

Q

Page 11: CS 151: Digital Design Chapter 5: Sequential Circuits 5-3: Flip-Flops II

CS 151

Positive-Edge Triggered D Flip-Flop Formed by

adding inverterto clock input

Q changes to the value on D applied at the positive clock edge within timing constraints to be specified

Our choice as the standard flip-flop for most sequential circuits

C

S

R

Q

QC

Q

QC

D QD

Q0 1 0

Y=D

11 0

Y

Page 12: CS 151: Digital Design Chapter 5: Sequential Circuits 5-3: Flip-Flops II

CS 151

Master-Slave:Postponed outputindicators

Edge-Triggered:Dynamicindicator

(a) Latches

S

R

SR S’R’

S

R

D with 0 Control

D

C

D with 1 Control

D

C

(b) Master-Slave Flip-Flops

D

C

Triggered DTriggered SR

S

R

C

D

C

Triggered DTriggered SR

S

R

C

(c) Edge-Triggered Flip-Flops

Triggered D

D

C

Triggered D

D

C

Standard Symbols for Storage Elements

Page 13: CS 151: Digital Design Chapter 5: Sequential Circuits 5-3: Flip-Flops II

CS 151

Direct Inputs At power up or at reset, all or part

of a sequential circuit usually isinitialized to a known state beforeit begins operation

This initialization is often doneoutside of the clocked behaviorof the circuit, i.e., asynchronously.

Direct R and/or S inputs that control the state of the latches within the flip-flops are used for this initialization.

For the example flip-flop shown 0 applied to R resets the flip-flop to the 0 state 0 applied to S sets the flip-flop to the 1 state

D

C

S

R

Q

Q