Sequential Circuits - Flip Flops (Part 2)

46
1 EET 3350 Digital Systems Design John Wakerly Chapter 7: 7.1 – 7.2 Sequential Circuits Flip-Flops

description

Lec2

Transcript of Sequential Circuits - Flip Flops (Part 2)

Page 1: Sequential Circuits - Flip Flops (Part 2)

1

EET 3350 Digital Systems Design

John Wakerly Chapter 7: 7.1 – 7.2

Sequential Circuits

Flip-Flops

Page 2: Sequential Circuits - Flip Flops (Part 2)

Types of Sequential Circuits

• Two major types:– Synchronous – changes in the output are only

allowed to occur in synchronization with an external clock signal

– Asynchronous – changes in the output are allowed to occur whenever there is a change in the input signals

2

Page 3: Sequential Circuits - Flip Flops (Part 2)

Types of Sequential Circuits

• Synchronous Sequential Circuits (also called Clocked Sequential Circuits) – All signals are synchronized to some “master clock”– The memory devices respond only when activated

by the master clock– The most common memory device is a flip-flop– Circuits can be designed using systematic methods

3

Page 4: Sequential Circuits - Flip Flops (Part 2)

Types of Sequential Circuits

• Asynchronous Sequential Circuits – Outputs depend solely on the order in which the

inputs change, so timing is critical– Based on time-delay devices

• The design methods used for synchronous sequential circuits do not apply to asynchronous circuits

4

Page 5: Sequential Circuits - Flip Flops (Part 2)

Synchronous vs. Asynchronous

• Synchronous circuits have sequential elements whose outputs change at the same time.

• Asynchronous circuits have sequential elements whose outputs change at different times.

• Disadvantages of Asynchronous Circuits– Difficult to analyze operations– Intermediate states that are not part of the desired

design may be generated

5

Page 6: Sequential Circuits - Flip Flops (Part 2)

Memory Elements

• Memory elements can be anything that will make a past value available at some future time– A device that can hold a binary value

• Memory elements are typically flip-flops– flip-flops and latches– Available in several varieties– Designer chooses based on application

6

Page 7: Sequential Circuits - Flip Flops (Part 2)

Flip-Flops and Latches

• All digital designers use the name flip-flop for a sequential device that normally samples its inputs and changes its output only when a clocking signal is changing.

• On the other hand, most digital designers use the name latch for a sequential device that watches its inputs continuously and can change its outputs at any time (although in some cases requiring an enable signal to be asserted)

Page 8: Sequential Circuits - Flip Flops (Part 2)

Flip-Flops and Latches

• Flip-flops have a clock input and synchronous outputs

• Latches are asynchronous and their outputs can change at anytime– May have an enable input

• Flip-flops and Latches are both a type of multivibrator circuit

8

Page 9: Sequential Circuits - Flip Flops (Part 2)

Multivibrator

• Multivibrators are a group of regenerative circuits that are used extensively in timing applications

• It is a wave shaping circuit which gives symmetric or asymmetric square wave outputs

• It has two states either stable or quasi-stable depending on the type of multivibrator– Astable: not stable, no stable states– Monostable: one stable state– Bistable: two stable states

9

Page 10: Sequential Circuits - Flip Flops (Part 2)

Astable Multivibrator

• An astable multivibrator is a free running oscillator having two quasi-stable states.

• Thus, there is oscillation between these two states and no external signal is required to produce the change in state

10

Page 11: Sequential Circuits - Flip Flops (Part 2)

Monostable Multivibrator

• A monostable multivibrator is one which generates a single pulse of specified duration in response to each external trigger signal.

• It has only one stable state. • Application of a trigger causes a change to the

quasi-stable state.

11

0

1

0

1

Page 12: Sequential Circuits - Flip Flops (Part 2)

Bistable Multivibrator

• A bistable multivibrator is one that maintains a given output voltage level unless an external trigger is applied.

• Application of an external trigger signal causes a change of state, and this output level is maintained indefinitely until an second trigger is applied .

12

0

1

0

1

Page 13: Sequential Circuits - Flip Flops (Part 2)

Multivibrator Types

• Mechanical analogy:

13

Bistable Multivibrator

Monostable Multivibrator

Astable Multivibrator

flip-flop, Schmitt Trigger

one-shot

oscillator

S

R

T

Page 14: Sequential Circuits - Flip Flops (Part 2)

