1 sequential logic the forbidden zone ellen spertus mcs 111 september 10 and 12, 2002

39
1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

Upload: osborn-edwards

Post on 20-Jan-2018

216 views

Category:

Documents


0 download

DESCRIPTION

3 Combinational logic Everything we’ve done so far Outputs depend only on the inputs No cycles (loops)

TRANSCRIPT

Page 1: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

1

Sequential LogicThe Forbidden Zone

Ellen SpertusMCS 111

September 10 and 12, 2002

Page 2: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

2

What does a computer do?

Calculates mathematical functions Allows different operations to be

specified• • •

Page 3: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

3

Combinational logic

• Everything we’ve done so far• Outputs depend only on the inputs• No cycles (loops)

A

B

C

Y

Page 4: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

4

Sequential logic

• What we’ll look at this week• Outputs depend on

– inputs– previous values (“state”)

• Cycles (loops) in circuits • Purpose?

Page 5: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

5

Useful memory unit

• Remember old value• Set to high• Reset to low

Page 6: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

6

RS-latch symbol and truth table

R S Q(n+1) ~Q(n+1) 0 0 Q(n) ~Q(n) 0 1 1 0 1 0 0 1 1 1 0 0

RS

Q~Q

Q = R + ~Q

~Q = S + Q

Page 7: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

7

RS-latch implementation

R

S

Q

~Q

Q = R + ~Q

~Q = S + Q

Page 8: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

8

RS-latch timing diagram

R

S

~Q1

0

1

0Q

1

0

1

0

Page 9: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

9

RS-latch dangerous transition

R

S

Q

~Q

1 0

1 0 0

0

Page 10: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

10

Low-level summary

• Meaning of RS?– R– S

• Behavior– R=0, S=0 – R=0, S=1 – R=1, S=0 – R=1, S=1

Page 11: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

11

High-level summary: RS latch

• Capabilities:

• Limitations:

• What improvements would we like?

Page 12: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

12

Preventing forbidden transition

How can we prevent R and S from simultaneously changing from 1 to 0?

R

S

Q

~Q

Page 13: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

13

D-latch

R

S

Q

~QDE

Page 14: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

14

D-latch behavior

D E R S behavior 0 0 0 1 1 0 1 1

Page 15: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

15

Page 16: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

16

4-bit D-latchenable

data Q

~QD

enable

data Q

~QD

enable

data Q

~QD

enable

data Q

~QD

enable

data Q

~QD

Page 17: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

17

Counter: first attempt

enable

data QD

latch

ALU

1

44

4

4

clock

Page 18: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

Behind the Curtain 18

Behind the curtain

Page 19: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

Behind the Curtain 19

Representation of 0s and 1s

• Logical zero (false): 0 – .8 Volts• Logical one (high): 2 – 5 Volts

• What is:• .4 Volts• 3.5 Volts• 1.2 Volts

Page 20: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

Behind the Curtain 20

The Forbidden Zone A range of voltages that represent

neither zero nor one; specifically:

Page 21: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

Behind the Curtain 21

Inverter (not gate) behavior• If input voltage is low, output is: • If input voltage is high, output is:• In input voltage is in between, output is:

0 5

0

5

Page 22: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

Behind the Curtain 22

How to deal with forbidden zone?

• Never allow any point in the circuit to have a voltage in the forbidden zone.

Page 23: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

Behind the Curtain 23

A closer look at a “square” wave

time

volta

ge

Page 24: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

Behind the Curtain 24

We can’t avoid the forbidden zone

You can’t get from here to there without going in between.

Page 25: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

Behind the Curtain 25

How to deal with forbidden zone?

• Never allow any point in the circuit to have a voltage in the forbidden zone.

• Never allow a value in the forbidden zone to be an input to a gate.

Page 26: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

Behind the Curtain 26

Propagation delays

• Every gate has a propagation delay, the time it takes to make the complete transition.

• During this period, the result may be in the forbidden zone.

• After the propagation delay, the result will not be in the forbidden zone.

Page 27: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

Behind the Curtain 27

Combined propagation delays If each gate has a propagation delay of

5 ns, what is the total propagation delay?

Meaning:

A

B

C

Page 28: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

Behind the Curtain 28

How to deal with forbidden zone?

• Never allow any point in the circuit to have a voltage in the forbidden zone.

• Never allow a value in the forbidden zone to be an input to a gate.

Don’t look at an output until after the propagation delay.

Page 29: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

29

Counter: first attempt

enable

data QD

latch

ALU

1

44

4

4

clock

Page 30: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

30

The problem

If we have cycles in our circuit, values in the forbidden region will propagate through the circuit, contaminating all data.

Page 31: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

31

How to deal with forbidden zone?

Don’t look at an output until after the propagation delay- If no loops, just wait out propagation delay- If loops, insert a barrier to prevent

forbidden values from contaminating the rest of the circuit

Page 32: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

32

D flip-flop

QD

~Q

data Q data Qdata

enable enable

clock

Q

Page 33: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

33

D flip-flop behavior

• Only accept new data when

• Otherwise, keep the same data

Page 34: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

34

Counter: correct

data QD

flipflop

ALU

1

44

4

4

clock

Page 35: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

35

Counter: correct (close-up)Q0

Dflipflop

ALU

1

4

clock

Q1Q2

Q3

D3 D2 D1 D0

D3

D1D0

D2

Page 36: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

36

Timing diagram

Clock

Q0

D01

0

1

0

1

0

Page 37: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

37

LS377: octal D-type flip-flop

• OE = output enable (active low)• Inputs D7-D0• Outputs Q7-Q0• Clock input

Page 38: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

38

Wiring diagrams

• Shows logical shape• Has chip number• Includes pin numbers

in logical order (outside chip)

• Includes signal names (inside chip)

• Bubble indicates active-low input

• “nc” stands for:

d0d1d2d3

d7..d4

3478

nc

q0q1q2q3

d7..d4

2569

nc

enable

1

LS377

11

Page 39: 1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002

39

Looking ahead

• Assignments– Lab 1 due tomorrow (September 13)– Homework 3 due Tuesday (September 19)– Lab 2 due next Friday (September 20)

• Topics– You now know the basics– Start studying assembly language from

Hennessy and Patterson