CS 140 Lecture 3 Combinational Logic Professor CK
CS 140 Lecture 3 Combinational Logic Professor CK Cheng CSE Dept. UC San Diego 1
Part I Combinational Logic. 1. Specification 2. Implementation 3. K-maps 2
Definitions Literals xi or xi’ Product Term x 2 x 1’x 0 Sum Term x 2 + x 1’ + x 0 Minterm of n variables: A product of n literals in which every variable appears exactly once. Maxterm of n variables: A sum of n literals in which every variable appears exactly once. 3
Implementation Specification Obj min cost (max performance) Cost: wires, gates Schematic Diagram Net list, Switching expression Search in solution space Literals, product terms, sum terms We want to minimize # of terms, # of literals 4
Implementation (Optimization) An example of 2 -variable function f(A, B) ID A B f(A, B) minterm 0 0 1 0 1 1 A’B 2 1 0 1 AB’ 3 1 1 1 AB 5
Function can be represented by sum of minterms: f(A, B) = A’B+AB’+AB This is not optimal however! We want to minimize the number of literals and terms. We factor out common terms – A’B+AB’+AB= A’B+AB’+AB+AB =(A’+A)B+A(B’+B)=B+A Hence, we have f(A, B) = A+B 6
K-Map: Truth Table in 2 Dimensions A=0 B=1 0 1 A=1 2 3 AB’ 1 1 A’B AB f(A, B) = A + B 7
Another Example ID A B f(A, B) minterm 0 0 1 0 1 1 2 1 0 0 3 1 1 1 A’B AB f(A, B)=A’B+AB=(A’+A)B=B 8
On the K-map: A=0 B=1 0 1 A= 1 2 3 0 1 AB A’B f(A, B)=B 9
Using Maxterms ID A B f(A, B) Maxterm 0 0 A+B 1 0 1 1 2 1 0 0 3 1 1 1 A’+B f(A, B)=(A+B)(A’+B)=(AA’)+B=0+B=B 10
Two Variable K-maps Id a b f (a, b) 0 0 0 f (0, 0) 1 2 3 0 1 1 f (0, 1) f (1, 0) f (1, 1) # possible 2 -variable functions: For 2 variables as inputs, we have 4=22 entries. Each entry can be 0 or 1. Thus we have 16=24 possible functions. a f(a, b) b 11
Two-Input Logic Gates 12
More Two-Input Logic Gates 13
Representation of k-Variable Func. • • • Boolean Expression (0, 1, 1, 0) (0, 1, 1, 1) (1, 1, 1, 0) (1, 1, 1, 1) Truth Table B (0, 0, 1, 1) (1, 0, 1, 0) (1, 0, 1, 1) (0, 0, 1, 0) Cube C (0, 1, 0, 1) K Map (1, 1, 0, 1) D Binary Decision (0, 0, 0, 0) (0, 0, 0, 1) (1, 0, 0, 0) (1, 0, 0, 1) A Diagram A cube of 4 variables: (A, B, C, D) 14
Three-Variable K-Map Id a b c 0 1 2 3 4 5 6 7 0 0 1 1 0 1 0 1 f (a, b, c) 1 0 1 0 15
Corresponding K-map b=1 Gray code (0, 0) c=0 c=1 0 1 1 0 (0, 1) 2 3 1 0 (1, 1) 6 7 1 0 (1, 0) 4 5 1 0 a=1 f(a, b, c) = c’ 16
Karnaugh Maps (K-Maps) • Boolean expressions can be minimized by combining terms • K-maps minimize equations graphically 17
K-map • Circle 1’s in adjacent squares • In the Boolean expression, include only the literals whose true y(A, B)=A’B’C’+A’B’C= A’B’(C’+C)=A’B’ 18
Another 3 -Input example Id a b c 0 1 2 3 4 5 6 7 0 0 1 1 0 1 0 1 f (a, b, c) 0 0 1 1 1 19
Corresponding K-map b=1 (0, 0) c=0 c=1 0 0 (0, 1) 2 3 1 0 (1, 1) 6 7 1 (1, 0) 4 5 1 1 a=1 f(a, b, c) = a + bc’ 20
Yet another example Id a b c 0 1 2 3 4 5 6 7 0 0 1 1 0 1 0 1 f (a, b, c, d) 1 1 0 0 21
Corresponding K-map b=1 (0, 0) c=0 c=1 0 1 1 1 (0, 1) 2 3 0 (1, 1) 6 7 0 0 (1, 0) 4 5 1 1 a=1 f(a, b, c) = b’ 22
4 -input K-map 23
4 -input K-map 24
4 -input K-map 25
K-maps with Don’t Cares 26
K-maps with Don’t Cares 27
K-maps with Don’t Cares 28
- Slides: 28