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