logic design cs221 1 st term 2009-2010 sequential circuits cairo university faculty of computers and...

35
Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

Upload: abel-mccoy

Post on 27-Dec-2015

220 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

Logic DesignCS221

1st Term 2009-2010

sequential circuitssequential circuits

Cairo University

Faculty of Computers and Information

Page 2: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 2

Administrivia GA: Makeup lecture tomorrow 11:15 in 260 homework #2 due next Saturday in lecture mid-term: Nov. 17th in lecture

similar questions to section, homework, and game covers lectures until today's lecture

course web site: http://www.fci-cu.edu.eg/~skhattab/cs221/

Page 3: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 3

sequential-circuit design state diagram state table K-maps logic circuit

Page 4: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 4

D flip-flop

Page 5: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 5

Example 1: rotating lights

Page 6: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 6

state diagram

leftON

middle

ONspace

rightONspace

space

Page 7: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 7

binary coding of inputs and state three states => 2 bits A, B

00, 01, 10 one input: S three outputs: X, Y, Z

Page 8: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 8

state diagram

00/100

01/010S

10/001S

S

Page 9: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 9

state table

A B S A B X Y Z

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

0 0 1 0 0

0 1 1 0 0

0 1 0 1 0

1 0 0 1 0

1 0 0 0 1

0 0 0 0 1

x x x x x

x x x x x

Page 10: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 10

K-map

A(t+1) = BS + AS'

Page 11: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 11

state table

A B S A B X Y Z

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

0 0 1 0 0

0 1 1 0 0

0 1 0 1 0

1 0 0 1 0

1 0 0 0 1

0 0 0 0 1

x x x x x

x x x x x

Page 12: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 12

K-map

B(t+1) = BS' + A'B'S

Page 13: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 13

state table

A B S A B X Y Z

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

0 0 1 0 0

0 1 1 0 0

0 1 0 1 0

1 0 0 1 0

1 0 0 0 1

0 0 0 0 1

x x x x x

x x x x x

Page 14: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 14

K-map

X(t+1) = A'B'

Page 15: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 15

state table

A B S A B X Y Z

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

0 0 1 0 0

0 1 1 0 0

0 1 0 1 0

1 0 0 1 0

1 0 0 0 1

0 0 0 0 1

x x x x x

x x x x x

Page 16: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 16

state tableY = B

Page 17: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 17

state table

A B S A B X Y Z

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

0 0 1 0 0

0 1 1 0 0

0 1 0 1 0

1 0 0 1 0

1 0 0 0 1

0 0 0 0 1

x x x x x

x x x x x

Page 18: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 18

state tableZ = A

Page 19: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 19

D flip-flop

next state present state

Page 20: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 20

logic diagram

Page 21: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 21

Logic Diagram

Page 22: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 22

example 2: 4x4 LED matrix

Page 23: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 23

binary coding of inputs and state 16 states => 4 bits A, B, C, D

0000, 0001, ...., 1111 4 inputs: U, D, R, L 16 outputs: L0, L1, ...., L15

Page 24: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 24

state diagram0000/

L0=1

0001 0010 0011R R R

LLL

R

0100 0101 0110 0111

1000 1001 1010 1011

1100 1101 1110 1111

U

U

U

U

D

D

D

D

L

R

Page 25: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 25

state table

A B C D U D R L A B C D L0 L1 L2 L3 ... 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 .... 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 ....

0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 ....

0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 ....

256 rows 8 variables!

cannot use K-map!

Page 26: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 26

outputs logic-equations present state 0000 => L0 = 1 present state 0001 => L1 = 1 present state 0010 => L2 = 1

outputs L0–L15 depend only on present state 4 variables => can use K-map for the outputs

Page 27: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 27

n-to-m-line decoder A binary code of n bits can represent up to 2n

distinct items decoder circuit:

converts a binary number to corresponding item e.g., 0000 => item # 0 0001 => item # 1

n-to-m-line decoder m <= 2n

Page 28: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 28

3-to-8-line decodertruth table

Page 29: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 29

3-to-8-line decoderlogic diagram

Page 30: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 30

back to our LED circuit

4-to-16-line

decoder

A

B

C

D

L0L1

L2

L3

L4L5

L6

L7

L8L9

L10

L11

L12

L14

L15

L13

pre

sen

t st

ate

Page 31: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 31

next-state logic equations next state = present state + something

if no button pressed: add 0000 if R button pressed: add 0001 if D button pressed: add 0100 if L button pressed: subtract 1 => add 1111 if U button pressed: subtract 0100 => add 1100 if R and D buttons pressed => add 0000 if more than one button pressed => add 0000

Page 32: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 32

next-state

4-bit adder

present state

something

next statecarry

combinational circuit

UDLR

combinational

circuit (C)

s0 s1 s2 s3

Page 33: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 33

truth table for circuit C

Page 34: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 34

logic equations S0 = U'D'R'L + UD'R'L' S1 = U'D'R'L + U'DR'L' + UD'R'L' S2 = U'D'R'L S3 = U'D'R'L + U'D'RL'

Page 35: Logic Design CS221 1 st Term 2009-2010 sequential circuits Cairo University Faculty of Computers and Information

24/10/2009 cs221 – sherif khattab 35

whole circuit

4-bit adder

present state

something

next statecarry

combinational circuit

UDLR

combinational

circuit (C)

s0 s1 s2 s3