Learning Outcomes I understand the difference between level- - - PowerPoint PPT Presentation

learning outcomes
SMART_READER_LITE
LIVE PREVIEW

Learning Outcomes I understand the difference between level- - - PowerPoint PPT Presentation

13.1 13.2 Learning Outcomes I understand the difference between level- sensitive and edge-sensitive Unit 13 I understand how to create an edge-triggered FF from 2 latches Sequential Logic Constructs 13.3 13.4 Sequential Logic


slide-1
SLIDE 1

13.1

Unit 13

Sequential Logic Constructs

13.2

Learning Outcomes

  • I understand the difference between level-

sensitive and edge-sensitive

  • I understand how to create an edge-triggered

FF from 2 latches

13.3

BISTABLES, LATCHES, AND FLIP- FLOPS

How sequential building blocks work

13.4

Sequential Logic

  • Suppose we have a sequence of input numbers on X[3:0] that

are entered over time that we want to sum up

  • Possible solution: Route the outputs ________________ so

we can add the current sum to the input X

9, 3, 2 X[3:0] 14,5,2 Z[3:0]

A0 A1 A2 A3 B0 B1 B2 B3 S0 S1 S2 S3 Adder

slide-2
SLIDE 2

13.5

Sequential Logic

  • Suppose we have a sequence of input numbers on X[3:0] that

are entered over time that we want to sum up

  • Possible solution: Route the outputs back to the inputs so we

can add the current sum to the input X

  • Problem 1: No way to

_________________

  • Problem 2: Outputs can

_____________ to inputs and be added more than once per input number

Possible Solution

Outputs can feedback to inputs and update them sum more than once per input

A0 A1 A2 A3 B0 B1 B2 B3 S0 S1 S2 S3 Adder X0 X1 X2 X3 Z0 Z1 Z2 Z3

9, 3, 2

13.6

Sequential Logic

  • Add logic at outputs to just capture and remember the new

sum until we’re ready to input the next number in the sequence

This logic should remember (i.e. sequential logic) the sum and only update it when the next number arrives

9, 3, 2

The data can still loop around and add up again (2+2=4) but if we just hold our output = 2 then the feedback loop will be broken We remember initial sum

  • f 2 until input 3 arrives

at which point we’d capture & remember the sum 5. A0 A1 A2 A3 B0 B1 B2 B3 S0 S1 S2 S3 Adder X0 X1 X2 X3 Z0 Z1 Z2 Z3 13.7

Sequence Adder

  • If X changes _____________ then Z should also

change once per cycle

  • That is why we will use ___________________ to

ensure the outputs can only update once per cycle

A0 A1 A2 A3 B0 B1 B2 B3 S0 S1 S2 S3 4-bit Adder X0 X1 X2 X3 D

CLR

Q D Q D Q D Q Clock Y0 Y1 Y2 Y3 Z0 Z1 Z2 Z3

CLR CLR CLR

Reset

13.8

Sequence Adder

time

  • The Reset (aka Clear) input on the FFs will cause Z to be initialized

to 0, but then Z can’t change until the next positive edge

  • That means we will just keep adding 0 + 2 = 2

X 2 Clock 3 9 Reset Y Z 2

2 2

A0 A1 A2 A3 B0 B1 B2 B3 S0 S1 S2 S3 4-bit Adder X0 X1 X2 X3 D

CLR

Q D Q D Q D Q Clock Y0 Y1 Y2 Y3 Z0 Z1 Z2 Z3

CLR CLR CLR

Reset

slide-3
SLIDE 3

13.9

Sequence Adder

time

  • At the edge the flip-flops will sample the D inputs and then

remember 2 until the next positive edge

  • That means we will just keep adding 3 + 2 = 5

X 2 Clock 3 9 Reset

5 2 2 3

Y Z 2 5 2

A0 A1 A2 A3 B0 B1 B2 B3 S0 S1 S2 S3 4-bit Adder X0 X1 X2 X3 D

CLR

Q D Q D Q D Q Clock Y0 Y1 Y2 Y3 Z0 Z1 Z2 Z3

CLR CLR CLR

Reset

13.10

Sequence Adder

time

  • Finally, at the positive edge the flip-flops will sample

the D inputs and then remember 14

X 2 Clock 3 9 Reset

14

Y 2 5 14 Z 2 5 14

