CS 140 Lecture 3 Professor CK Cheng 10/3/02
1.Specification 2.Implementation 3.K-maps Part I.
Literals x i or x i ’ Product Termx2x1’x0 Sum Termx2 + x1’ + x0 Minterm of n variables: A product of n variables in which every variable appears exactly once. Definitions
Implementation Spec Schematic Diagram Net list Obj min cost Switching expression (max performance) Cost: wires, gates Variables, product terms, sum terms We want to minimize # of terms, # of literals
Implementation (Optimization) Id a b f (a, b) a’b ab’ ab Karnaugh map – 2D truth table
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 f(a,b) = a + b
On the K-map however: b = 0 b = 1 a = 0 a = a’b ab’ ab f(a,b) = a + b
Another example Id a b f (a, b) a’b ab f(a,b) = a’b + ab = (a’ + a)b = b
On the K-map: b = 0 b = 1 a = 0 a = ab’ ab f(a,b) = b
Using Minterms Id a b f (a, b) a + b a ‘ + b f(a,b) = (a + b)(a’ + b) = b + aa’ = b + 0 = b
Two variable K-maps Id a b f (a, b) f (0, 0) f (0, 1) f (1, 0) f (1, 1) 2 variables means we have 2 2 entries and thus we have 2 to the 2 2 possible functions for 2 bits, which is 16. f(a,b) abab
Three variables K-maps Id a b c f (a,b,c,d)
Corresponding K-map c = 1 a = 1 b = (0,0) (0,1) (1,0) (1,0) a = 0 Gray code f(a,b,c) = a’
Another example Id a b c f (a,b,c,d)
Corresponding K-map c = 1 a = 1 b = (0,0) (0,1) (1,0) (1,0) a = 0 f(a,b,c) = b + ca’
Yet another example Id a b c f (a,b,c,d)
Corresponding K-map c = 1 a = 1 b = (0,0) (0,1) (1,0) (1,0) a = 0 f(a,b,c) = c’