600 likes | 658 Views
Engineering 43. Logic Circuit Synthesis. Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege.edu. ReCall the Basic Gates. The Logical Operators Form The Basis of BOOLEAN (Two Value, T & F, 1 & 0, or Hi & Lo) Logic Developed by George Boole (1815-1864)
E N D
Engineering 43 Logic CircuitSynthesis Bruce Mayer, PE Licensed Electrical & Mechanical EngineerBMayer@ChabotCollege.edu
The Logical Operators Form The Basis of BOOLEAN (Two Value, T & F, 1 & 0, or Hi & Lo) Logic Developed by George Boole (1815-1864) The Action of the Boolean Operators are Often Characterized with TRUTH Tables Boolean Logic
Boolean Logic can be Mathematically Formalized with the use of Math Operators The Math Operators Corresponding to Boolean Logic Operations: Boolean Algebra • A and B can only be TRUE or FALSE • TRUE represented by 1; FALSE by 0
Commutative: A.B = B.A and A+B = B+A Distributive: A.(B+C) = (A.B) + (A.C) A+(B.C) = (A+B).(A+C) Identity Elements: 1.A = A and 0 + A = A Inverse: A.A = 0 and A + A = 1 Boolean Algebraic Properties • Associative: • A.(B.C) = (A.B).C and A+(B+C) = (A+B)+C • DeMorgan's Laws: • A.B = A + B and • A+B = A.B
Prove Distributive Law • ReCallBoleanDistributive Law • The Circuits at Right Implement The Sides of this Identity • If the Identity is TRUE, then the TruthTable for the two circuits must be Identical D D
Prove Distributive Law • Constructing a Truth Table that Includes and Expands [AB+AC] & [A(B+C)] IDENTICAL
Prove XOR distributive Law • A Truth Table AlsoProvesthe EXCLUSIVE-OR Version of the Dist Law A(BC) ≡ ABAC IDENTICAL
DeMorgan → Case-a: DeMorgan in MATLAB >> % case-a >> x = 7 x = 7 >> a1 = ~((x < 10)&(x >= 6)) a1 = 0 >> a2 = (~(x < 10))|(~(x >= 6)) a2 = 0 1 1 0 0
DeMorgan → Case-b DeMorgan in MATLAB >> % case-b >> y = 3 y = 3 >> b1 = ~((y == 2)|(y > 5)) b1 = 1 >> b2 = (~(y == 2))&(~(y >5)) b2 = 1 0 0 1 1
Multiple-Input Gates • The Flexibility of Boolean Algebra permits straightforward Extension to Gates with Many Inputs • The Number of Entries in the TT is 2N, where: • N ≡ No. of INputs
Gates Boolean (WhiteBoard) • Write the Boolean Expression Equivalent to the Logic Circuit Analyzed Last Lecture Q
Boolean Gates (WhiteBoard) • Draw the Logic-Gate Circuits to Implement these Boolean Equations • Use Multiple-Input Gates as desired
MinTerms Sum of Products • Consider an Example Boolean function of three variables by Truth Table • Function Notation • X, Y, Z→ Inputs • Q → Output • The only non-zero OutPuts are at: • X = 0, Y = 1, Z = 0 • X = 1, Y = 1, Z = 0 • The Fcn is 1 for those 2 input-sets and 0 for all other input conditions. FIX: R(101)=1 R(110)=0
MinTerms Sum of Products • The Function Operation Requires • The output to be 1 whenever • X=0 AND Y=1 AND Z=0 • OR when • X=1 AND Y=0 AND Z=1 • This Description can written using Boolean Algebra: • Function read as: (NOT-X AND Y AND NOT-Z) OR (X AND NOT-Y AND Z) • By Way of • NOT-X = 0 • NOT-Y = 0 • Etc.
MinTerms Sum of Products • The Ckt Below Implements Fcn: • The function is composed of two groups of three. • Each group of three is a minterm. • minterm implies that each of the groups of 3 in the expression takes on a value of 1 only for one of the 8 possible combos of X, Y and Z and their inverses Q
MinTerms Sum of Products • Important points about minterms include the following. • In a minterm, each variable, X, Y or Z appears once, either as the variable itself or as the inverse. • Each minterm corresponds to exactly one entry (row!) in the truth table. • The Rows with Output = 1
Boolean Eqn from TruthTable • It turns out that ANY Boolean function can be constructed using minterms • To build a Boolean fcn from minterms: • Examine the truth table for the function. • Be sure that all possible combinations of variables and inverses are accounted for. • For each entry of the truth table for which the Function takes on a value of 1, determine the corresponding minterm expression (an AND expression) • Remember that EVERY variable or its inverse will appear in EVERY minterm. • OR (add)Together all the minterms from step-2
MinTerms & SOP Sumarized • We can sum up the MinTermConstruiction with the following: • A truth table gives a unique sum-of-products function that follows directly from expanding the ones in the truth table as minterms.
MinTerms Example • Construct Fcn for • ID the Rows with ONES for minterms • Thus This Fuction has a Total of FOUR MinTerms
MinTerms Example • T1 product is the First MinTerm by Multiplication • Similarly Construct Terms 2-4 by Multiplication • To Write the V(ABC) Function Simply OR (add) the MinTerms
MinTerms Example • The Ckt Fragment for the 1stminterm • The Ckts for the other Three minterms:
MinTerm Example • OR-ing the MinTermsCompletes theFunction: • This amounts toConnecting the 4 ckt-fragmentsto an OR gate V
Sum-of-Products Summarized • One or more AND gates feeding a single OR gate at the output • Example:
PRODUCT of SUMS summarized • One or more OR gates feeding a single AND gate at the output • The DUAL of Sum of Products
Prod-of-Sums MaxTerms • Use MaxTerms to Write the Boolean Equation for • ID rows with OutPut of ZERO
Prod-of-Sums MaxTerms • Note for a SUM (OR) All elements MUST Be Zero • Examine the 2nd row • For A, B, & C to Add to ZERO Need • Similarly for the other ZERO Rows
Prod-of-Sums MaxTerms • Thus ANDing (multiplying) the MaxTerms ENSURES that Q will Zero if any one of the MaxTerms is Zero. • Thus the Function Q • A (different)P.O.S. CktFragment
Prod-of-Sums MaxTerms • The Logic Circuit for the Example Q
SOP & MINtermsShortHand • Consider the Fcn • Written in SOP Form • Notice the function consists ofminterms from rows 0, 2, and 6 • Thus the ShortHand • In Even ShorterHand • Quickly ID the minterms
POS & MAXTermsShortHand • Consider the Fcn • Written POS Form • Notice the function consists ofmaxterms from rows 3, 4, and 7 • Thus the ShortHand • In Even ShorterHand • Quickly ID the maxterms
SOP & POS Summarized • Sum-of-Products (SOP) • first the product (AND) terms are formed then these are summed (OR) • e.g.: A∙B∙C + D∙E∙F + G∙H∙I • Product-of-Sums (POS) • first the sum (OR) terms are formed then the products are taken (AND) • e.g.:(A+B+C)∙(D+E+F)∙(G+H+I) • Convert Between forms using DeMorgan
Canonical Form • Canonical form is not usually an efficient description of a Boolean fcn but it is sometimes useful in analysis and design • In an expression in canonical form, every variable appears in every Term (for SOP) or Factor (for POS), e.g.:
SOP Canonical • Any SOP expression can be forced into canonical form by ANDing the incomplete terms with terms of the Form (X+X’) where X is the name of the missing variable, e.g.: • This operation produce the minterms
MINIMUM: SOP & POS • The minimum sum of products (MSOP) of a function, f, is a SOP representation of f that contains the fewest number of product terms and fewest number of literals (Variable-Instances) of any SOP representation of f. • Example -- f(a,b,c,d) = m(3,7,11,12,13,14,15) = ab + acd + acd= ab + cd • The minimum product of sums (MPOS) of a function, f, is a POS representation of f that contains the fewest number of sum terms and the fewest number of literals of any POS representation of f. • Example -- f(a,b,c,d) = M(0,1,2,4,5,6,8,9,10) = (a + c)(a + d)(a + b + d)(b + c + d) = (a +c)(a + d)(b + c)(b + d)
Karnaugh Maps • Karnaugh maps (K-maps) -- convenient tool for representing switching functions of up to six variables. • K-maps form the basis of useful heuristics (algorithms) for finding MSOP and MPOS representations. • An n-variable K-map has 2n cells with each cell corresponding to a row of an n-variable truth table.
Karnaugh Maps • K-map cells are labeled with the corresponding truth-table row. • K-map cells are arranged such that adjacent cells correspond to truth rows that differ in only one bit position (logical adjacency, or GRAY-code form) • Switching functions are mapped (or plotted) by placing the function’s value (0,1,d) in each cell of the map.
Karnaugh Map Example • An Example of a 4 Variable Karnaugh Map • The Square Marked ▲ represents • The Square Marked ▼ represents • Note the two marked Squares differ only the C Variable • The GRAY format
What is GRAY code sequence? • Gray code sequence only changes one bit as we go from one number to the next in the sequence, unlike binary. • Adjacent cells vary by only one bit because a Gray code sequence varies by only one bit.
Karnaugh Map MiniMization • Write the Boolean expression in SOP form • For each product term, write a 1 in all the squares which are included in the term, 0 elsewhere • canonical form: one square • one term missing: two adjacent squares • two terms missing: 4 adjacent squares
Karnaugh Map MiniMization • Example: • Then the K-map • What the1’s mean
Karnaugh Map MiniMization • Minimization is done by recognizing patterns of 1's and 0's • Simple theorems are then used to simplify the Boolean description of the patterns • Pairs of adjacent 1's • remember that adjacent squares differ by only one variable • hence the combination of 2 adjacent squares has the form • this can be simplified just P as P∙(0+1) = P∙(1+0) = P by Boolean Algebra
Karnaugh Map Example • The Previous K-map • Note ADJACENT Sqs at “11” • Boxing In the Vertical Adjecancy • The adjacent SqsA’∙B∙C and A ∙B ∙C differ ONLY in A • hence they can be combined into just BC • normally indicated by grouping the adjacent squares subject to combination A/BC
Adjacent Pairs • Again: • “Cover” all the 1’s with maximum grouping: • The simplifiedEqn is one thatSums All Termscorresponding toeach of the groups: Varies Only by “A” (BC group) Varies Only by “B”(AC group) Varies Only by “C”(AB group)
Wrap-Around Adjacency • The Top/Bot and Left/Right Edges of the K-maps are Adjacent as well • Think of Map being “Rolled Up” Only C’ does not change
Karnaugh Map Simplification • The K-Map uses the following rules for simplification of expressions by grouping together adjacent cells containing ones • Groups may not include any cell containing a zero
Karnaugh Rules • Groups may be horizontal or vertical, but not diagonal • Groups must contain 1, 2, 4, 8, or in general 2n cells (need “Square Boxes”) • That is if n = 1, a group will contain two 1's since 21 = 2. If n = 2, a group will contain four 1's since 22 = 4.
Karnaugh Rules • Each group should be as large as possible • Each cell containing a one must be in at least one group