A0 A1 A2 A3 B0 B1 B2 B3 S0 S1 S2 S3 4-bit Adder X0 X1 X2 X3 D

CLR

Q D Q D Q D Q Clock Y0 Y1 Y2 Y3 Z0 Z1 Z2 Z3

CLR CLR CLR

Reset

13.11

Sequential Logic

  • But how do flip-flops work?
  • Our first goal will be to design a circuit that

can remember one bit of information

  • Easiest approach…
  • But how do you change the input?

– A signal should only have one driver

13.12

D-Latches

  • The primary building block of sequential logic is a

D-Latch

  • D-Latches (Data latches) store/remember/hold

data when the clock is _______________ and ____ data when the clock is _______ (CLK=___)

D-Latch

Q D CLK

Closed when CLK=1 Closed when CLK=0

Q

These "switches" which can be closed or open are really transistors that can be on or off

slide-4
SLIDE 4

13.13

Transparent & Hold Mode of D-Latches

  • The D-Latch operates in either

____________ or ________ mode based on the clock value

Q D CLK

When Clock = 1

Q Q D CLK

When Clock = 0

Q

Transparent Mode (Q=D when CLK=1) Hold Mode (Q=Q0 when CLK=0) C D Q Q’ x Q0 Q0’ 1 1 1 1 1 Function Table Description of D-Latch

13.14

D-Latches

C D Q Q’ x Q0 Q0’ 1 1 1 1 1 Hold Mode Hold Mode Transparent Mode D C Q Q’ D Latch

13.15

D-Latches

C D Q Q’ x Q0 Q0’ 1 1 1 1 1 When C=1,

  • utputs

change based

  • n inputs

When C=0, outputs don’t change no matter what the inputs do Hold Mode Hold Mode Transparent Mode

CLK D Q

D C Q Q’ D Latch

13.16

Notation

  • To show that Q remembers its value we can put

it in the past tense:

– Q = Q0 (Current Value of Q = Old Value of Q)

  • OR put it in the future tense

– Q* = Q (Next Value of Q = Current Value of Q)

C D Q* Q’* x Q Q’ 1 1 1 1 1 C D Q Q’ x Q0 Q0’ 1 1 1 1 1

Indicates “next-value”

  • f Q

Current Value = Old Value Next Value = Current Value

slide-5
SLIDE 5

13.17

Adding a Sequence of Numbers

  • What if we put D-Latches at the outputs

A0 A1 A2 A3 B0 B1 B2 B3 S0 S1 S2 S3 Adder X0 X1 X2 X3 D C Q D C Q D C Q D C Q Clock Y0 Y1 Y2 Y3 Z0 Z1 Z2 Z3

13.18

Adding a Sequence of Numbers

  • We’ll change X on every clock period

Clock X 3 2 When C=0 => Q* = Q When C=1 => Q* = D

A0 A1 A2 A3 B0 B1 B2 B3 S0 S1 S2 S3 Adder X0 X1 X2 X3 D C Q D C Q D C Q D C Q Clock Y0 Y1 Y2 Y3 Z0 Z1 Z2 Z3

13.19

Adding a Sequence of Numbers

  • Since the clock starts off low, the outputs of the

latches can’t change and just hold at 0

Clock X 3 2 When C=0 => Q* = Q When C=1 => Q* = D 2 Y Z

2 2

time

A0 A1 A2 A3 B0 B1 B2 B3 S0 S1 S2 S3 Adder X0 X1 X2 X3 D C Q D C Q D C Q D C Q Clock Y0 Y1 Y2 Y3 Z0 Z1 Z2 Z3

13.20

Adding a Sequence of Numbers

  • When the clock goes high the D goes through to Q

and is free to loop back around

Clock X 3 2 When C=0 => Q* = Q When C=1 => Q* = D 2 Y Z

2 2

time 2

2

A0 A1 A2 A3 B0 B1 B2 B3 S0 S1 S2 S3 Adder X0 X1 X2 X3 D C Q D C Q D C Q D C Q Clock Y0 Y1 Y2 Y3 Z0 Z1 Z2 Z3

slide-6
SLIDE 6

13.21

Adding a Sequence of Numbers

  • Once it loops back around it will be added again, change the

Y value and go through to Z and loop back around again

Clock X 3 2 When C=0 => Q* = Q When C=1 => Q* = D 2 Y Z

