Feedback and Flip-Flops Philipp Koehn 7 September 2019 Philipp - - PowerPoint PPT Presentation

feedback and flip flops
SMART_READER_LITE
LIVE PREVIEW

Feedback and Flip-Flops Philipp Koehn 7 September 2019 Philipp - - PowerPoint PPT Presentation

Feedback and Flip-Flops Philipp Koehn 7 September 2019 Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019 The Story So Far 1 We can encode numbers We can do calculation ... but its all a bit


slide-1
SLIDE 1

Feedback and Flip-Flops

Philipp Koehn 7 September 2019

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-2
SLIDE 2

1

The Story So Far

  • We can encode numbers
  • We can do calculation
  • ...

but it’s all a bit static

  • How about a counter?

→ this requires "memory"

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-3
SLIDE 3

2

feedback

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-4
SLIDE 4

3

A Strange Contraption

  • +

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-5
SLIDE 5

4

Let’s Turn It On

  • +

Electricity is on → this opens the normally closed key

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-6
SLIDE 6

5

Let’s Turn It On

  • +

Electricity is off → this closes the normally closed key

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-7
SLIDE 7

6

What Do We Have?

  • A Buzzer
  • A Clock
  • An Oscillator

NOT

(symbol)

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-8
SLIDE 8

7

Oscillator

  • Period of oscillator
  • Frequency:

cycles per second

  • Unit:

1 cycle per second: 1 Hertz

  • Modern computes:

Billions of Hertz = Gigahertz (GHz) Heinrich Hertz 1857--1894

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-9
SLIDE 9

8

flip flop

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-10
SLIDE 10

9

Another Contraption

V V

NOR NOR

OUT

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-11
SLIDE 11

10

Closing Upper Key

V V

NOR NOR

OUT

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-12
SLIDE 12

11

Opening Upper Key

V V

NOR NOR

OUT

Same key configuration as initially But: Now OUT is on --- we remembered the key turn

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-13
SLIDE 13

12

Closing Lower Key

V V

NOR NOR

OUT

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-14
SLIDE 14

13

Opening Lower Key

V V

NOR NOR

OUT

Back to initial state

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-15
SLIDE 15

14

Memory

  • We have memory -- called Reset-Set Flip-Flop
  • Truth table

UPPER LOWER OUT OUT 1 1 1 1 1 Illegal

  • UPPER = SET
  • LOWER = RESET

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-16
SLIDE 16

15

Re-Arranged

NOR NOR

Q S R

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-17
SLIDE 17

16

Symmetric

NOR NOR

Q Q S R

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-18
SLIDE 18

17

Truth Table S R Q ¯ Q 1 1 1 1 Q ¯ Q 1 1 Illegal

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-19
SLIDE 19

18

d-type flip flop

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-20
SLIDE 20

19

Vision

  • Control bit ("clock")

– on = write to memory – off = read from memory

  • Data bit

– data item to be written

  • Output

– current state of the memory

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-21
SLIDE 21

20

Replace Set/Reset with Data

NOR NOR

Q Q DATA

NOT

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-22
SLIDE 22

21

Add Control Bit ("Clock")

Q Q DATA

NOT

AND AND NOR NOR

CLOCK

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-23
SLIDE 23

22

D-Type Flip-Flop

  • Also called D-type latch
  • Circuit latches on one bit of memory and keeps it around
  • Truth table

Data Clock Q ¯ Q 1 1 1 1 1 X Q ¯ Q

  • Can also build these for multiple data bits

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-24
SLIDE 24

23

accumulative adder

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-25
SLIDE 25

24

Design Goal

  • Adder has initially value 0
  • Adding a number

→ value increases

  • Resetting

→ value goes back to 0

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-26
SLIDE 26

25

Ingredients

8-BIT ADDER

A7 A6 A5 A4 A3 A2 A1 A0 B7 B6 B5 B4 B3 B2 B1 B0 S7 S6 S5 S4 S3 S2 S1 S0 CO CI

8-BIT LATCH

D7 D6 D5 D4 D3 D2 D1 D0 Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 CLK

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-27
SLIDE 27

26

Ingredients

8

8-BIT ADDER

A B S CO CI

8 8 8

8-BIT LATCH

D Q CLK

8

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-28
SLIDE 28

27

Building an Accumulative Adder

8 8 8-BIT LATCH

D Q CLK

CLOCK

  • Latch:

current sum

  • Clock on → set it to 0

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-29
SLIDE 29

28

Building an Accumulative Adder

8 8 8 8-BIT LATCH

D Q CLK

8-BIT ADDER

B S A CO

