logic design cs221 1 st term 2009-2010 sequential circuits cairo university faculty of computers and...
Post on 27-Dec-2015
220 Views
Preview:
TRANSCRIPT
Logic DesignCS221
1st Term 2009-2010
sequential circuitssequential 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/
24/10/2009 cs221 – sherif khattab 3
sequential-circuit design state diagram state table K-maps logic circuit
24/10/2009 cs221 – sherif khattab 4
D flip-flop
24/10/2009 cs221 – sherif khattab 5
Example 1: rotating lights
24/10/2009 cs221 – sherif khattab 6
state diagram
leftON
middle
ONspace
rightONspace
space
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
24/10/2009 cs221 – sherif khattab 8
state diagram
00/100
01/010S
10/001S
S
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
24/10/2009 cs221 – sherif khattab 10
K-map
A(t+1) = BS + AS'
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
24/10/2009 cs221 – sherif khattab 12
K-map
B(t+1) = BS' + A'B'S
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
24/10/2009 cs221 – sherif khattab 14
K-map
X(t+1) = A'B'
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
24/10/2009 cs221 – sherif khattab 16
state tableY = B
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
24/10/2009 cs221 – sherif khattab 18
state tableZ = A
24/10/2009 cs221 – sherif khattab 19
D flip-flop
next state present state
24/10/2009 cs221 – sherif khattab 20
logic diagram
24/10/2009 cs221 – sherif khattab 21
Logic Diagram
24/10/2009 cs221 – sherif khattab 22
example 2: 4x4 LED matrix
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
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
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!
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
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
24/10/2009 cs221 – sherif khattab 28
3-to-8-line decodertruth table
24/10/2009 cs221 – sherif khattab 29
3-to-8-line decoderlogic diagram
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
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
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
24/10/2009 cs221 – sherif khattab 33
truth table for circuit C
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'
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
top related