8 Lecture 22: Implementing ombinational Logic S 5 L22 James. Hoe Dept of EE, MU April 9, 25 Today s Goal: Design some combinational logic circuits Announcements: Read Rizzoni 2.4 and 2.5 HW 8 due today Handouts: Lab for week of 4/2 (on lackboard) HW 9 due Tuesday 4/2 (on lackboard) HW 8 Solutions (on lackboard later today) S 5 L22 2 Universality of NAND and NOR Gates Either NAND or NOR is sufficient to implement AND/OR/NOT convenient because inverting logic gates arise naturally in transistor based implementations NOT gate: X X X X AND gate OR gate X X ut still, how do we know AND/OR/NOT is sufficient to implement any combinational function imaginable? X X+ X X X X+
Let s Design Something S 5 L22 3 Input: bit A, bit, and bit Output: 2 bit S that is a 2 bit unsigned integer; indicates how many bits of the input A, and are asserted; possible values are,, 2, 3 Start with the Truth Table 2 N rows for a function of N inputs better to enumerate input patterns systematically, e.g., as if counting uniquely and unambiguously define a combinational function Now what? A S[] S[] anonical Sum of Products (SOP) S 5 L22 4 Each row of a truth table corresponds to a distinct input combination (aka, a minterm ) e.g., row corresponds to A, aka m row corresponds to A, aka m row 2 corresponds to A, etc. onstruct a function by OR ing the minterms in the on set (i.e., the s) S[]=A +A +A +A m m2 m4 m7 S[]=A +A +A +A m3 m5 m6 m7 aka m2 A S[] S[]
2 level SOP Implementation S[]=A +A +A +A each minterm is a product (AND is boolean multiply) S[] is the sum of products (OR is boolean addition) Every function has a truth table; every truth table has a corresponding canonical SOP form every fxn can be implemented using AND/OR/NOT S 5 L22 5 A S[] Try S[] on your own NAND NAND is SOP S 5 L22 6 What if you have only NANDs A S[]
anonical Product of Sums (POS) S 5 L22 7 What if the truth table is mostly s and you are too lazy to write out all those minterms? ANS: write SOP for F E.g., F =A +A Apply De Morgan to get back F in POS form F=(A++)(A ++ ) This is a maxterm, that is, (A++) is true everywhere except A A F 2 level POS Implementation F=(A++)(A ++ ) each maxterm is a sum (OR is boolean addition) F is the product of sums (AND is boolean multiply) Every function also has a canonical POS form NOR NOR is POS S 5 L22 8 A F
Minimum SOP Form Simplified SOP expression that minimizes the number of gates and the number of input to gates, e.g., F =A +A +A +A +A =A +A +A +A +A+A rule 3 =A +A +A +A+A +A rule =A +A +A +A+A( +) rule 4 =A +A +A +A+A rule 4 =A +A +A +A+A rule 6 Let s make the last 3 steps into a theorem X +X=X( +)=X =X (Uniting Theorem) F = (A +A )+(A +A)+A = A +A+A = +A an we do any better? If not, can we know for sure? S 5 L22 9 A F Applying the Uniting Theorem S 5 L22 How to recognize opportunities to unite? A F looking for pairs of minterms in the on set that are distance (reachable by toggling one input) E.g., A and A F asserted if A, independent of replace A +A by A in SOP ut this is tricky to do... not all minterm neighbors are easy to see in a truth table united terms themselves can be further united, e.g., A +A=
Truth Table on a ube S 5 L22 A A A A = = A= A A A A A F Truth Table on a ube S 5 L22 2 A :: A:: A :: A :: = = A= A :: A :: A :: A :: F =A +A +A +A+A F= + A A F
Karnaugh Map (K map) = half S 5 L22 3 A A A A A= half A A A A = half Same as the 3 d cube before, but easier to draw each minterm has 3 adjacent neighbors minterms that differ in only input are adjacent A any two adjacent minterms form a d sub cube any 4 minterms in a rectangle or square form a 2 d sub cube A A A A A A A Karnaugh Map (K map) A F = A +A +A +A+A F = A +A+A = ++A F = + A each product is an implicant of F; i.e., a sufficient condition for F S 5 L22 4 A F Finding minimum SOP corresponds to covering all members of the onset using the largest cubes possible without redundant cubes
ADF 4 Variable Hypercube (Example 2.) = = A= D= S 5 L22 5 4 Variable K map: Example 2. S 5 L22 6 D F= AD+ D + + A D A Attempt to cover using, in order, 4 d, 3 d, 2 d, d, d (minterm) cubes Stop when all members of the on set are covered heck for redundancies (e sure to study examples in Rizzoni 2.4)
Does X+Z+X Z=X+X Z? S 5 L22 7 Z X Proof strategy I Expand X, Z, X Z to the 4 minterms Unite XZ and XZ to X; unite X Z and X Z to X Z Proof strategy II expand Z to minterms XZ and X Z XZ absorbs into X; X Z absorbs into X Z Does X+Z+X Z=X+X Z? S 5 L22 8 X+Z+X Z =X +Z +X Z rule 6 = X(Z+Z )+Z(X+X )+X Z(+ ) rule 4 = XZ+XZ +ZX+ZX +X Z+X Z rule 4 = XZ+XZ +XZ+X Z+X Z+X Z rule =XZ+XZ+XZ +X Z+X Z+X Z rule = XZ+XZ +X Z+X Z rule 3 = X(Z+Z )+X Z(+ ) rule 4 =X +X Z rule 4 =X+X Z rule 6
Does X+Z+X Z=X+X Z? (done another way) X+Z+X Z = X+Z +X Z rule 6 = X+Z(X+X )+X Z rule 4 = X+ZX+ZX +X Z rule 4 = X+XZ+X Z+X Z rule = X+XZ+X Z+X Z rule = X +XZ+X Z +X Z rule 6 = X(+Z)+X Z(+) rule 4 =X +X Z rule 2 =X+X Z rule 6 rule 5 absorption S 5 L22 9 Don t are S 5 L22 2 D code encodes a decimal digit using 4 bits as 2 ; as 2 ;.; 9 as 2 the patterns 2 ~ 2 are not used Suppose F controls the on/off of this segment of a 7 segment display F= for,,,,,, for,, don t care for ~ In a K map, don t care can have cake and eat it too treat them as s to enable larger cube covers but also okay to leave uncovered (like s)
4 Variable Example with Don t are S 5 L22 2 D x x x x x x F= +D + A F= for AD=,,,,,, for AD=,, don t care for AD= ~? Tricky K map Example S 5 L22 22 D A Following the simple K map recipe will result in a redundant cover in this example.
Useful K map onventions S 5 L22 23 Think of min terms in a truth table like binary numbers With N inputs, count from to 2 N For example, N=4 W X Z corresponding minterm W X Z W X Z W X Z W X Z WX Z WXZ WXZ Useful K map onventions onsistency saves time and reduces errors, e.g., N=4 vary the 2 more significant bits (WX) left and right vary the 2 less significant bits (Z) up and down. Transcribing from T table to K map by Gray counting the neighboring columns (or rows) differ by only bit > > > (and not > > >) W W S 5 L22 24 WX= WX= WX= WX= WX= WX= WX= WX= Z= Z= Z= Z= Z Z= Z= Z= Z= W X Z W X Z WX Z WX Z W X Z W X Z WX Z WX Z W X Z W XZ WXZ WX Z W X Z W XZ WXZ WX Z Z X X