8

IN

CI

CLOCK OUT

  • Adder
  • Combines

– current value – selected input

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-30
SLIDE 30

29

Building an Accumulative Adder

8 8 8 8-BIT LATCH

D Q CLK

8-BIT ADDER

B S A CO

8

IN

CI

CLOCK OUT

  • Can we pass output

directly to latch?

  • Concerns

– select between 0 and sum – only stored when clock on

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-31
SLIDE 31

30

Building an Accumulative Adder

8 8 8 8-BIT LATCH

D Q CLK

8-BIT ADDER

B S A CO

8

IN

CI

CLOCK OUT

2-1 SELECTOR

B S A

8 8

Clear

  • 2-1 selector
  • Either uses 0 or sum
  • Built with AND gates
  • Still have runaway feedback loop...

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-32
SLIDE 32

31

Building an Accumulative Adder

8 8 8 8 8-BIT LATCH

D Q CLK

8-BIT ADDER

B S A CO

8

IN

CI

CLOCK2 OUT

2-1 SELECTOR

B S A

8 8 8-BIT LATCH

D Q CLK

CLOCK1

S

Clear

  • Two Latches

– one to store the sum – one to store input to adder

  • Clock 1

– carry out addition – store result

  • Clock 2

– transfer to set up next addition

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-33
SLIDE 33

32

Building an Accumulative Adder

8 8 8 8 8-BIT LATCH

D Q CLK

8-BIT ADDER

B S A CO

8

IN

CI

OUT

2-1 SELECTOR

B S A

8 8 8-BIT LATCH

D Q CLK S

NOT

Add Clear

  • Combine the clocks
  • Pressing the add key

– carry out addition – store result in upper latch

  • Release the add key

– transfer to lower latch – set up next addition

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-34
SLIDE 34

33

What Else?

8 8 8 8 8-BIT LATCH

D Q CLK

8-BIT ADDER

B S A CO

8

IN

CI

OUT

2-1 SELECTOR

B S A

8 8 8-BIT LATCH

D Q CLK S

NOT

Add Clear

  • Remember the oscillator?

NOT

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-35
SLIDE 35

34

What Else?

8 8 8 8 8-BIT LATCH

D Q CLK

8-BIT ADDER

B S A CO

8

IN

CI

OUT

2-1 SELECTOR

B S A

8 8 8-BIT LATCH

D Q CLK S

NOT

Clear

NOT

  • Each cycle of oscillator:

keeps adding

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-36
SLIDE 36

35

What Else?

8 8 8 8 8-BIT LATCH

D Q CLK

8-BIT ADDER

B S A CO

8

IN

CI

OUT

2-1 SELECTOR

B S A

8 8 8-BIT LATCH

D Q CLK S

NOT

Clear

NOT

  • We have something interesting here

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-37
SLIDE 37

36

edge triggered flip-flop

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-38
SLIDE 38

37

D-Type Latch

LATCH D CLK Q Q

  • When clock is on, save data
  • "Level-triggered"

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-39
SLIDE 39

38

D-Type Latch

LATCH D CLK Q Q LATCH D CLK Q Q NOT

  • "Edge-triggered":

changes value, when switched from 0 to 1

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-40
SLIDE 40

39

Edge Triggered D-Type Latch

D > CLK Q Q

Symbol

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-41
SLIDE 41

40

Truth Table Data Clock Q ¯ Q ↑ 1 1 ↑ 1 X Q ¯ Q

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-42
SLIDE 42

41

ripple counter

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-43
SLIDE 43

42

Oscillator and Latch

D > CLK Q Q NOT

Data Clock Q ¯ Q 1 1 1 ↑ 1 1 1 1 ↑ 1 1 1 1 1 1

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-44
SLIDE 44

43

Oscillator and Latch

D > CLK Q Q NOT

Data Clock Q ¯ Q 1 1 1 ↑ 1 1 1 1 ↑ 1 1 1 1 1 1

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-45
SLIDE 45

44

Halving of Frequency

Data Clock Q ¯ Q 1 1 1 ↑ 1 1 1 1 ↑ 1 1 1 1 1 1

IN OUT

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-46
SLIDE 46

45

Multiple Bits

D > CLK Q Q NOT NOT

OUT0 OUT1

D > CLK Q Q

OUT2

D > CLK Q Q

OUT3

OUT0 OUT1 OUT2 OUT3

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019

slide-47
SLIDE 47

46

Ripple Counter

OUT0 OUT1 OUT2 OUT3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Philipp Koehn Computer Systems Fundamental: Feedback and Flip-Flops 7 September 2019