150 likes | 157 Views
This lecture covers the specification, implementation, and optimization of combinational logic circuits using truth tables, minterms, maxterms, and Karnaugh maps.
E N D
CS 140 Lecture 2 Combinational Logic CK Cheng 4/04/02
I. Combinational Logic1. Specification Keywords: Truth Table Minterm a * b * c Maxterm a + b + c Some Identities: x * 0 = 0 x + 0 = x x * 1 = x x + 1 = 1
Example Id a b c a’bc a+b’+c 0 0 0 0 0 1 1 0 0 1 0 1 2 0 1 0 0 0 3 0 1 1 1 1 4 1 0 0 0 1 5 1 0 1 0 1 6 1 1 0 0 1 7 1 1 1 0 1
Incompletely Specified Function Id a b f (a, b) 0 0 0 1 1 0 1 0 2 1 0 1 3 1 1 - • The input does not happen. • The input happens, but the output is ignored. If it is not specified, it gives us flexibility to optimize the logic. • Examples: • Decimal number 0… 9 uses 4 bits. (1,1,1,1) does not happen. • If addition overflows, we don’t care about the sum.
There are three sets On Set F = Sm (1) Off Set R = Sm(0,2) Don’t Care Set D = Sm(3) Definitions: Literals xi or xi’ Product Term x2x1’x0 Sum Term x2 + x1’ + x0 Minterm of n variables: A product of n variables which every variable appears exactly once. Maxterm of n variables Obj: minimize (1) number of terms, (2) number of literals.
II. Implementation Karnaugh map – 2D table Id a b f (a, b) 0 0 0 0 1 0 1 1 2 1 0 1 3 1 1 1 Determines row a = 0 a = 1 0 2 0 1 1 1 b = 0 b = 1 1 3 Determines column
Function can be represented by sum of minterms: f(a,b) = a’b + ab’ + ab We want to minimize the number of literals and terms however. We factor out common terms – ab’ + ab = a(b’+b) = a * 1 = a a + a = a ab + ab = ab f(a,b) = a + b
On the K-map however: a = 0 a = 1 ab’ 0 2 0 1 1 1 b = 0 b = 1 1 3 a’b ab
Two variable K-maps Id a b f (a, b) 0 0 0 f (0, 0) 1 0 1 f (0, 1) 2 1 0 f (1, 0) 3 1 1 f (1, 1) 2 variables means we have 22 entries and thus we have 2 to the 22 possible functions for 2 bits. a b f(a,b)
All possible 2 variable functions 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 b b b b b b b b b b b b b b b b a a a a 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 1 0 0 1 0 0 1 1 1 0 0 1 1 0 1 0 0 1 0 1 0 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1
K-maps and Corresponding functions 0 2 0 2 0 2 0 2 1 3 1 3 1 3 1 3 b b b a 0 1 0 1 f(a,b) = ab’ + ab = a b 1 0 1 1 f(a,b) = a’b + ab 1 0 1 0 f(a,b) = a’b + a’b’ = a’ 1 1 0 0 f(a,b) = b’a’ + b’a = b’
Three variables K-maps Id a b c f (a,b,c,d) 0 0 0 0 0 1 0 0 1 1 2 0 1 0 1 3 0 1 1 - 4 1 0 0 0 5 1 0 1 0 6 1 1 0 1 7 1 1 1 1
Corresponding K-map b = 1 Gray code (a,b) (0,0) (0,1) (1,0) (1,0) 0 2 6 4 c = 0 0 1 1 0 1 3 7 5 c = 1 1 - 1 0 a = 1 f(a,b,c) = a’b’c + a’bc’ + abc’ + abc + a’bc = a’bc + b = a’c + b
Another example in reverse direction f(a,b,c) = a’c Id a b c a’c 0 0 0 0 0 1 0 0 1 1 2 0 1 0 0 3 0 1 1 1 4 1 0 0 0 5 1 0 1 0 6 1 1 0 0 7 1 1 1 0
Corresponding K-map b 0 2 6 4 0 0 0 0 1 3 7 5 c 1 1 0 0 a a’c This rectangle correpsonds to the case where a is 0 and c is 1.