Logic Design
Logic Design
Page 2
Content
1. Introduction
2. Function Minimization Methods
3. Larger Combinational Systems
4. Sequential Systems
5. Hardware Design Languages
Page 3
Acknowledge
Page 4
Reference textbooks
Page 5
Grading policy
Homework: 20%
Lab work: 20%
Midterm: 30%
Final Exam (multichoice and writing): 30%
Page 6
1. Introduction
Page 7
Chapter 1. Introduction
Page 8
1.1. Review of Number Systems
Page 9
1.1. Review of Number Systems
Page 10
1.1.1. Number Representation
Page 11
1.1.1. Number Representation
n
N (10 ) = ∑ a .b
i =− m
i
i
11101.11(2) = 1x24+1x23+1x22+0x21+1x20+1x2-1+1x2-2=
29.75(10)
Page 12
1.1.1. Number Representation
Decimal:
– b=10
– Digits: 0,1,2,3,4,5,6,7,8,9
– Eg:
539.45(10) = 5x102+3x101+9x100+4x10-1+5x10-2
Page 13
1.1.1. Number Representation
Binary:
– b=2
– Digits: 0,1
bit – binary digit
– Eg:
N (10 ) = ∑ a .2
i =− m
i
i
Binary (cnt’)
– n-bit binary number can represent which range?
• an-1...a1a0 from 0 to 2n-1
0001 = 1 1001 = 9
0010 = 2 1010 = 10
0011 = 3 1011 = 11
0100 = 4 1100 = 12
0101 = 5 1101 = 13
0110 = 6 1110 = 14
0111 = 7 1111 = 15
1000 = 8
Page 15
1.1.1. Number Representation
Octal:
– b=8 N (8) = an an −1...a1a0 .a−1a− 2 ...a− m
– Digits: 0,1,2,3,4,5,6,7
– Eg: ai = 0..7
503.071(8) = 5x82 + 0x81 + 3x80 + 0x8-1 + 7x8-2 + 1x8-3
Hexadecimal:
N (16 ) = an an −1...a1a0 .a−1a− 2 ...a− m
– b=16
ai = 0..F
– Digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
– Eg:
1010 0011(2)= A3(16)
Page 16
503.071(16) = 5x162 + 0x161 + 3x160 + 0x16-1 + 7x16-2 + 1x16-3
Convert from base b to base 10
110.011(8)=?(10) 72.0175
110.011(16)=?(10) 272.039...
Page 18
Convert from base 10 to base b
Page 19
Convert from base 10 to base 2
1 1 2
1 0 6.625(10) = 110.101(2)
20 2 0.75 * 2 = 1.5
0 10 2 0.5 * 2 = 1.0
0 5 2
1 2 2
0 1 2
1 0
Page 21
20.75(10)=?(8) =10100.11(2) = 24.6(8)
20 8 0.75 * 8 = 6.0
4 2 8
2 0
Page 22
Convert from base 2 to base 2n
Page 23
Convert from base 2n to base 2
Eg:
Page 24
Convert from base i to base j
Page 25
1.1. Review of Number Systems
Page 26
1.1.2 Binary Addition
Page 27
1.1.2 Binary Addition
Overflow:
– Occur when the result of addition is out of range of representation
(the result can not be stored in the predefined number of bits)
Page 28
1.1.2 Binary Addition
Page 29
1.1. Review of Number Systems
Page 30
1.1.3 Signed Numbers
Page 32
2’s complement representation
Page 33
2’s complement representation
Range of representation:
– Use n bit to represent 2’s complement numbers
– Range: -2n-1 => 2n-1-1
Page 35
4 bit representation of unsigned and signed (2’s complement)
0000 0 0
0001 1 +1
0010 2 +2
0011 3 +3
0100 4 +4
0101 5 +5
0110 6 +6
0111 7 +7
1000 8 -8
1001 9 -7
1010 10 -6
1011 11 -5
1100 12 -4
1101 13 -3
1110 14 -2
Page 36
1111 15 -1
2’s complement representation
Page 37
Addition of signed numbers
Overflow
– Occur when?
– Add two numbers of the opposite sign?
– Add two positive numbers?
– Add two negative numbers?
maybe
Page 40
1.1.4 Binary Subtraction
Eg: 7 – 5 = ?
5 0101 7 0111
1010 -5 +1011
+ 1 2 0010
-5 1011
Page 41
1.1. Review of Number Systems
Page 42
Binary-Coded Decimal - BCD
BCD:
Decimal Binary BCD
– Use four bits (a nibble) to represent
0 0000 0000
each of the decimal digits 0 through
1 0001 0001
9.
2 0010 0010
– Eg:
3 0011 0011
375 = 0011 0111 0101(BCD) 4 0100 0100
5 0101 0101
6 0110 0110
7 0111 0111
8 1000 1000
9 1001 1001
Page 44
ASCII
Page 45
Page 46
Problems
Page 47
1. Introduction
Page 48
1.2. Switching Algebra and Logic Circuits
Page 49
1.2. Switching Algebra and Logic Circuits
Page 50
1.2.1 Definition of Switching Algebra
Page 51
1.2. Switching Algebra and Logic Circuits
Page 52
Basic Properties of Switching Algebra
P1: Commutative:
• a+b=b+a a.b = b.a
P2: Associative:
• a + (b + c) = (a + b) + c a.(b.c) = (a.b).c
P3:
• a+0=a a.1=a
P4:
• a+1=1 a.0=0
Page 53
Basic Properties of Switching Algebra
P5:
• a + a’ = 1 a . a’ = 0
P6: no coefficient and no exponent
• a+a=a a.a=a
• n.a=a (a)n=a
P7: complement
• (a’)’ = a
P8: distributive:
• a.(b+c) = a.b + a.c a + b.c = (a+b).(a+c)
Page 54
Basic Properties of Switching Algebra
Page 55
Basic Properties of Switching Algebra
P13: redundant
• ab+b’c+ac = ab+b’c
A B
Page 56
Problems
Page 57
1.2. Switching Algebra and Logic Circuits
Page 58
Manipulation of Algebraic Functions
A literal:
– Is the appearance of a variable or its complement
– Eg: x and x’ are two different literals
– Expression ab’+bc’d+a’d+e’ has 8 literals
A product term:
– Is one or more literal connected by AND operators
– Expression ab’+bc’d+a’d+e’has 4 product terms
– Note: A single literal is also a product term
Page 59
Manipulation of Algebraic Functions
Page 60
Manipulation of Algebraic Functions
Page 64
Manipulation of Algebraic Functions
Page 65
Canonical forms
Page 66
Canonical forms
Properties of minterm/Maxterm:
– mimj=0 if i≠j
=mi if i=j
– Mi+Mj=1 if i≠j
= Mi if i=j
Page 67
Canonical forms
Page 68
Canonical forms
Decimal x2 x1 x0 f
0 0 0 0 0 f(x2,x1,x0)=m1+m4+m5+m6+m7
1 0 0 1 1 =Σ(1,4,5,6,7)
2 0 1 0 0 Canonical sum-of-products (SOP)
3 0 1 1 0
4 1 0 0 1
5 1 0 1 1
f(x2,x1,x0)=M0M2M3
6 1 1 0 1
7 1 1 1 1 = Π(0,2,3)
Canonical product-of-sums (POS)
Page 69
F(a,b,c)= abc’+a’b’
Decimal a b c f
0 0 0 0 1
1 0 0 1 1 F(a,b,c)=m0+m1+m6
2 0 1 0 0
3 0 1 1 0 – ∑(0,1,6)
4 1 0 0 0
5 1 0 1 0
6 1 1 0 1
7 1 1 1 0
Page 70
1.2. Switching Algebra and Logic Circuits
Page 71
1.2.4 Representations of Algebraic Functions
Truth table
Venn diagram
Karnaugh map
Page 72
Truth table
Page 73
Truth table
23 rows
Page 74
Venn diagram
A B
F(A,B,C)=C.not(B)
Page 75
Venn diagram
A A
A+B A.B
A+B
A.B
Page 76
Karnaugh map
BC
AB
A 0 1
00 01 11 10
00 0 1
0 0 1 3 2
01 2 3
1 4 5 7 6 11 6 7
Page 77 10 4 5
Karnaugh map (K-map)
BC
A
00 01 11 10
0 0 1 3 2
1 4 5 7 6
Page 78
Two-variable K-map
F(A,B)
B 0 1 A 0 1
A B
0 0 1 0 0 2
1 2 3 1 1 3
Page 79
Two-variable K-map
F(A,B) = AB
B 0 1
A
0 0 0
1 0 1
Page 80
Three-variable K-map
F(A,B,C)
BC
AB 0 1
A
00
00 01 11 10 0 1
0 0 1 3 2
01 2 3
11 6 7
1 4 5 7 6
10 4 5
Page 81
Three-variable K-map
z
x y z F
0 0 0 0
yz xy 0 1
0 0 1 0
x 0 0
0 1 0 1 00 01 11 10 00
0 1 1 0 0 0 0 1
0 1 0
1 0 0 1 01
1 0 1 1 1 1 1 1 1 1
1 11
1 1 0 1
1 1 1 1 1 1
10
Page 82
Four-variable K-map
F(A,B,C,D)
CD
AB
00 01 11 10
00
01
11
10
Page 83
Four-variable K-map
CD
AB
00 01 11 10
0 0 0 1
00
0 0 1 1
01
1 1 1 1
11
0 0 0 1
10
Page 84
Five-variable K-map
E 0 1
CD 00 01 11 10 CD 00 01 11 10
AB AB
00 00
01 01
11 11
10 10
Page 85
Six-variable K-map
F 0 1
E
CD 00 01 11 10 CD 00 01 11 10
AB AB
00 1 1 00 1 1
0
01 1 1 01
11 1 1 11 1 1
10 10 1 1
CD 00 01 11 10 CD 00 01 11 10
AB AB
00 1 1 00 1 1
1 01 1 1 01
11 1 1 11 1 1
10 10 1 1
Page 86
Karnaugh map with don’t care
CD
00 01 11 10
AB
00 1 1
01 1 1
11 − − − −
10 − −
Page 87
1.2. Switching Algebra and Logic Circuits
Page 88
Basic logic gates
AND OR NOT
A B out A B out
A out
0 0 0 0 0 0
0 1
0 1 0 0 1 1
1 0
1 0 0 1 0 1
1 1 1 1 1 1
Page 89
Basic logic gates
F2 = x’y+xy’+xz
Page 91
F1 = x’yz’+x’yz+xy’z’+xy’z+xyz
Implementation of Functions with AND, OR, NOT
Y F
Page 92
Multilevel circuits
OR
A
NOT
A B
A.B (A’.B’)’
=A+B
B
AND
Page 94
Implementation of Functions with NAND
ab + bc + b = ab + bc + b = ab.bc.b
Page 95
Implementation of Functions with NOR
Page 97
Chapter 2.
Logic Function Minimization Methods
Page 98
2. Function Minimization Methods
Page 99
2. Function Minimization Methods
What is minimization?
– Number of operands is minimal and number of literal in each operand is
minimal
Why minimization needed?
– Minimize electronic components used to construct the circuit to
implement that expression
Page 100
2. Function Minimization Methods
Page 101
2.1. Algebraic Method
Drawback:
– Heuristic, depending on experience – no formal method/procedure
– Manually
– Not sure whether the last expression is minimal or not
Page 102
2.1. Algebraic Method
Page 103
2. Function Minimization Methods
Page 104
2.2 The Karnaugh Map Method
Page 105
Implicant, Prime Implicant
CD
AB
00 01 11 10 Implicants of F
Page 106
Implicant, Prime Implicant
CD
CD BC
AB
* 00 01 11 10
B D
00 1 1 1
01 1 1
B D*
11 1 1
AD
AB 10 1 1 1 1
Page 107
Essential Prime Implicant
CD
CD BC
AB
* 00 01 11 10
B D
minterm 0 is only contained in PI B’D’ 00 1 1 1
minterm 5 is only contained in PI BD
=> BD & B’D’ are two Essential PI
01 1 1
B D*
11 1 1
AD
AB 10 1 1 1 1
Page 108
2.2.1 Minimum Sum of Product Expressions
Page 109
2.2.1 Minimum Sum of Product Expressions
CD CD
AB AB
00 01 11 10 00 01 11 10
00 00 1 1
01 1 1 01 1 1
11 1 1 11 1 1
10 1 1 10 1 1
Page 110
2.2.1 Minimum Sum of Product Expressions
CD
AB
00 01 11 10
21 cells => eliminate 1 variable
00
01 1 1 F(A,B,C,D) = A’BC’ + AC
11 1 1
22 cells => eliminate 2 variables
10 1 1
Page 111
2.2.1 Minimum Sum of Product Expressions
Page 112
– a. F(A,B,C,D) = R(0,2,5,6,9,11,13,14)
= BC’D + AB’D + BCD’ + A’B’D’
CD
AB
00 01 11 10
00 1 1
01 1 1
1
11 1
10 1 1
Page 113
– b. F(A,B,C,D) = R(1,3,4,6,9,11,12,14)
= B’D + BD’
CD
AB
00 01 11 10
1 1
00
1
01 1
1
11 1
10 1 1
Page 114
2.2 The Karnaugh Map
Page 115
2.2.2 Don’t care
01 1 1
11 − − − −
10 − −
F ( A, B, C , D) = BC + BC
Page 116
Examples:
F(a,b,c,d)=R(1,3,5,7,12,13)
don’t care (0,4,10,15)
CD
AB
00 01 11 10
00 - 1 1
01 - 1 1
11 1 1 -
10 -
Page 117
2. Function Minimization Methods
Page 118
2.3 Quine-McCluskey Method
Page 119
2.3. Quine-Mcluskey method
ABC+ABC+ABC+ABC+ABC
f = ABCDEF+ABCDEF+ABCDEF+ABCDEF+ABCDEF
+ABCDEF+ABCDEF +ABCDEF+ABCDEF+ABCDEF
f(A,B,C,D,E,F)=Σ(0,2,6,7,14,8,41,12,15,10)
f = 000000+000010+000110+000111+001110
+001000+101001+001100+001111+001010
Page 122
S2. Grouping
f = 000000+000010+000110+000111+001110
+001000+101001+001100+001111+001010
Page 123
S3 & S4. Making set (1)
0 2 6 7 8 10 12 14 15 41
41 x
0,2,8,10(2,8) x x x x
2,6,10,14(4,8) x x x x
8,10,12,14(2,4) x x x x
6,7,14,15(1,8) x x x x
(
marked
mini term
0 2 6 7 8 10 12 14 15 41
x
prime implicants
41
0,2,8,10(2,8) x x x x
2,6,10,14(4,8) x x x x
8,10,12,14(2,4) x x x x
6,7,14,15(1,8) x x x x
41 101001 ABCDEF
000000
000010 ABDF
0,2,8,10(2,8)
001000
001010
F=ABCDEF
001000 +ABDF
8,10,12,14(2,4) 001010 +ABCF
ABCF
001100 +ABDE
001110
000110
6,7,14,15(1,8) 000111 ABDE
Page 128
001110
001111
Examples:
Page 129
Quine-Mcluskey method with don’t care
Page 130
Quine-Mcluskey method with don’t care
f=ABCD+BCD+ACD+ABCD+ABCD
don’t care AD
mini term decimal first comparison second comparison
ABCD 0,1(1)
0000 0 0,2(2)
0,1,2,3(1,2)
0001 1 1,3(2)
0010 2 1,5(4)
0011 3 2,3(1) 1,3,5,7(2,4)
0101 5 3,7(4)
0111 7 3,11(8)
1011 11 5,7(2) 3,7,11,15(4,8)
1101 13 5,13(8) 5,7,13,15(2,8)
1111 15 7,15(8)
11,15(4)
Page 131
13,15(2)
Quine-Mcluskey method with don’t care
0 2 11 13 15 ABCD
0,1,2,3(1,2) x x 00**
1,3,5,7(2,4) 0**1
3,7,11,15(4,8) x x **11
5,7,13,15(2,8) x x *1*1
f=AB+CD+BD
Page 132
Chapter 3.
Larger Combinational Systems
Page 133
Introduction
Page 134
3. Larger Combinational Systems
Page 135
3.1 Delay in Combinational Logic Circuits
A
X
B
F
C
Page 136
3. Larger Combinational Systems
Page 137
Half Adder
a b Σ r
0 0 0 0 Σ=a ⊕
b
a
HA
Σ (Result) 0 1 1 0
b r (Carry-out) 1 0 1 0 r = ab
1 1 0 1
a =1
Σ
Half Adder b
&
r
Page 138
Addition of two n-bit numbers
r3 r2 r1 r0
A= a3 a2 a1 a0
+B = b3 b2 b1 b0
r4 Σ3 r3 Σ2 r2 Σ1 r1 Σ 0
Summation Σ4 Σ3 Σ2 Σ1 Σ0
Page 139
Full Adder
Σi
ai Σi aibi
FA 00 01 11 10
ri ri
bi ri+1
0
1 1
1
ai bi ri Σi ri+1 1 1
0 0 0 0 0
aibi ri+1
0 0 1 1 0 ri 00 01 11 10
0 1 0 1 0
0
1
0 1 1 0 1
1 0 0 1 0 1
1 1 1
1 0 1 0 1
1 1 0 0 1
Σi = ai ⊕ bi ⊕ ri
1 1 1 1 1
ri+1 = ai bi + ri (ai ⊕ bi)
Page 140
Combinational logic circuit design procedure
Page 141
Example 1
Page 142
Example 1
n2 n1 n0 m3 m2 m1 m0
0 0 0 0 0 1 1 S3:
0 0 1 0 1 0 0
0 1 0 0 1 0 1
m3 = n2n0 + n2n1
0 1 1 0 1 1 0
n1n0 00 01 11 10
1 0 0 0 1 1 1 n2
1 0 1 1 0 0 0
0 0 0 0 0
1 1 0 1 0 0 1
1 0 1 1 1
1 1 1 1 0 1 0
Page 143
Example 2
Solution:
– Step1: find inputs, outputs
• Inputs: a1,a0
• Outputs: b3,b2,b1,b0
Ex2
Page 144
Example 2
a1 a0 b3 b2 b1 b0
0 0 0 0 0 0
0 1 0 0 0 1
1 0 0 1 0 0
1 1 1 0 0 1
Page 145
Example 2
X1
2.5 V
b3 X2
U1A
2.5 V
J1
b2 X3
a1 7408N
7404N
V2Key = B R2
12 V 100
Page 146
Full Adder
ri
=1 =1
ai Σi
bi
& &
≥1
ri+1
Page 147
Full Adder
ri
=1 =1
ai Σi
bi
HA HA
& &
≥1
ri+1
Page 148
n-bit Adder
FA FA FA FA
rn
r2
Σn Σ n-1 Σ n-2 Σ1 Σ0
G1 ≥ 1 r2
P0 &
r0
G0 & τ1 τ2
P1
&
r2 = G1 + G0P1 + r0P0P1
P0
r0
Page 150
τ1 τ2
Parallel 4-bit addition
a3 b3 a2 b2 a 1 b1 a0 b0 r0
Calculate Pi and Gi
P3 G3 P2 G2 P1 G1 P0 G0
Carry calculation
r4 r3 r2 r1 r0
a 3 b3 a2 b2 a1 b1 a0 b0
Sum calculation
r4 = Σ 4 Σ3 Σ2 Σ1 Σ0
Page 151
Subtractor
Second choice:
Half Subtractor => Full Subtractor => n-bit Subtractor
Page 152
Subtractor
B3 B2 B1 B0
A3 A2 A1 A0
A B A B A B A B
C4 C+ FA C C+ FA C C+ FA C C+ FA C 1
S
C3 S
C2 S
C1 S
S3 S2 S1 S0
Page 153
Adder and Subtractor
A3 B3 A2 B2 A1 B1 A0 B0
S3 S2 S1 S0
Page 154
3. Larger Combinational Systems
Page 155
Decoder
Page 156
Decoder
D0
x1
D1 D0
x2
. . x1
nxm 3x8 .. D1
. decoder .
x2
decoder
.
. x3
xn . Dm-1
D7
Eg:
+ 3 bit inputs x1,x2,x3.
+ 8 bit outputs Y0,Y1…Y7
Page 157
Design 3x8 decoder
D0
x1
x2
3x8 .. D1
x3
decoder
. D7
En
if (En=0)
Disable or D0...D7=0
else if (En=1)
Function as a 3x8 decoder
Page 158
BCD-to-decimal decoder
N A B C D Y0 Y1 . Y9
.
0 0 0 0 0 1 0 . 0
.
1 0 0 0 1 0 1 . 0
Y0 .
2 0 0 1 0 0 0 . 0
A BCD Y1 .
B to : 3 0 0 1 1 0 0 . 0
C .
decimal Yi 4 0 1 0 0 0 0 . 0
D Decoder : .
5 0 1 0 1 0 0 . 0
Y9 .
6 0 1 1 0 0 0 . 0
.
7 0 1 1 1 0 0 . 0
.
8 1 0 0 0 0 0 . 0
.
9 1 0 0 1 0 0 . 1
Page 159
BCD-to-decimal decoder
Y0 A B C D Y1 A B C D
CD
AB
00 01 11 10 Y2 BCD
00 1 Y3 BCD
01 Y4 BC D
Y5 BC D
11 − − − −
Y6 BC D
10 − −
Y7 BCD
Y8 AD
Y9 AD
Page 160
Decoder
D0
x2
x3
3x8 .. D1
x4
decoder
. D7
x1
D8
3x8 .. D9
decoder
. D15
Page 161
Decoder implementation of arbitrary functions
D0 F1
D1
D2
D3
D4
D5
x1 D6
4x16 D7
x2
D8
decoder
x3 D9
D10
x4 D11
D12
D13
D14
D15
F1(x1,x2,x3,x4)=Σ(0,1,3,8,12)
Page 162
BCD-to-7segment decoder
a
f g b
N A B C D a b c d e f g
e c 0 0 0 0 0 1 1 1 1 1 1 0
d 1 0 0 0 1 0 1 1 0 0 0 0
4 0 1 0 0 0 1 1 0 0 1 1
5 0 1 0 1 1 0 1 1 0 1 1
A K 6 0 1 1 0 1 0 1 1 1 1 1
7 0 1 1 1 1 1 1 0 0 0 0
8 1 0 0 0 1 1 1 1 1 1 1
9 1 0 0 1 1 1 1 1 0 1 1
Page 163
BCD-to-7segment decoder
CD
AB
00 01 11 10 &
B
00 1 0 1 1 D
01 0 1 1 1
11 − − − − &
≥1
10 1 1 − − A
C
a A C BD B D
Page 164
3. Larger Combinational Systems
Page 165
Encoder
Page 166
Keyboard encoder
‘1’ P1
1
P2 A
2
B
Pi N=i
i Encoder
C
P9 D
9
9 keys
4-bit key code.
Page 167
Keyboard encoder
N ABCD
1 0001
9 1001
Page 168
Keyboard encoder
N=1
≥ 1
D
N=2
N=3
≥ 1
N=4 C
N=5
N=6 ≥ 1
B
N=7
N=8 ≥ 1
A
N=9
Page 169
3. Larger Combinational Systems
Page 170
Multiplexor
X0 X1 Y
Y
X2
X1 X3
C0 C0
C1
control inputs C1 C0 Y
C0 Y 0 0 X0
0 X0 0 1 X1
1 0 X2
Page 171
1 X1
1 1 X3
2-to-1 Multiplexor
MUX 2-1
C0 X1 X0 Y
X0
Y
C0 Y 0 0 0 0
X1 0 X0 0 0 1 1
0 1 0 0
1 X1
C0
0 1 1 1
X1X0
1 0 0 0
C0 00 01 11 10
1 0 1 0
0 1 1 1 1 0 1
1 1 1 1
1 1 1
Y X0C 0 X1C 0
Page 172
2-to-1 Multiplexor
Page 173
4-to-1 Multiplexor
Page 174
Application of multiplexor
Select source
Source 1 Source 2
A = a3 a2 a1 a0 B = b3 b2 b1 b0
C0
Receiver
Y3 Y2 Y1 Y0
Page 175
Application of multiplexor
Convert parallel-serial
A
C0
a0 1
a1 Y
0
a2 C1 t
a3 1
0
t
C0 Y
C1 a0 a1 a2 a3
Page 176
Application of multiplexor
f(0,0) x0
f(0,1) x1 Y = f(A,B)
Inputs to
select f(1,0)
function
x2
f(1,1)
x3
C1 C0
A
Page 177 Variables
B
Example
0 x0
1 x1 Y = f(A,B)
Inputs to
select 1
function
x2
0
x3
C1 C0
A
Variables
B
Page 178
3. Larger Combinational Systems
Page 179
Demultiplexor
DeMUX 1-2
S0
S1
C0
S 0 = C0 E
S1 = C0 E
Page 180
Demultiplexor 1-4
S0
S1
E
S2
S3
C1
C0
Page 181
3. Larger Combinational Systems
Page 182
3.7 Three-State Gates (Tristate)
Page 183
3.7 Three-State Gates (Tristate)
Page 184
Three-State buffer
Three-state buffer
C A Y
----------------------
0 0 z
0 1 z
7 0 0
1 1 1
Page 185
Application of three-state buffer
Page 186
3. Larger Combinational Systems
Page 187
3.8 Gate Arrays - ROM, PLA and PAL
Page 188
PLA - Programmable logic arrays
A B C Z1 Z2 • • •
m0 0 0 0 0 1 inputs
m1 0 0 1 0 0
m2 0 1 0 1 1
m3 0 1 1 0 0 OR
m4 1 0 0 0 1 AND
product array
m5 1 0 1 1 0 array
terms
m6 1 1 0 1 1
m7 1 1 1 1 0
outputs
Page 189 • • •
Before programming
Page 190
After programming
A B C
AB
B'C
AC'
B'C'
Page 191
F0 F1 F2 F3
PLA example
Multiple functions of A, B, C
– F1 = A B C full decoder as for memory address
– F2 = A + B + C bits stored in memory
A B C
– F3 = A' B' C'
A'B'C'
– F4 = A' + B' + C'
A'B'C
– F5 = A xor B xor C A'BC'
– F6 = A xnor B xnor C A'BC
AB'C'
A B C F1F2F3F4F5 F6
AB'C
0 000 0 1 1 0 0
0 010 1 0 1 1 1 ABC'
0 100 1 0 1 1 1 ABC
0 110 1 0 1 0 0
1 000 1 0 1 1 1
1 010 1 0 1 0 0 F1 F2 F3 F4 F5
1
Page 192 100 1 0 1 0 0 F6
PALs and PLAs
Page 193
ROM – Read Only Memories
A B C F0 F1 F2 F3
0 0 0 0 0 1 0 ROM
0 0 1 1 1 1 0 8 words x 4 bits/word
0 1 0 0 1 0 0
0 1 1 0 0 0 1
1 0 0 1 0 1 1
1 0 1 1 0 0 0 A B C F0 F1 F2 F3
1 1 0 0 0 0 1 address outputs
1 1 truth
1 0 table
1 0 0 block diagram
Page 195
ROM structure
n address lines
• • •
inputs
memory
decoder 2n word
array
lines (2n words
by m bits)
outputs
• • •
m data lines
Page 196
3. Larger Combinational Systems
Page 197
3.9 Larger Examples
1. Seven-segment displays
2. Comparator
Page 198
Comparator
Gi
ai 1bit
Full Li
bi Comparator
Ei
Page 199
Comparator
Page 200
Midterm examination (90’)
Page 201
Midterm examination 2 (90’)
1. Represent the following function in the canonical form SOP and POS:
F(A,B,C)=C
2. Use the Quine-McCluskey method to obtain the minimal sum for the
following function:
F(A,B,C,D,E)= ∑(1,4,6,7,8,11,12,13,15)
3. Using 3x8 decoder to implement the following function:
F(A,B,C) = AB + B’C
4. Design a combinational logic circuit to calculate the following function:
M=N+5 where N is BCD number (Binary-Coded Decimal).
Page 202
Chapter 4.
Sequential Systems
Page 203
4. Sequential Systems
4.1 Definitions
4.2 State Tables and Diagrams
4.3 Latches and Flip Flops
4.4 Analysis of Sequential Systems
4.5 Design of Sequential Systems
4.6 Solving Larger Sequential Problems
Page 204
4.1 Definitions
Page 206
Sequential circuit model
x1 z1
Circuit inputs
x2
.. .. z2
Circuit outputs
. Combinatorial
circuit
.
xn
yk Memory Yk
device
.. Next state
Present state
.
y1 Memory Y1
Page 207 device
Sequential circuit model
Mealy model:
• X : finite inputs. m inputs: x1,x2...,xm
• S : finite states. n states: s1,s2...,sn
• Y: finite outputs.l outputs: y1,y2...,yl
• Fs: state function. s = Fs(X,S)
• Fy : output function. y = Fy(X,S)
Moore: ~Mealy
• Difference: Fy = Fy(S)
Page 208
Asynchronous/Synchronous sequential circuits
Page 209
Synchronous sequential circuits
The operation of the circuit is synchronized with the clock pulse input.
Page 210
Asynchronous sequential circuits
Page 211
4. Sequential Systems
4.1 Definitions
4.2 State Tables and Diagrams
4.3 Latches and Flip Flops
4.4 Analysis of Sequential Systems
4.5 Design of Sequential Systems
4.6 Solving Larger Sequential Problems
Page 212
State diagram
0/0
0/0
1/0 1/1
Page 213
Example of state diagram
1 /0 0 /0
0 /0
0 /0 1 /0 0 /0
A B C D
1 /0
1 /1
Page 214
State diagram
a/0
0 0
1
0
f/1 b/0
0 1
e/1 c/0
1
1
0
1 d/0
Page 215
0
State table
Page 216
Mealy state table
0/0
0/0
1/0 1/1
PS NS Output (z)
PS NS Output a/0
0
1 0
0
x=0 x=1 z
f/1 b/0
a b a 0
b b c 0 0 1
c d c 0
e/1 c/0
1
d d e 0
1
0
e f e 1 1 d/0
f f a 1
0
The entry at the intersection of any row with the output column indicates the
output values corresponding to the PS associated with that row.
Page 218
Incompletely specified Mealy state table
PS NS/Output (z)
00 01 11 10
a -/- c/1 b/- e/1
b e/0 -/- -/- -/-
c f/0 f/1 -/- -/-
d a/- -/- e/- b/1
e -/- f/0 d/1 a/0
f c/0 -/- c/1 b/0
Page 219
4. Sequential Systems
4.1 Definitions
4.2 State Tables and Diagrams
4.3 Latches and Flip Flops
4.4 Analysis of Sequential Systems
4.5 Design of Sequential Systems
4.6 Solving Larger Sequential Problems
Page 220
4.3. Latches and Flip-Flops
Yi yi
ΔT Yi
yi
yi(t+ΔT) = Yi(t)
ΔT
Bistable devices:
– Two stable states:
• Q=0 : the device is reset (reset state)
• Q=1: the device is set (set state)
– A bistable device remains in one of two states indefinitely until directed
by an input signal to change state.
– Two types:
• Latch
• Flip-flop
Page 222
4.3. Latches and Flip-Flops
Page 223
SR Latch
S Q
Current state
S R Q Q+
R Q’ Next state
0 0 0 0
S Q
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
Q' 1 0 1 1
R
1 1 0 -
Indeterminate
1 1 1 -
Q = (R+Q’)’
Page 224
Q’= (S+Q)’
SR Latch S Q
R Q’
S Q
S R Q+
0 0 Q
0 1 0
1 0 1
Q'
1 1 Indeterminate R
Page 225
SR Latch
S Q S Q
R Q’ R Q’
S Q
Q
S
Q' R
R
Q'
Page 226
SR Latch
S
S
Q
R
R
Q' Q
Q
set reset set reset
Page 227
SR Latch
Q S
S
R
R Q
Q'
Q
set reset set reset
Page 228
SR Latch
R
Q Q Q+ S R
0 0 0 -
S
0 1 1 0
1 0 0 1
1 1 - 0
Page 229
D Latch
D
D Q S Q
Q’ R Q’
Q Q* D
D Q*
0 0 0
0 0
0 1 1
1 1
1 0 0
1 1 1
Equivalent characteristic table
Excitation table
Page 230
Q* = D
Gated Latches
S Q
E: Enable input control
E
The latch will not change state as long as E=0
R Q’
E=1 SR=10 => Set
E=1 SR=01 => Reset
S
Q ⇒The operation of latch is synchronized
with the E input => E: synchronous input
E
A latch with synchronous input is called
gated latch.
R
Q'
Page 231
Flip-flops
Page 232
SR flip-flop
S Q S Q S Q
R Q R Q R Q
Page 233
SR flip-flop
Pulse-triggered
(Master-Slave)
Current state
Next state
S R Q Q(t+1)
Q Q(t+1) S R
0 0 0 0
S R Q(t+1) 0 0 0 -
0 0 1 1
0 0 Q(t) 0 1 1 0
0 1 0 0
0 1 0 1 0 0 1
0 1 1 0
1 0 1
1 0 0 1 1 1 - 0
1 1 Indeterminate
1 0 1 1
1 1 0 - Reduced characteristic table Excitation table
1 1 1 -
Indeterminate
Characteristic table
S Q
CL
Q
R
S S Q
CL Q
SR-latch
R Q
R
Q
Page 236
SR flip-flop
Timing chart
S
S Q R
CLK CL
R Q
Q
Q
Page 237
D flip-flop
D
D Q S Q
CLK CLK
CLK
Q’ R Q
Page 238
D flip-flop
Current state
Next state
Q Q(t+1) D
D Q Q(t+1) 0 0 0
0 0 0
0 1 1
D Q(t+1)
0 1 0
0 0 1 0 0
1 0 1
1 1 1 1 1
1 1 1
Q(t+1) = D
Page 239
JK flip-flop
J Q S Q
CLK CLK
K Q’ R Q
JK = 00 => Q* = Q REMEMBER
JK = 01 => Q* = 0 RESET
JK = 10 => Q* = 1 SET
JK = 11 => Q* = not(Q) INVERT
Page 240
JK flip-flop
Current state
Next state
J K Q Q(t+1)
Q Q(t+1) J K
0 0 0 0
J K Q(t+1) 0 0
0 0 1 1 0 -
0 0 Q(t) 0 1
0 1 0 0 1 -
0 1 0
0 1 1 0 1 0 - 1
1 0 1
1 0 0 1 1 1
1 1 [Q(t)]’ - 0
1 0 1 1
1 1 0 1 Reduced characteristic table Excitation table
1 1 1 0
Characteristic table
Page 241
Q(t+1) = K’Q + JQ’
Master-Slave flip-flop
Page 242
Master-Slave flip-flop
Master Slave
S S Q S Q Q
C E E
R R Q’ R Q’ Q’
Page 243
Edge-Triggered flip-flop
Page 244
Edge-Triggered flip-flop
Y1
Q
CLK
Q
Y2
Q
CLK
Q
a Q
input of y-FF Q
CL x-FF
b Q Q
Page 247
CL
Flip-Flop conversions
SR-FF T-FF
S R Q Q+ T Q Q+
0 0 0 0 0 0 0
0 0 1 1 0 1 1
0 1 0 0 1 0 1
0 1 1 0 1 1 0
1 0 0 1
1 0 1 1
Expanded state table shows the
1 1 0 -
state
1 1 1 -
transition by the input
Page 248
Flip-Flop conversions
excitation table
T-FF
T Q Q+ state input
0 0 0 Q Q+ T
0 1 1 0 0 0
1 0 1 0 1 1
1 1 0 1 0 1
1 1 0
Page 250
Flip-Flop conversions
T Q Q+ S R Q Q
0 0 0 0 - T 0 1 T 0 1
0 1 1 - 0 0 - 0 0 0 -
1 0 1 1 0
1 0 1 1 1 0
1 1 0 0 1
Karnaugh Map of R Karnaugh Map of S
S Q Q R=TQ S=TQ
T CL
Calculate logic function for FF input
R Q Q
Page 252
CL
Flip-Flop conversions
D Q Q+
0 0 0
0 1 0
1 0 1
1 1 1
expanded state table of D-FF D Q Q+ J K
excitation table of JK-FF 0 0 0 0 -
0 1 0 - 1
state input
1 0 1 1 -
Q Q+ J K
1 1 1 - 0
0 0 0 -
0 1 1 -
1 0 - 1
1
Page 253
1 - 0
Flip-Flop conversions
D Q Q+ J K Q Q
D 0 1 D 0 1
0 0 0 0 -
0 1 0 - 1 0 0 - 0 - 1
1 0 1 1 - 1 1 - 1 - 0
1 1 1 - 0
Karnaugh Map of J Karnaugh Map of K
J Q Q
J=D K=D
D CL CL
K Q Q
Page 254
4. Sequential Systems
4.1 Definitions
4.2 State Tables and Diagrams
4.3 Latches and Flip Flops
4.4 Analysis of Sequential Systems
4.5 Design of Sequential Systems
4.6 Solving Larger Sequential Problems
Page 255
Flip flop excitation equation
Page 256
Analysis procedure of sequential circuits
Page 257
Example1: A D flip-flop Moore model circuit
~1PR ~1PR
D1 q1 D2 q2
1D 1Q 1D 1Q
z
1CLK ~1Q 1CLK ~1Q
~1CLR ~1CLR
Cl ock
Excitation equations:
– D1 = q1q2’ + xq1’ Since output is only a function
– D2 = xq1 of state z=q2’, and not directly
Output equations: of input, this is Moore model
– z = q2’
Page 258
Example1: A D flip-flop Moore model circuit
q2* = d2 = xq1
State table
00
1
q1*q2*
1
q1q2 z
x=0 x=1 0 0
10
00 00 10 1 1
1 1
01 00 10 0
0
10 10 11 1 01 11
0 0
11 00 01 0
1
~1PR ~1PR
x A B
1J 1Q 1J 1Q
1CLK 1CLK
1K ~1Q 1K ~1Q
~1CLR ~1CLR
Cl ock
Excitation equations:
– JA = x KA = xB’
Since output is only a function
of state z=A+B, and not directly
– JB = KB = x + A’
of input, this is Moore model
Output equations:
Page 260
– z=A+B
Example2: A JK flip-flop Moore model circuit
State table 00
0 0
1
A*B* 0
AB z
x=0 x=1 01
1 11
1
0
00 01 11 0 1 1
01 00 10 1 1
10
10 10 01 1 1
11 11 10 1 0
Page 262
Example3: A D flip-flop Mealy model circuit
x
z
~1PR ~1PR
q1 q2
1D 1Q 1D 1Q
~1CLR ~1CLR
Cl ock
Excitation equations:
Since output is a function of
– d1 = xq1 + xq2
both present input and state
– d2 = xq1’q2’
z=xq1, this is Mealy model
Output equations:
Page 263
– z = xq1
Example3: A D flip-flop Mealy model circuit
0/0
1/0
0/0
q* z 0/0 1/1
q
x=0 x=1 x=0 x=1
01 10
00 00 01 0 0 1/0
01 00 10 0 0 1/1
10 00 10 0 1 Notice that:
11 00 10 0 1 2. State 11 is never reached, this example
really only has 3 states.
2. Whenever there is a 0 input, we return to
Page 264
state 00.
Example3: A D flip-flop Mealy model circuit
x 0 1 1 0 1 1 1 1 0
q1 ? 0 0 1 0 0 1 1 1 0
q2 ? 0 1 0 0 1 0 0 0 0
z 0 0 0 0 0 0 1 1 0 0 0
Page 265
Example3: A D flip-flop Mealy model circuit
Page 266
4. Sequential Systems
4.1 Definitions
4.2 State Tables and Diagrams
4.3 Latches and Flip Flops
4.4 Analysis of Sequential Systems
4.5 Design of Sequential Systems
4.6 Solving Larger Sequential Problems
Page 267
Design Procedure for Sequential Systems
Page 268
Example1: Design sync sequential circuit using JK
1/1
1/0
Page 269
Example1: Design sync sequential circuit using JK
x 0 A C
S 0 1 1 B D
x
0 1
A B,0 A,0 q1 q2
00 01,0 00,0
B B,0 C,0
01 01,0 10,0
C D,0 A,0
10 11,0 00,0
D B,0 C,1
11 01,0 10,1
State table
Q1Q2 Q1Q2
Page 270
State table after assignment
Example1: Design sync sequential circuit using JK
x q q* J K
0 1
q1q2 0 0 0 -
Application table
00 01,0 00,0 0 1 1 -
1 0 - 1
01 01,0 10,0
1 1 - 0
11 01,0 10,1
x
q1 q2
10 11,0 00,0 0 1
J 1 K1 J2K2 J1K1 J 2 K2
q1*q2*
00 0- 1- 0- 0-
01 0- -0 1- -1
Excitation table
11 -1 -0 -0 -1
10 -0 1- -1 0-
Page 271
Example1: Design sync sequential circuit using JK
x
q1 q2
Minimization for J1 0 1
J 1 K1 J2K2 J 1 K1 J2K2
x 0 1
q1 q2 00 0- 1- 0- 0-
00 0 0
01 0- -0 1- -1
01 0 1 11 -1 -0 -0 -1
10 -0 1- -1 0-
11 - -
J2 = x K2 = x K 1 = xq 2 + q 2 x
&
1 J2 q2 & J1 q1
x y
CLK CLK
=1
K2 q2 K1 q1
CLOCK
Page 273
Ex 2: Design sync sequential circuit using JK
Page 274
Ex 3: Design sync sequential circuit using JK
Page 275
Design Procedure for Sequential Systems
Page 276
S4. State reduction
Page 277
State reduction
Examples:
A
0/0 1/0
B C B C
1/1 1/1 1/1 1/1
0/0 0/0 0/0 0/0
unify A and F
Page 278
A and F have the same output and transition state for the same input
State reduction
Examples:
B C B C
1/1 0/0
1/1 1/1 0/0
0/0 0/0
0/0 1/1
1/0
0/0 D 0/0 1/0 E 0/0
AF DE 0/0
1/0 1/0 1/0
AF
unify D and E
D and E have the same output and transition state for the same input
Page 279
State reduction
Examples:
B C BC
0/0 0/0
0/0
1/1 0/0 1/1
1/0
0/0 1/1
1/0
AF DE 0/0
AF DE 0/0 1/0
1/0
unify B and C
Page 280
State reduction
Page 282
Example of method 1 (1/4)
0/0
next state output
current
a state 0 1 0 1
1/0 1/0 a a b 0 0
f b d c 4 1
b 0/0 c a b 0 0
1/0 1/1 0/1 0/1 d f e
0/1 1 1
1/1 e d c 1 1
c e
f e a 1 0
1/1
d 0/1
Page 283
Example of method 1 (2/4)
Implication table
current next state output
state input X1X0 input X1X0 b de
00 01 10 11 00 01 10 11
c × ae
a d e b - 0 - 0 -
b e - - a - 1 - 0 d be × de
ad
c a - - e 1 - 0 - e be
bf ae ○ ef
d - b e d - 0 0 -
e a b f - - - - 0 f × de
ae
× × ad
bc
f d c - e 1 - 1 0 a b c d e
Page 288
Example of method 2 (2/5)
d be × de C2,C3,C4 is closed
ad
e be bf ae ○ ef
f × de ae
× × ad
bc
a b c d e
Page 291
Example of method 2 (5/5)
Page 292
Design Procedure for Sequential Systems
Page 293
State assignment
next state
current input X
state 0 1 block 1 (q1,q2,q3)
q1 q2 q4 block 2 (q4,q5,q6)
q2 q3 q6
q3 q1 q5 This partition is SP
q4 q5 q2
q5 q6 q1 The first bit is used to
q6 q4 q3 distinguish the blocks.
next state
current state input X
0 1
u 1u2 u 3 u1+2+
u u 3+ u1+u2+u 3+
0 0 0 0 0 1 1 0 0
0 0 1 0 1 0 1 1 0
0 1 0 0 0 0 1 0 1
1 0 0 1 0 1 0 0 1
Page 295
1 0 1 1 1 0 0 0 0
1 1 0 1 0 0 0 1 0
Chapter 5.
Hardware Design Languages
Page 296
Problems
Problem 1:
Design a synchronous up/down counter using JK with one
input x. If x=0 the circuit counts up from 0 to 3 and repeat, if
x=1 the circuit counts down from 3 downto 0 and repeat.
Problem 2:
Design a synchronous counter using JK with one input x. The
circuit counts from 0 to 13 then repeat.
Problem 3:
Page 297
Problems for sequential circuit design
Textbook:
Chapter 6: 6.5
– 7a,b,c,d,
– 8a,b,c,d
– 9a,b,c,d
Chapter 7: 7.6
– 4,5,6,8,9,11,13,15
Page 298