14

Clock Signal Parameters

• Very important with most sequential circuits– State variables change state at clock edge.

Page 15: Sequential Circuits - Flip Flops (Part 2)

15

Bistable Elements

• The simplest sequential circuit (note feedback)• Two states

– One state variable, say, Q

HIGH LOW

LOW HIGH

Q Stable at 0

Page 16: Sequential Circuits - Flip Flops (Part 2)

16

Bistable Elements

• The simplest sequential circuit (note feedback)• Two states

– One state variable, say, Q

LOW HIGH

HIGH LOW

Q Stable at 1

Page 17: Sequential Circuits - Flip Flops (Part 2)

17

Analog Analysis

• Assume pure CMOS thresholds, 5.0 V rail• Theoretical threshold center is 2.5 V

Page 18: Sequential Circuits - Flip Flops (Part 2)

18

Metastability

• Metastability is inherent in any bistable circuit

• Two stable points, one metastable point

Page 19: Sequential Circuits - Flip Flops (Part 2)

19

Analog Analysis

• Assume pure CMOS thresholds, 5.0 V rail• Theoretical threshold center is 2.5 V

2.5 V 2.5 V

2.5 V 2.5 V

Page 20: Sequential Circuits - Flip Flops (Part 2)

20

Analog Analysis

• Assume pure CMOS thresholds, 5.0 V rail• Theoretical threshold center is 2.5 V

2.5 V

2.5 V 2.5 V

2.0 V

2.0 V 4.8 V

2.5 V2.51 V4.8 V 0.0 V

0.0 V 5.0 V

Q Stable at 0

Page 21: Sequential Circuits - Flip Flops (Part 2)

21

Another Look at Metastability

• Another mechanical analogy for metastability

A small movement from metastability leads to stability.

Page 22: Sequential Circuits - Flip Flops (Part 2)

22

Why Worry About Metastability?

• All real systems are subject to it– Problems are caused by “asynchronous inputs”

that do not meet flip-flop setup and hold times

• Especially severe in high-speed systems– since clock periods are so short, “metastability

resolution time” can be longer than one clock period

• Many digital designers, products, and companies have been burned by this phenomenom

Page 23: Sequential Circuits - Flip Flops (Part 2)

23

Back to the Bistable Circuit• How to control it?

– add control inputs

• S-R latch

Function Table

Page 24: Sequential Circuits - Flip Flops (Part 2)

24

S-R Latch OperationNormal Inputs

Metastability is possibleif S and R are negatedsimultaneously.

S & R asserted simultaneously

Page 25: Sequential Circuits - Flip Flops (Part 2)

25

S-R Latch Timing Parameters

• Propagation delay• Minimum pulse width Metastability may also

occur if a pulse that is too short is applied to S or R.

Page 26: Sequential Circuits - Flip Flops (Part 2)

26

S-R Latch Symbols

Page 27: Sequential Circuits - Flip Flops (Part 2)

27

S_L-R_L Latch Using NAND Gates

• Active low inputs S_L & R_L

• When S_L = R_L = 1 latch remembers previous state

• When both are asserted outputs go to 1, not 0

Page 28: Sequential Circuits - Flip Flops (Part 2)

28

S-R Latch With Enable

• When C = 1, behaves as an S-R latch

• When C = 0, retains its previous state

• If both S & R = 1 when C changes from 1 to 0 it behaves as an S-R latch in which S & R are negated simultaneously- next state is unpredictable

EN

EN

Page 29: Sequential Circuits - Flip Flops (Part 2)

• S-R latches are useful in control applications, where we think in terms of setting a flag in response to some condition and resetting it when conditions change. So, we control the set and reset inputs somewhat independently.

• However, we often need latches simply to store bits of information- each bit is presented on a signal line, and we would like to store it somewhere. A D-latch may be used in such an application.

Page 30: Sequential Circuits - Flip Flops (Part 2)

30

D Latch or Data Flip-Flop• Inverter added to

generate S & R inputs from the D input

• Eliminates the situation where S & R may be asserted simultaneously

• The control input is sometimes named ENABLE, CLK or G.

• It may be active low in some designs

• Always has minimum pulse width requirement

Page 31: Sequential Circuits - Flip Flops (Part 2)

31

D Latch Operation

• Functional Behaviour

