620 likes | 633 Views
Learn about Boolean algebra, logic diagrams, and truth tables in digital techniques.
E N D
Organizational Remarks • I don’t use the exercises in Mano/Kime; this way you can use them as review exercises (for many of them there are solutions on the web: www.prenhall.com/mano). Digital Techniques Fall 2007 André Deutz, Leiden University
Remarks • Two’s complement • For the math minded, otherwise ignore: • Boolean ring is not a Boolean algebra; • given a Boolean ring you can equip it with a Boolean algebra structure (and conversely): a ∧ b := ab (AND) a ∨ b := a+b – ab (OR) a’ := 1 + a (NOT) Digital Techniques Fall 2007 André Deutz, Leiden University
Remarks • For the math minded, otherwise ignore: • given a Boolean algebra you can equip it with a Boolean ring structure: xy := x ∧ y, x + y := (x ∨ y) ∧ ~(x ∧ y). (∧ =AND, ∨=OR, ~=NOT; the given operations of the Boolean algebra) Digital Techniques Fall 2007 André Deutz, Leiden University
Logic diagrams, Boolean expressions, and Truth(1/0) Tables • LDs BEs TTs Digital Techniques Fall 2007 André Deutz, Leiden University
Logic diagrams (LDs), Boolean Expressions (BEs), and Truth Tables (TTs) (or 1/0-tables) • The object which is lurking behind the scenes is of the course the notion of a Boolean logic function (or for short: a Boolean function): a Boolean function of n variables is a mapping from the set {0,1}n to the set {0,1}. (What do you mean by {0,1}n ? … ) • Of course, a Boolean function is completely determined by a Truth table (1/0-table) Digital Techniques Fall 2007 André Deutz, Leiden University
LDs, BEs, and TTs • LDs BEs TTs • Each Boolean function has a unique TT • In general: a Boolean function or a TT can have more than one LD (or for that matter BE) associated to it. • For any two of (LD, BE, TT) can readily go back and forth Digital Techniques Fall 2007 André Deutz, Leiden University
LDs, BEs, and TTs • For any two of (LD, BE, TT) can readily go back and forth • From TT to BE: for each 1 in the output introduce an appropriate minterm (a product term which • contains each of the variables or their negation), then S is the • sum of these minterms: A’B’C A’BC’ AB’C’ ABC S = A’B’C +A’BC’ + AB’C’ + ABC Digital Techniques Fall 2007 André Deutz, Leiden University
LDs, BEs, and TTs; BE TT S = A’B’C +A’BC’ + AB’C’ + ABC • How do you get the Truth Table (1/0-table)? Etc. • We have done also the transition from TT to LD. Given the LD it is not difficult to come up with the TT. • It is also not difficult to imagine how you would go directly from LD to BE and vice versa. • Make sure that you are conversant with all possible transitions Digital Techniques Fall 2007 André Deutz, Leiden University
Reduction (Simplification) of Boolean Expressions • It is usually possible to simplify the canonical SOP (or POS) forms. • A smaller Boolean equation generally translates to a lower gate count in the target circuit. • We cover three methods: algebraic reduction, Karnaugh map reduction, and tabular (Quine-McCluskey) reduction. Digital Techniques Fall 2007 André Deutz, Leiden University
Reduced Majority Function Circuit • Compared with the AND-OR circuit for the unreduced majority function, the inverter for C has been eliminated, one AND gate has been eliminated, and one AND gate has only two inputs instead of three inputs. Can the function by reduced further? How do we go about it? Digital Techniques Fall 2007 André Deutz, Leiden University
The Algebraic Method • Consider the majority function, F. We apply the algebraic method to reduce F to its minimal two-level form: Digital Techniques Fall 2007 André Deutz, Leiden University
An Aside from Alfred Tarski • What did you mean in high school by the following statement: (a+b)(a-b) = a2 – b2? • As such it can be confusing; it is not an equation but an identity; the following is much better: For all a in R, for all b in R [(a+b)(a-b) = a2 – b2 ]; R stands for the real numbers. • And so it goes when we say in Boolean algebra context: aa=a. We mean: For all a in B={0, 1} [aa =a] Digital Techniques Fall 2007 André Deutz, Leiden University
An Aside from Alfred Tarski • And so it goes when we say in Boolean algebra context: aa=a. We mean: For all a in B={01,} [aa =a] • Or another example: • a’bc+ab’c+abc’+abc = bc+ac+ab (pertains to the majority function) • Let B={0,1}. • For all a in B, for all b in B, for all c in B: [a’bc+ab’c+abc’+abc = bc+ac+ab] • Or say: 3) is shorthand for 5) Digital Techniques Fall 2007 André Deutz, Leiden University
The Algebraic Method • This majority circuit is functionally equivalent to the previous majority circuit, but this one is in its minimal two-level form: Digital Techniques Fall 2007 André Deutz, Leiden University
Karnaugh Maps: Venn Diagram Representation of Majority Function • Each distinct region in the “Universe” represents a minterm. • This diagram can be transformed into a Karnaugh Map. Digital Techniques Fall 2007 André Deutz, Leiden University
K-Map for Majority Function • Place a “1” in each cell that corresponds to that minterm. • Cells on the outer edge of the map “wrap around” A C B Digital Techniques Fall 2007 André Deutz, Leiden University
Adjacency Groupings for Majority Function Slightly different bookkeeping (no conceptual change): B B • F = BC + AC + AB B C A A 0 3 2 1 A 4 7 6 5 A 0 2 6 4 C C C 3 1 7 5 C B B C A 00 01 11 10 1 0 3 2 1 0 B 1 1 1 1 4 7 6 5 1 A C Digital Techniques Fall 2007 André Deutz, Leiden University
Minimized AND-OR Majority Circuit • F = BC + AC + AB • The K-map approach yields the same minimal two-level form as the algebraic approach. Digital Techniques Fall 2007 André Deutz, Leiden University
K-Map Groupings • Minimal grouping is on the left, non-minimal (but logically equivalent) grouping is on the right. • To obtain minimal grouping, create smallest groups first. B A D C Digital Techniques Fall 2007 André Deutz, Leiden University
K-Map Corners are Logically Adjacent Slightly different bookkeeping (no conceptual change): CD 01 00 11 10 AB C A 00 01 D 11 1 1 C B 10 1 1 1 1 A B 1 D 1 1 1 F = B C D + B D + A B Digital Techniques Fall 2007 André Deutz, Leiden University
K-Maps and Don’t Cares • There can be more than one minimal grouping, as a result of don’t cares. Digital Techniques Fall 2007 André Deutz, Leiden University
Five-Variable K-Map • Visualize two 4-variable K-maps stacked one on top of the other; groupings are made in three dimensional cubes. Digital Techniques Fall 2007 André Deutz, Leiden University
Six-Variable K-Map • Visualize four 4-variable K-maps stacked one on top of the other; groupings are made in three dimensional cubes.
Minimization (mainly 2-level circuits) • K-maps (more elaborately) • Quine-McCluskey Algorithm Digital Techniques Fall 2007 André Deutz, Leiden University
Minimization • With respect to minimizing logic, there are several parameters that can be used • For instance: the number of gates • less cost • Less area on a chip • Less power requiremen • Less heat dissipation • More reliability • We can also use total number of gate inputs (including inverters: GN) (since the cost of the gate and the associated wiring increases with the number of inputs; wiring: effects speed and chip area) • Number of literals (see slide 32) Digital Techniques Fall 2007 André Deutz, Leiden University
Minimization • GN Example: A`B`CD`+ A`B`CD+ A`BC`D`+ A`BC`D+ AB`CD+ ABC`D`+ ABC`D+ ABCD; 4 for inverters (one for each input variable, 8*4 for AND-gates, and 8 for the final OR-gate, a total of 44; (i.e., GN=44); the number of gates is 13 (8 ANDs, 1 OR, and 4 NOTs) • Definition: A Boolean SoP form is said to be minimal if it contains a minimal number of product terms and literals – note that the definition involves two criteria. • A minimum SoP form corresponds to a two level logic circuit having the fewest gates and the fewest number of gate inputs Digital Techniques Fall 2007 André Deutz, Leiden University
Minimization • Fortunately we can work with one criterion – the number of gate inputs: we seldom encounter functions where the implementation with the smallest number of gate inputs, for example, is not also the implementation with the smallest number of gates • Secondly we can have more than one minimum: • f(A,B,C) = ABC+A`BC+ABC`+A`B`C+AB`C`+A`B`C` • Equivalently: AC`+A`C+BC+B`C` • And equivalently: AB+BC+B`C`+A`B` Digital Techniques Fall 2007 André Deutz, Leiden University
Irredundant Form • An irredundant form is a logic expression of which no part can be deleted without changing the function that corresponds to it (sort of a “locally” mininum ) • For instance: a SoP (Sum-of-Products) expression is irredundant if the deletion of any p-term or the deletion of any literal in any p-term changes the function (corresponding to the original SoP). • Conversely: A SoP expression is redundant if it is possible to delete some literal or some product term without changing the corresponding function. Digital Techniques Fall 2007 André Deutz, Leiden University
Example of Irredundant SoP Can be deleted • Consider the f(A,B,C) = A`C`+A`BC+AC+AB`+B`C` • Applying consensus thm we see: A`C`+AB`+B`C`=A`C`+AB` so the last term in f -- B`C` -- can be deleted: • f(A,B,C) = A`C`+A`BC+AC+AB`= A`(C`+BC)+AC+AB`=A`(C`+B)+AC+AB` =A`C`+A`B+AC+AB` (1) • This is expression is irredundant (= deletion of any p-term or the deletion of any literal in any p-term changes the function) • Is A`C`+A`B+AC+AB`minimal SoP expression? NO!!!!: f(A,B,C) is also equal to A`C`+BC+AB` (2) Can be deleted Digital Techniques Fall 2007 André Deutz, Leiden University
Example of Irredundant SoP (cont’d) • f(A,B,C) =A`C`+A`B+AC+AB` (1)f(A,B,C) is also equal to A`C`+BC+AB` (2) • (1) and (2) are irredundant, (2) cannot be obtained from (1); (2) is minimal Digital Techniques Fall 2007 André Deutz, Leiden University
Minimization (connection with book) • Description of cost criteria in the book: • Literal cost (L): all gate inputs from outside the circuit • Gate input cost (G): all gate inputs from within the circuit, except for those to inverters • Gate input cost with NOTs (GN): same as G plus inputs which need to be complemented Digital Techniques Fall 2007 André Deutz, Leiden University
Literal Cost • Literal – a variable or its complement • Literal cost – the number of literal appearances in a Boolean expression corresponding to the logic circuit diagram • F=BD+AB`C+AC`D` L = 8 • F=BD+AB`C+AB`D`+ABC` L= ? • F=(A+B)(A+D)(B+C+D`)(B`+C`+D) L=? • Which solution is best? Digital Techniques Fall 2007 André Deutz, Leiden University Digital Techniques Fall 2007 André Deutz, Leiden University
Gate Input Cost • Gate input costs - the number of inputs to the gates in the implementation corresponding exactly to the given equation or equations. (G - inverters not counted, GN - inverters counted) • For SOP and POS equations, it can be found from the equation(s) by finding the sum of: • all literal appearances • the number of terms excluding single literal terms,(G) and • optionally, the number of distinct complemented single literals (GN). • F=BD+AB`C+AC`D` G = 8. GN=11 • F=BD+AB`C+AB`D`+ABC` G= ?, GN=? • F=(A+B)(A+D)(B+C+D`)(B`+C`+D) G=?, GN=? • Which solution is best? Digital Techniques Fall 2007 André Deutz, Leiden University
GN = G + 2 = 9 L = 5 G =L+ 2 = 7 B C A F • L (literal count) counts the AND inputs and the single literal OR input. • G (gate input count) adds the remaining OR gate inputs C B • GN(gate input count with NOTs) adds the inverter inputs Cost Criteria (example) • Example 1: • F = A + B C + Digital Techniques Fall 2007 André Deutz, Leiden University
B A A B C F A B C F A C C B Cost Criteria (example) • Example 2: • F = A B C + • L = 6 G = 8 GN = 11 • F = (A + )( + C)( + B) • L = 6 G = 9 GN = 12 • Same function and sameliteral cost • But first circuit has bettergate input count and bettergate input count with NOTs • Select it! Digital Techniques Fall 2007 André Deutz, Leiden University
Minimization • NB: we concentrate on 2-level circuit minimization (minimization corresponding to SoPs (PoSs)) Digital Techniques Fall 2007 André Deutz, Leiden University
Y 0 1 X 1 1 0 1 X Y 0 1 1 0 1 1 Y 0 1 X 1 0 1 1 1 Simplifying a Boolean Function using 2-variable K-map (examples) Given functions: Simplified functions: F1(X,Y) = Σm(0,1) == X’Y’ + X’Y F1(X,Y) = X’ F2(X,Y) = Σm(0,3) == X’Y’ + XY F2(X,Y) = X’Y’ + XY F3(X,Y) = Σm(0,2,3) == X’Y’ + XY’ + XY F3(X,Y) = X + Y’ Y 0 1 1 1 F4(X,Y) = Σm(0,1,2,3) == X’Y’ + X’Y + XY’ + XY 0 F4(X,Y) = 1 1 1 1 Digital Techniques Fall 2007 André Deutz, Leiden University
Y 1 00 01 11 10 0 m0 m1 m3 m2 X 1 m4 m5 m7 m6 Z X’Z YZ X’Y’ X’Y X’Z’ Y Y 00 01 11 10 00 01 11 10 0 m0 m1 m3 m2 0 m0 m1 m3 m2 X 1 m4 m5 m7 m6 X 1 m4 m5 m7 m6 XY’ XZ’ XY Y’Z XZ Z Z Y Z Z’ X’ Y 00 01 11 10 00 01 11 10 0 m0 m1 m3 m2 0 m0 m1 m3 m2 X 1 m4 m5 m7 m6 X 1 m4 m5 m7 m6 Y Y’ Z X Z Simplifying a Boolean Function using 3-variable K-map (groupings) minterm m3 m0 m2 m1 m4 m5 m7 m6 • Group of 4 adjacent cells gives product term of one literals. • Group of 2 adjacent cells gives product term of two literals. Digital Techniques Fall 2007 André Deutz, Leiden University
Y YZ 00 01 11 10 X 1 1 0 1 1 X 1 Z Y YZ 00 01 11 10 X 1 1 0 1 1 1 X Z Y YZ 00 01 11 10 X 1 1 0 1 1 1 X Simplifying a Boolean Function using 3-variable K-map (examples) Given functions: Simplified functions: F1(X,Y,Z) = Σm(1,2,4,7) Simplification is not possible F2(X,Y,Z) = XY’ + X’Y F2(X,Y,Z) = Σm(2,3,4,5) F3(X,Y,Z) = Σm(0,2,4,6) F3(X,Y,Z) = Z’ Z Y YZ 00 01 11 10 X 1 1 1 1 0 F4(X,Y,Z) = Σm(0,1,2,3,4,6,7) F4(X,Y,Z) = X’ + Y 1 1 1 X Z Digital Techniques Fall 2007 André Deutz, Leiden University
Simplifying a Boolean Function using 3-variable K-map (more examples) Y YZ Given functions: Simplified functions: 00 01 11 10 X 1 0 F5(X,Y,Z) = XZ’ + YZ F5(X,Y,Z) = Σm(3,4,6,7) 1 1 1 1 X Z Y YZ 00 01 11 10 X F6(X,Y,Z) = Z’ + XY’ 1 1 0 F6(X,Y,Z) = Σm(0,2,4,5,6) 1 1 1 1 X Z Y YZ 00 01 11 10 X F7(X,Y,Z) = Z + X’Y 1 1 1 0 F7(X,Y,Z) = Σm(1,2,3,5,7) 1 1 1 X F8(X,Y,Z) = XZ’+X’Z +Y’Z or F8(X,Y,Z) = XZ’+X’Z +XY’ Not unique solution Z Y YZ 00 01 11 10 X 1 1 0 F8(X,Y,Z) = Σm(1,3,4,5,6) 1 1 1 1 X Z Digital Techniques Fall 2007 André Deutz, Leiden University
Y Y Y Y YZ YZ YZ YZ 00 00 00 00 01 01 01 01 11 11 11 11 10 10 10 10 WX WX WX WX m0 m0 m0 m0 m1 m1 m1 m1 m3 m3 m3 m3 m2 m2 m2 m2 00 00 00 00 01 01 01 01 m4 m4 m4 m4 m6 m6 m6 m6 m5 m5 m5 m5 m7 m7 m7 m7 X X X X m12 m12 m12 m12 m13 m13 m13 m13 m15 m15 m15 m15 m14 m14 m14 m14 11 11 11 11 W W W W 10 10 10 10 m8 m8 m8 m8 m10 m10 m10 m10 m9 m9 m9 m9 m11 m11 m11 m11 Z Z Z Z Simplifying a Boolean Function using 4-variable K-map (grouping examples) • Group of 2 adjacent cells gives product term of 3 literals. • Group of 4 adjacent cells gives product term of 2 literals. W’X’Z’ X’Z’ W’YZ W’Y’ WY WXY X’Y’Z • Group of 8 adjacent cells gives product term of 1 literals. • Group of all cells givesconstant one. 1 Z’ W Digital Techniques Fall 2007 André Deutz, Leiden University
Y YZ 00 01 11 10 Y YZ WX 00 01 11 10 WX 1 1 1 00 1 1 1 00 1 1 01 1 X 1 1 1 01 1 1 1 11 X W 1 1 11 1 1 10 W 1 1 1 10 Z Z Y YZ 00 01 11 10 WX 1 1 1 00 1 01 X 11 W 1 10 1 1 Z Simplifying a Boolean Function using 4-variable K-map (examples) Given function: F2(W,X,Y,Z) == Σm(0,1,2,4,5,6,8, 9,12,13,14) Simplified function: F2(W,X,Y,Z) = = Y’ + W’Z’+ XZ’ Given function: Given function: F3(W,X,Y,Z) = W’X’Y’ + X’YZ’ + WX’Y’ + W’XYZ’ F1(W,X,Y,Z) == Σm(0,1,2,4,5,7,8,9,10,12,13) Simplified function: Simplified function: F1(W,X,Y,Z) = = Y’ + X’Z’+ W’XZ F3(W,X,Y,Z) = = X’Y’ + X’Z’+ W’YZ’ Digital Techniques Fall 2007 André Deutz, Leiden University
Grouping Cells in a K-map Systematically • The procedure for combining cells in a K-map may be made more systematic if we introduce the terms: implicants, prime implicants, and essential prime implicants. • An Implicant(I) of a function F is a product term which implies F, i.e., F = 1 whenever I = 1. • All minterms of a function F are implicants of F. • All rectangles in a K-map made up of cells containing 1s correspond to implicants. • An implicant of F is called a Prime Implicant(PI) if any product term obtained by deleting a literal of PI is NOT an implicant of F. • (Equivalently: An implicant P of F is prime, if there is no implicant I of F such that P implies I.) • Thus, a prime implicant is not contained in any “larger” implicant. • On a K-map of n-variable function, the set of prime implicants corresponds to the set of all rectangles made up of 2m cells containing 1s (m = 0, 1,2,…,n), with each rectangle containing as many cells as possible. Digital Techniques Fall 2007 André Deutz, Leiden University
Example of Prime Implicants (PIs) • Consider function F(W,X,Y,Z) whose K-map is shown at right. • Product terms Z’, XY, WX’Y’are prime implicants. Why? • Consider the term XYand obtain terms by deleting any literal: • We get two terms: term Xand term Y. • Both terms are NOT implicants of F. • Thus, the term XY is prime implicant. • Y’Z’is not a prime implicant because it is contained in Z’. • WXYis not a prime implicant because it is contained in XY. XY Z’ Y YZ 00 01 11 10 WX 1 1 00 1 1 1 01 X 1 1 1 11 W 1 1 1 10 Z WX’Y’ Y’Z’ WXY Digital Techniques Fall 2007 André Deutz, Leiden University
Essential Prime Implicants (EPIs) • If a minterm of a function F is included in ONLY one prime implicant pi, then piis an Essential Prime Implicantof F. • An essential prime implicant MUST appear in all possible SOP expressions of function F. • To find essential prime implicants: • Generate all prime implicants of a function • Select those prime implicants that contain at least one 1 that is not covered by any other prime implicant. • For the previous example, the PIs are Z’, XY, and WX’Y’; all of these are essential. Z’ XY Y YZ 00 01 11 10 WX 1 1 00 1 1 1 01 X 1 1 1 11 W 1 1 1 10 Z WX’Y’ Digital Techniques Fall 2007 André Deutz, Leiden University
Y YZ 00 01 11 10 WX 1 00 1 1 1 01 X 1 1 11 W 1 1 1 10 Z Y YZ 01 11 10 00 WX 1 1 00 1 1 1 1 01 X 1 1 11 W 10 Z Essential Prime Implicants (examples) • Consider function F1(W,X,Y,Z) whose K-map is shown below: • All Prime Implicants are:XZ’, W’XY’, W’Y’Z, X’Y’Z, WX’Z, WX’Y, WYZ’ • Essential Prime Implicants are:XZ’ • Consider function F2(W,X,Y,Z) whose K-map is shown below: • All Prime Implicants are:XZ’, W’Z, W’X • Essential Prime Implicants are:XZ’and W’Z Digital Techniques Fall 2007 André Deutz, Leiden University
Systematic Procedure for Simplifying Boolean Functions Given : The K-map of a Boolean function Obtain: The simplest SOP expression for the function • Findallprimary implicants (PIs) of the function. • Selectall essentialPIs. • For remaining minterms not included in the essential PIs, select a set of other PIs to coverthem, with minimal overlapin the set. • The resulting simplified function is the logical OR of the product terms selected above. Digital Techniques Fall 2007 André Deutz, Leiden University
Y YZ 00 01 11 10 WX 1 1 1 1 00 1 1 1 01 X 1 1 11 W 10 Z Example • F(W,X,Y,Z) = ∑m(0,1,2,3,4,5,7,14,15). • All prime implicants (PI) are:W’X’, W’Y’, W’Z, XYZ, WXY • Select all essential PIs:W’X’, W’Y’, WXY • Select other PIs to cover all 1s with minimal overlap: • Possibilities: W’Z or XYZ • We select W’Zbecause it is simpler. • F(W,X,Y,Z) = W’X’+W’Y’+WXY+ W’Z Digital Techniques Fall 2007 André Deutz, Leiden University
Y YZ 00 01 11 10 WX 1 1 1 00 1 1 01 X 1 1 11 W 1 1 10 Z Other Examples (cont.) • Consider function F(W,X,Y,Z) =∑m(0,1,2,4,5,10,11,13,15) whose K-map is shown at right. • All prime implicants are: • W’Y’, XY’Z, WXZ, WYZ, WX’Y, W’X’Z’, X’YZ’ • Essential prime implicants are: • W’Y’ • Nonessential prime implicants are: • W’Y’, XY’Z, WXZ, WYZ, WX’Y, W’X’Z’, X’YZ’ • Simplified function (solution not unique): • F = W’Y’+WXZ+WX’Y+W’X’Z’ • F = W’Y’+WXZ+WX’Y+X’YZ’ • F = W’Y’+WYZ+X’YZ’+XY’Z • F = W’Y’+WYZ+X’YZ’+WXZ WXZ and WX’Y are NON-overlapping PIs. WYZ and X’YZ’ are NON-overlapping PIs. Digital Techniques Fall 2007 André Deutz, Leiden University
Product-Of-Sum (POS) Simplification • So far, we have considered simplification of a Boolean function expressed in Sum-Of-Products (SOP) form using a K-map . • Sometimes the Product-Of-Sums form of a function is simpler than the SOP form. • Can we use K-maps to simplify a Boolean function in Product-Of-Sumsform? • Procedure: • Use sum-of-products simplification on the zeros of function F in the K-map. In this way you will get the simplified complement of F (F’). • Find the complement of F’which is F, i.e., (F’)’ = F • Recall that the complement of a Boolean function can be obtained by (1) taking the dual and (2) complementing each literal. • OR, using DeMorgan’s Theorem. Digital Techniques Fall 2007 André Deutz, Leiden University