2 4

time 2

4

4 4

4

A0 A1 A2 A3 B0 B1 B2 B3 S0 S1 S2 S3 Adder X0 X1 X2 X3 D C Q D C Q D C Q D C Q Clock Y0 Y1 Y2 Y3 Z0 Z1 Z2 Z3

13.22

Adding a Sequence of Numbers

  • This feedback loop continues until the clock goes

low again

Clock X 3 2 When C=0 => Q* = Q When C=1 => Q* = D 2 Y Z

2 6

time 2

6

4 4

8

6 6 8 8

A0 A1 A2 A3 B0 B1 B2 B3 S0 S1 S2 S3 Adder X0 X1 X2 X3 D C Q D C Q D C Q D C Q Clock Y0 Y1 Y2 Y3 Z0 Z1 Z2 Z3

13.23

Adding a Sequence of Numbers

  • When the clock goes low again, the outputs will hold at their

current value 8 until the clock goes high

Clock X 3 2 When C=0 => Q* = Q When C=1 => Q* = D 2 Y Z

3 8

time 2

8

4 4

11

6 6 8 8 11

A0 A1 A2 A3 B0 B1 B2 B3 S0 S1 S2 S3 Adder X0 X1 X2 X3 D C Q D C Q D C Q D C Q Clock Y0 Y1 Y2 Y3 Z0 Z1 Z2 Z3

13.24

Adding a Sequence of Numbers

  • When the clock goes high, the outputs will be free to change

and we will get the feedback problem

When C=0 => Q* = Q When C=1 => Q* = D

3 8

time

8 11

X 3 2 2 4 6 2 4 6 8 Y Z 11

14 17 20

8

11 14 17 20

Clock

A0 A1 A2 A3 B0 B1 B2 B3 S0 S1 S2 S3 Adder X0 X1 X2 X3 D C Q D C Q D C Q D C Q Clock Y0 Y1 Y2 Y3 Z0 Z1 Z2 Z3

slide-7
SLIDE 7

13.25

Adding a Sequence of Numbers

  • Latches clearly don’t work
  • The goal should be to get one change of the outputs per

clock period

When C=0 => Q* = Q When C=1 => Q* = D

3 8

time

8 11

X 3 2 2 4 6 2 4 6 8 Y Z 11

14 17 20

8

11 14 17 20

Clock

A0 A1 A2 A3 B0 B1 B2 B3 S0 S1 S2 S3 Adder X0 X1 X2 X3 D C Q D C Q D C Q D C Q Clock Y0 Y1 Y2 Y3 Z0 Z1 Z2 Z3

13.26

FLIP-FLOPS

13.27

Flip-Flops vs. Latches

Flip-Flops

  • Synchronous
  • Clock Input
  • Edge Sensitive

– Outputs change

  • nly on the

positive (negative) edges

Latches

  • Asynchronous
  • Clock/Enable input
  • Level Sensitive

– Action of the device is dependent

  • n the level of the clock

– Outputs can change anytime Clock = 1

D Q Q CLK D-Latch D Q Q CLK D-FF

13.28

Flip-Flops

  • Change D Latches to D Flip-Flops

Triangle at clock input indicates edge- sensitive FF

D C Q Q D-Latch D Q Q CLK D-FF

slide-8
SLIDE 8

13.29

Flip-Flops

  • To indicate negative-edge triggered use a bubble in

front of the clock input

Bubble indicates negative-edge triggered No bubble indicates positive-edge triggered Positive-Edge Triggered D-FF Negative-Edge Triggered D-FF

D Q Q CLK D-FF D Q Q CLK D-FF

13.30

Positive-Edge Triggered D-FF

  • Q looks at D only at

the positive-edge

CLK D Q* Q’* x Q Q’ 1 x Q Q’ ↑ 1 ↑ 1 1

Q only samples D at the positive edges and then holds that value until the next edge

CLK D Q

13.31

Negative-Edge Triggered D-FF

  • Q looks at D only at

the negative-edge

CLK D Q* Q’* x Q Q’ 1 x Q Q’ ↓ 1 ↓ 1 1

Q only samples D at the negative edges and then holds that value until the next edge

CLK D Q

13.32

D FF Example

  • Assume positive edge-triggered FF
slide-9
SLIDE 9

13.33