• When C is asserted Q follows D• Latch is open• The path between D & Q is transparent• Transparent latch• When C is negated latch closes, Q retains its last

value and does not change in response to D

Page 32: Sequential Circuits - Flip Flops (Part 2)

32

D Latch Timing Parameters

• Propagation delay (from C or D)• Setup time (D before C edge)• Hold time (D after C edge)

Page 33: Sequential Circuits - Flip Flops (Part 2)

Edge-Triggered D Flip-Flop

• Samples D input and changes its Q & QN output only on the rising edge of a controlling clock signal.

• Master is open and follows the input when CLK is 0• When CLK goes to 1 the Master is closed and its

output is transferred to the Slave which is open• The slave is open when CLK is 1, but changes only

at the beginning of the interval, as Master is closed

Page 34: Sequential Circuits - Flip Flops (Part 2)

Functional Behavior of PET D flip flop

Page 35: Sequential Circuits - Flip Flops (Part 2)

35

D Flip-Flop Timing Parameters

• Propagation delay (from CLK)• Setup time (D before CLK)• Hold time (D after CLK)

Page 36: Sequential Circuits - Flip Flops (Part 2)

36

J-K Flip-FlopsFunctional Equivalent

Page 37: Sequential Circuits - Flip Flops (Part 2)

JK Characteristic Table JK Excitation Table

J

00001111

K

00110011

Q

01010101

Q+

01001110

Q+

0101

Q

0011

J

01XX

K

XX10

JK / Q 0 1

00 0 1

01 0 0

11 1 0

10 1 1

K-Map for Q+

Q+ = J·Q' + K'·Q

JK Characteristic Eqn

Page 38: Sequential Circuits - Flip Flops (Part 2)

38

T or Toggle Flip-Flops

• Important for counters

Page 39: Sequential Circuits - Flip Flops (Part 2)

Summary of Flip-Flop Behavior

39

Page 40: Sequential Circuits - Flip Flops (Part 2)

40

Additional Definitions

• Clocked Synchronous Sequential Circuits– A.K.A. “finite state machines” or simply “state

machines” … or even “FSM”– Use edge-triggered flip-flops– All flip-flops are triggered from the same master

clock signal, and therefore all change state together

• Two types of finite state machines– Mealy Machines: output depends on state and

inputs– Moore Machines: output only depends on state

Page 41: Sequential Circuits - Flip Flops (Part 2)

41

State-Machine Structure: Mealy

typically edge-triggered D flip-flops

output depends onstate and input

Page 42: Sequential Circuits - Flip Flops (Part 2)

42

State-Machine Structure: Moore

output dependson state only

typically edge-triggered D flip-flops

Page 43: Sequential Circuits - Flip Flops (Part 2)

43

State-Machine Structure: Pipelined

• Often used in PLD-based state machines– Outputs taken directly from flip-flops, valid sooner

after clock edge– But the “output logic” must determine output value

one clock tick sooner (“pipelined”)

Page 44: Sequential Circuits - Flip Flops (Part 2)

44

Notation and Characteristic Equations

• Q+, Q*, Q(t+1) mean “the next value of Q”• “Excitation” is the input applied to a device

that determines the next state.• “Characteristic equation” specifies the next

state of a device as a function of its excitation.• S-R flip-flop : Q(t+1) = S + R · Q(t) • Edge-triggered D flip-flop: Q(t+1) = D • J-K flip-flop: Q(t+1) = J · Q(t) + K · Q(t)• T flip-flip: Q(t+1) = T + Q(t) = T · Q(t) + T · Q(t)

Page 45: Sequential Circuits - Flip Flops (Part 2)

Synchronous Analysis Process

1. Determine next-state function F and output function G

2. Use F and G to construct a state/output table that completely specifies the next state and output for every possible combination of current state and input.

3. (Optional) Draw state diagram that presents the information in graphical form.

45

Page 46: Sequential Circuits - Flip Flops (Part 2)

Detailed steps in the Analysis Process1. Determine the excitation equations for the flip flop

inputs

2. Substitute the excitation equations into the flip flop characteristic equations to obtain transition equations.

3. Use transition equations to construct transition table.

4. Determine the output equations.

5. Add output values to the transition table for each state (Moore) or state /input combination (Mealy) to create a transition/output table.

6. Name the states and substitute state names for state – variable combinations in the transition/output table to obtain the state/output table.

7. Draw a state diagram corresponding to the state/output table.