SE140: omponents and Design Techniques for Digital Systems Simplification of logic functions Tajana Simunic Rosing 1
What we covered thus far: Number representations Where we are now inary, Octal, Hex, 1s & 2s complement ddition, subtraction, multiplication, division in binary oolean algebra Switches, MOS transistors, Delay What is next: Review of MOS transistors and gates Logic simplification 2
Making MOS gates 3
MOS Example 4
nother example 5
One more example 6
SE140: omponents and Design Techniques for Digital Systems ombinational functions Representations and Simplification Tajana Simunic Rosing Sources: 7
Logic Design Process: Three 1s Detector Problem: a Detect 3 consecutive 1s in 8-bit input: abcdefgh 00011101 01111000 10101011 Step 1: apture the function Truth table or equation? Truth table too big: 2^8=256 rows Equation: y = abc + bcd + cde +def+efg + efg + fgh a b c d abc bcd Step 2: Simplify if desired Step 3: Implement with gates e cde y f def g efg h fgh 8
anonical Form -- Sum of Minterms Truth tables are too big for numerous inputs Use standard form of equation instead Known as canonical form Regular algebra: group terms of polynomial by power ax 2 + bx + c (3x 2 + 4x + 2x 2 + 3 + 1 --> 5x 2 + 4x + 4) oolean algebra: create a sum of minterms Minterm: product term with every literal (e.g. a or a ) appearing exactly once Q: Determine if F(a,b)=ab+a is same function as F(a,b)=a b +a b+ab, by converting the first equation to canonical form 9
Sum-of-products canonical forms lso known as disjunctive normal form Minterm expansion: F = 001 011 101 1111 F = + + + + F F 1 1 1 0 1 1 1 0 1 1 1 0 1 1 0 1 1 1 1 0 F = + + 10
Sum-of-products canonical form (cont d) Product minterm NDed product of literals input combination for which output is 1 each variable appears exactly once, true or inverted (but not both) minterms 0 m0 1 m1 0 m2 1 m3 1 m4 1 m5 1 1 0 m6 1 1 1 m7 short-hand notation for minterms of 3 variables F in canonical form: F(,, ) = Σm(1,3,5,6,7) = m1 + m3 + m5 + m6 + m7 = + + + + canonical form minimal form F(,, ) = + + + + = ( + + + ) + = (( + )( + )) + = + = + = + 11
Product-of-sums canonical form lso known as conjunctive normal form lso known as maxterm expansion Implements zeros of a function F F 1 1 1 0 1 1 1 0 1 1 1 0 1 1 0 1 1 1 1 0 F = 00100 F = ( + + ) ( + + ) ( + + ) F = ( + + ) ( + + ) ( + + ) ( + + ) ( + + ) 12
Product-of-sums canonical form (cont d) Sum term (or maxterm) ORed sum of literals input combination for which output is false each variable appears exactly once, true or inverted (but not both) maxterms 0 ++ M0 1 ++ M1 0 + + M2 1 + + M3 1 ++ M4 1 ++ M5 1 1 0 + + M6 1 1 1 + + M7 short-hand hand notation for maxterms of 3 variables F in canonical form: F(,, ) = ΠM(0,2,4) = M0 M2 M4 = ( + + ) ( + + ) ( + + ) canonical form minimal form F(,, ) = ( + + ) ( + + ) ( + + ) = ( + + ) ( + + ) ( + + ) ( + + ) = ( + ) ( + ) 13
S-o-P, P-o-S, and de Morgan s theorem Sum-of-products F = + + pply de Morgan s (F ) = =( ( + + ) F = ( + + ) ( + + ) ( + + ) Product-of-sums F = ( + + ) ( + + ) ( + + ) ( + + ) ( + + ) pply de Morgan s (F ) = ( ( + + )( + + )( + + )( + + )( + + ) ) F = + + + + 14
Mapping between canonical forms Minterm to maxterm conversion use maxterms whose indices do not appear in minterm expansion e.g., F(,,) = Σm(1,3,5,6,7) = ΠM(0,2,4) Maxterm to minterm conversion use minterms whose indices do not appear in maxterm expansion e.g., F(,,) = ΠM(0,2,4) = Σm(1,3,5,6,7) Minterm expansion of F to minterm expansion of F use minterms whose indices do not appear e.g., F(,,) = Σm(1,3,5,6,7) F (,,) = Σm(0,2,4) Maxterm expansion of F to maxterm expansion of F use maxterms whose indices do not appear e.g., F(,,) = ΠM(0,2,4) F (,,) = ΠM(1,3,5,6,7) 15
Incompletely specified functions Example: binary coded decimal increment by 1 D digits encode the decimal digits 0 9 D W X Y Z 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 0 X X X X 1 1 X X X X 1 1 X X X X 1 1 X X X X 1 1 1 0 X X X X 1 1 1 1 X X X X Don t cares and canonical forms so far, only represented on-set also represent don t-care-set need two of the three sets (on-set, off-set, dc-set) off-set of W on-set of W don t care (D) set of W these inputs patterns should never be encountered in practice "don t care" about associated output values, can be exploited in minimization 16
lternative two-level implementations of F = + F1 F2 canonical sum-of-products minimized sum-of-products F3 canonical product-of-sums F4 minimized product-of-sums o s 17
SE140: omponents and Design Techniques for Digital Systems Logic simplification Tajana Simunic Rosing 18 Sources:
Simplification of two-level combinational logic Finding a minimal sum of products or product of sums realization exploit don t care information in the process lgebraic simplification not a systematic procedure how do you know when the minimum i realization has been found? omputer-aided design tools precise solutions require very long computation times, especially for functions with many inputs (> 10) heuristic methods employed "educated guesses" to reduce amount of computation and yield good if not best solutions Hand methods still relevant to understand automatic tools and their strengths and weaknesses ability to check results (on small examples) 19
The uniting theorem Key tool to simplification: ( + ) = Essence of simplification of two-level logic find two element subsets of the ON-set where only one variable changes its value this single varying variable can be eliminated and a single product term used to represent both elements F = + = ( +) = F 1 0 1 1 1 0 has the same value in both on-set rows remains has a different value in the two rows is eliminated 20
oolean cubes Visual technique for applying the uniting theorem n input variables = n-dimensional "cube" 1-cube X 01 11 Y 00 X 10 2-cube 111 1111 0111 3-cube Y 4-cube Z 101 Y Z 000 X W 1000 0000 X 21
Mapping truth tables onto oolean cubes Uniting theorem combines two faces" of a cube into a larger face" Example: F 1 0 1 1 1 0 01 F 11 00 two faces of size 0 (nodes) combine into a face of size 1(line) ON-set = solid nodes OFF-set = empty nodes D-set = 'd nodes varies within face, does not this face represents the literal ' 22
Three variable example inary full-adder carry-out logic ('+)in in out 1 0 1 1 1 0 1 1 1 1 1 1 1 1 000 111 101 (in'+in) (+')in the on-set is completely covered by the combination (OR) of the subcubes b of lower dimensionality - note that 111 is covered three times out = in++in 23
Higher dimensional cubes Sub-cubes of higher dimension than 2 011 010 110 001 111 101 F(,,) = Σm(4,5,6,7) on-set forms a square -a cube of dimension ion 2 000 100 This subcube represents the literal In a 3-cube (three variables): a 0-cube, i.e., a single node, yields a term in 3 literals a 1-cube, i.e., a line of two nodes, yields a term in 2 literals a 2-cube, i.e., a plane of four nodes, yields a term in 1 literal a 3-cube, i.e., a cube of eight nodes, yields a constant t term "1" In general, an m-subcube within an n-cube (m < n) yields a term with n m literals 24
Flat map of oolean cube wrap around at edges Karnaugh maps hard to draw and visualize for more than 4 dimensions virtually impossible for more than 6 dimensions lternative e to truth-tables th tables to help visualize adjacencies guide to applying the uniting theorem on-set elements with only one variable changing value are adjacent unlike the situation in a linear truth-table 0 1 1 0 2 1 1 3 F 1 0 1 1 1 0 25
Karnaugh maps (cont d) Numbering scheme based on Gray code e.g., 00, 01, 11, 10 only a single bit changes in code for adjacent map cells 01 0 1 0 2 1 3 0 2 11 10 6 4 7 5 1 3 7 5 6 4 0 4 1 5 12 8 13 9 D 3 7 15 11 2 6 14 10 13 = 1101= D 26
djacencies in Karnaugh maps Wrap from first to last column Wrap top row to bottom row 0010 1100 010 011 110 111 001 011 111 101 001 101 000 100 27
Karnaugh map examples F = 1 1 out = 1 0 in 1 1 f()=σm(0457) f(,,) Σm(0,4,5,7) 01 11 10 0 1 0 2 6 4 1 3 7 5 1 1 1 1 28
More Karnaugh map examples 1 1 1 1 1 1 1 1 F(,,) = Σm(0,4,5,7) 1 1 1 0 F' simply replace 1's with 0's and vice versa F'(,,) = Σ 29
Karnaugh map: 4-variable example F(,,,D) = Σm(0,2,3,5,6,7,8,10,11,14,15) F = 1 0 1111 0111 1 1 1 1 1 1 1 1 D 0000 D 1000 find the smallest number of the largest possible subcubes to cover the ON-set (fewer terms with fewer inputs per term) 30
Karnaugh maps: don t cares f(,,,d) = Σ m(1,3,5,7,9) + d(6,12,13) without don't cares with don t cares f = f = X 0 X 0 1 1 X 1 1 1 0 X D 1 1 X 1 1 1 0 X D don't cares can be treated as 1s or 0s depending on which is more advantageous 31
Example F = Σ m(0, 2, 7, 8, 14, 15) + d(3, 6, 9, 12, 13) 1 0 X 1 1 0 X 1 X X X X D X 1 1 0 1 X 1 0 1 X 1 0 X 1 1 0 1 0 X 1 D X X X 1 1 0 1 X 1 0 D 32
Design example: two-bit comparator N1 N2 D LT < D EQ = D GT > D block diagram and truth table D LT EQ GT 0 1 0 1 1 0 1 1 1 1 1 0 1 1 0 1 1 1 0 0 0 0 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 0 we'll need a 4-variable Karnaugh map for each of the 3 output t functions 33
Design example: two-bit comparator (cont d) 1 0 1 1 1 0 D D 1 1 D 1 1 1 1 1 0 1 0 K-map for LT K-map for EQ K-map for GT LT = EQ = GT = ' ' D + ' + ' D ' ' ' D' + ' ' D + D + ' D = ( xnor ) ( xnor D) ' D' + ' + D' LT and GT are similar (flip / and /D) 34
Design example: 2x2-bit multiplier 2 1 2 1 P8 P4 P2 P1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 P1 1 0 1 0 0 0 2 P2 1 0 1 P4 1 1 1 1 2 P8 1 0 1 0 1 1 1 1 1 0 1 1 block diagram 1 1 and 1 1 1 0 truth table 1 1 1 1 4-variable K-map for each of the 4 output functions 35
Design example: 2x2-bit multiplier (cont d) 2 K-map for P8 K-map for P4 2 1 1 2 1 0 2 1 1 1 1 2 2 K-map for P2 K-map for P1 1 1 1 1 0 1 2 1 0 2 1 0 1 1 36
Design example: D + 1 I8 I4 I2 I1 O8 O4 O2 O1 1 0 1 1 1 1 I1 O1 1 0 I2 O2 1 1 1 1 I4 O4 1 1 1 0 1 1 I8 O8 1 1 1 0 X X X X 1 1 X X X X 1 1 X X X X 1 1 X X X X block diagram 1 1 1 0 X X X X and 1 1 1 1 X X X X truth table 4-variable K-map for each of the 4 output functions 37
Design example: D + 1 (cont d) I8 X 1 O8 O4 I8 X 0 X 0 I1 X 0 I1 I2 X X X X I2 1 0 X X X X I4 I4 I8 X 0 O2 O1 1 1 I8 X 1 1 1 X 0 I1 X 0 I1 I2 X X 1 1 X X I2 X X 1 1 X X I4 I4 38
lgorithms for simplification & logic realization Simplification two-level simplification exploiting don t cares Logic realization two-level logic and canonical forms realized with NNDs and NORs multi-level logic, converting between NDs and ORs 39
Definition of terms for two-level simplification Implicant single element of ON-set or D-set or any group of these elements that can be combined to form a subcube Prime implicant implicant that can't be combined with another to form a larger subcube Essential prime implicant prime implicant is essential if it alone covers an element of ON-set will participate in LL possible covers of the ON-set D-set used to form prime implicants but not to make implicant essential Objective: grow implicant into prime implicants (minimize literals per term) cover the ON-set with as few prime implicants as possible (minimize number of product terms) 40
Examples to illustrate terms 0 X 1 0 1 1 1 0 1 0 1 1 1 1 D 6 prime implicants: ''D, ',, ''D,, 'D essential minimum cover: + ' + ''D 5 prime implicants: 1 0 D, ', D,', ''D 1 1 1 0 D essential minimum cover: 4 essential implicants 1 1 41
lgorithm for two-level simplification lgorithm: minimum sum-of-products expression from a Karnaugh map Step 1: choose an element of the ON-set Step 2: find "maximal" groupings of 1s and Xs adjacent to that element consider top/bottom row, left/right column, and corner adjacencies this forms prime implicants (number of elements always a power of 2) Repeat Steps 1 and 2 to find all prime implicants Step 3: revisit the 1s in the K-map if covered by single prime implicant, it is essential, and participates in final cover 1s covered by essential prime implicant do not need to be revisited Step 4: if there remain 1s not covered by essential prime implicants select the smallest number of prime implicants that cover the remaining 1s 42
lgorithm for two-level simplification (example) X 1 X 1 X 1 1 1 0 X X 0 D 1 1 0 X X 0 D 2 primes around ''D' 1 1 0 X X 0 2 primes around 'D D X 1 X 1 X 1 1 1 0 X X 0 D 1 1 0 X X 0 D 1 1 0 X X 0 3 primes around ''D' 2 essential primes minimum cover (3 primes) 43 D
Example List all prime implicants for the following K-map: X 0 X 0 X 1 0 X X 0 X 1 1 1 D Which are essential prime implicants? What is the minimum cover? 44
What we covered thus far: Number representations Switches MOS transistors Logic gates oolean algebra Logic representations SOP and POS K-maps lgorithm for simplification Summary 45