Shift Register

  • A shift register is a device that acts as a

‘queue’ or ‘FIFO’ (First-in, First-Out).

  • It can store n bits and each bit moves one step

forward each clock cycle

– One bit comes in the overall input per clock – One bit ‘falls out’ the output per clock

13.34

Shift Register

  • Can we build a shift register from latches?

13.35

Shift Register

When we want to ensure an output updates only ONCE per clock, we need to use flip-flops (not latches or bistables)!

  • Can we build a shift register from flip-flops?

13.36

BUILDING A FLIP FLOP

slide-10
SLIDE 10

13.37

Building an Edge-Triggered Device

  • We generally build FFs from

latches

  • To build a device that can only

change at 1 instant (clock edge) we can:

– Try to only enable 1 latch for a small __________ in time – Use two latches running on ___________ clock phases

Door opening and closing almost instantly Input Queue Two door system (when 1 is open the

  • ther is closed)

13.38

Leader-Follower D-FF

  • To build an edge-triggered D-FF we can use two

D-Latches

– The configuration below forms a negative-edge triggered FF

These 2 latches form a flip-flop D C Q

Clock Q

Q’ D C Q Q’

Q’ D

Leader Follower

13.39

Complete the Waveform

D C Q

Clock Q

Q’ D C Q Q’

Q’ D

Leader Follower

CLK D QLeader QFollower 1 3 5 7

13.40

Leader-Follower D-FF

  • To implement a positive edge-triggered D-FF

change the clock inversion

Negative-Edge Triggered Positive-Edge Triggered

D C Q

Clock Q

Q’ D C Q Q’

Q’ D

Leader Follower D C Q

Clock Q

Q’ D C Q Q’

Q’ D

Leader Follower

slide-11
SLIDE 11

13.41

INITIALIZING OUTPUTS

13.42

Initializing Outputs

  • Need to be able to initialize Q to a ________ value (0 or 1)
  • FF inputs are often connected to logic that will produce values

after initialization

  • Two ___________ are often included: (PRE)SET and CLEAR

Logic

When CLEAR = on Q*=_____ When SET = on Q*=____ When NEITHER are on _______ FF operation

Note: CLR and SET have ________ over normal FF inputs D Q

SET CLR

CLK

13.43

Initializing Outputs

  • To help us initialize our FF’s use a RESET signal

– Generally produced for us and given along with CLK

  • It starts at Active (1) when power _________ and

then goes to Inactive (0) for the _____________

  • When it’s active, use it to initialize the FF’s and then

it will go inactive for the rest of time and the FF’s will work based on their inputs

Active (1) at time=0 Inactive (0) for the rest of time

RESET

13.44

Initializing Outputs

  • Suppose we want our FF to initialize to 0 when the power turns on

– Connect _________ to the CLR input – Connect _________ to the SET input Logic

_______ ___

RESET

Q* = 0 1 D Q

SET CLR

CLK

Logic

_______ ___ Q* = D D Q

SET CLR

CLK

When RESET = 0, CLR is inactive and Q looks at D at each clock edge When RESET = 1, CLR is active and Q is forced to 0 regardless of D

slide-12
SLIDE 12

13.45

Implementing an Initial State

  • When RESET is activated: Q’s initialize to 0
  • When RESET is deactivated: Q’s look at the D inputs

Forces Q’s to 0 because it’s connected to the CLR inputs Once RESET goes to 0, the FF’s look at the D inputs

RESET Q0 Q1 ... ...

13.46

Synchronous vs. Asynchronous

  • The new preset and clear inputs can be built to be synchronous
  • r asynchronous
  • These terms refer to when the initialization takes place

– Asynchronous…initialize as soon as signal is activated – Synchronous…initialize at clock edge

Asynchronous Synchronous

Clock Q’s Clock CLR Q’s Synchronous SET or CLR means the signal must be active at a clock edge before Q will initialize CLR Asynchronous SET or CLR means Q will initialize as soon as the SET or CLR signal is activated

13.47

Set / Clear Example

  • Complete the waveform for a D-FF with

asynchronous SET and CLR

1 3 5 7 D CLK Q CLR SET

13.48

Exercise

D Q Q D Q Q Q0 Q1 D0 D1 X CLK F

SET CLR RESET SET CLR RESET

Q0 Q1

CLK X RESET D0 Q0 D1 Q1 F