580 likes | 786 Views
Boolean Algebra and Standart Forms of Expression. Overview. Switching algebra Axioms Theorems Algebraic m inimization Standard forms Sum-of-minterms Product-of-maxterms Other Logic Gates. Combinational Circuits. A combinational circuit has one or more digital inputs
E N D
Boolean Algebra and Standart Forms of Expression
Overview • Switching algebra • Axioms • Theorems • Algebraic minimization • Standard forms • Sum-of-minterms • Product-of-maxterms • Other Logic Gates
Combinational Circuits • A combinational circuit has • one or more digital inputs • one or more digital outputs • a functional specificationthat details the value of each output forevery possible combination of valid input values • a timing specification consisting (at minimum) of an upper boundtPD on the required time for the device to compute the specifiedoutput values from an arbitrary set of stable, valid input values
Functional Specifications • There are many ways of specifying thefunction of a combinational device, forexample: • Concise alternatives: • Boolean function • Truth table • Schematic
Combinational Circuits • Combinational logic circuits has no memory! • Outputs are only function of current input combination • Nothing is known about past events • Repeating a sequence of inputs always gives the same output sequence • Sequential logic circuits (covered later) does have memory • Repeating a sequence of inputs can result in an entirely different output sequence
Combinational Logic Example • Circuit controls the level of fluid in a tank • inputs are: • HI - 1 if fluid level is too high, 0 otherwise • LO - 1 if fluid level is too low, 0 otherwise • outputs are: • Pump - 1 to pump fluid into tank, 0 for pump off • Drain - 1 to open tank drain, 0 for drain closed • input to output relationship is described by a truth table
HI 0 0 1 1 LO 0 1 0 1 Pump 0 1 0 x Drain 0 0 1 x Tank level is OK Low level, pump more in High level, drain some out inputs cannot occur HI Pump Drain LO Combinational Logic Example Truth Table Representation Schematic Representation
Terms and Definitions • Logic Expression (Boolean/Switching function) - a mathematical formula consisting of logical operators and variables • f(x,y,z) = (x + y’).z + x’ • Logic Operator - a function that gives a well defined output according to switching algebra • Not (’), And (.), Or (+) • Logic Variable - a symbol representing the two possible switching algebra values of 0 and 1 • x, y, z • Logic Literal - the values 0 and 1 or a logic variable or it’s complement • x, y’, z, x’
Logic Expressions - Precedence • Like standard algebra, switching algebra operators have a precedence of evaluation • NOT operations have the highest precedence • AND operations are next • OR operations are lowest • Parentheses explicitly define the order of operator evaluation • If in doubt, USE PARENTHESES!
Truth Tables • A truth table shows all possible inputs and outputs of a function. • There is one-to-one correspondence between a Boolean function and its turth table. • Remember that each input variable represents either 1 or 0. • Because there are only a finite number of values (1 and 0), truth tables themselves are finite. • A function with n variables has 2n possible combinations of inputs. • Inputs are listed in binary.
f(x,y,z) = (x + y’)z + x’ f(0,0,0) = (0 + 1)0 + 1 = 1 f(0,0,1) = (0 + 1)1 + 1 = 1 f(0,1,0) = (0 + 0)0 + 1 = 1 f(0,1,1) = (0 + 0)1 + 1 = 1 f(1,0,0) = (1 + 1)0 + 0 = 0 f(1,0,1) = (1 + 1)1 + 0 = 1 f(1,1,0) = (1 + 0)0 + 0 = 0 f(1,1,1) = (1 + 0)1 + 0 = 1 Truth Tables
Switching Algebra • Based on Boolean Algebra • Developed by George Boole in 1854 • Basic laws of Boolean Algebra will be implemented as logic gates. • Networks of logic gates allow us to manipulate digital signals • Can perform numerical operations on digital signals such as addition, multiplication • Can perform translations from one binary code to another. • A switching (Boolean) variable X can take on only one of two values: • X = 0, if X ≠ 1 • X = 1, if X ≠ 0
X 0 1 X 1 0 X X Switching Algebra Operations - NOT • Unary complement/inversion operation • Usually shown as overbar , other forms are ~X, X’ X
X 0 0 1 1 Y 0 1 0 1 X·Y 0 0 0 1 Switching Algebra Operations - AND • Also known as the conjunction operation; output is trueonly if all inputs are true • Algebraic operators are ‘·’, ‘&’, ‘’
X 0 0 1 1 Y 0 1 0 1 X+Y 0 1 1 1 Switching Algebra Operations - OR • Also known as the disjunction operation; output is trueif any input is true • Algebraic operators are ‘+’, ‘|’, ‘’
Prove X + 0 = X (a) Keep axioms handy (b) Elaborate cases: if X = 0, have X + 0 = 0 + 0 = 0 = X if X = 1, have X + 0 = 1 + 0 = 1 = X
Duality Principle of Boolean Algebra • How to apply the duality principle? • 1’s and 0’s are interchanged. • AND or OR operators are interchanged. • Variables are left unchanged. • Dual theorem is still true!
(T12) X + X’ . Y = X + Y (T12’) X . (X’ + Y) = X.Y Two- and Three-Variable Theorems
Prove (X.Y).Z=X.(Y.Z) Same output
Prove (X.Y)+(X.Z)=X.(Y+Z) Same output
DeMorgan’s Theorem • (x + y)’ = x’y’ <=> (x . y)’ = x’ + y’ • General form of the DeMorgan’s theorem:
Complementing a Function Algebraically • You can use DeMorgan’s law to find out the complement of a Boolean Function f(x,y,z) = x(y’z’ + yz) f’(x,y,z)= ( x(y’z’ + yz) )’ [ complement both sides ] = x’ + (y’z’ + yz)’ [ because (xy)’ = x’ + y’ ] = x’ + (y’z’)’ (yz)’ [ because (x + y)’ = x’ y’ ] = x’ + (y + z)(y’ + z’) [ because (xy)’ = x’ + y’, twice]
Logic Expression Minimization • Goal is to find an equivalent of an original logic expression that: • has fewer variables per term • has fewer terms • needs less logic to implement • There are three main manual methods • Algebraic minimization • Karnaugh Map minimization • Quine-McCluskey (tabular) minimization
Algebraic Minimization • Process is to apply the switching algebra postulates, laws, and theorems to transform the original expression • Hard to recognize when a particular law can be applied • Difficult to know if resulting expression is truly minimal • Very easy to make a mistake • Incorrect complementation • Dropped variables
Minimization via Adjacency • Adjacency is easy to use; very powerful • Look for two terms that are identical except for one variable • Application removes one term and one variable from the remaining term A.B.C.D’ + A.B.C.D = (A.B.C).D’ + (A.B.C).D = (A.B.C).(D’ + D) = A.B.C
(T12) X + X’ . Y = X + Y (T12’) X . (X’ + Y) = X.Y Simplification with Axioms x’y’ + xyz + x’y [T8; x’y’ + x’y = x’(y’ + y) ] = x’(y’ + y) + xyz [T5; y’ + y = 1 ] = x’. 1 + xyz [T1’; x’. 1 = x’ ] = x’ + xyz [T8: x’ + xyz = (x’ + x) (x’ + yz)] = (x’ + x)(x’ + yz) [T5; x’ + x = 1 ] = 1 . (x’ + yz) [T1’: 1 . (x’ + yz) = x’ + yz] = x’ + yz [Axiom 2 ]
(T12) X + X’ . Y = X + Y (T12’) X . (X’ + Y) = X.Y Proving Consensus Theorem • XY + X’Z + YZ [T1’: YZ.1 = YZ] = XY + X’Z + YZ. 1 [T5: X + X’ = 1] = XY + X’Z + YZ(X + X’) [T8: YZ(X + X’) = XYZ + X’YZ] = XY + X’Z + XYZ + X’YZ = XY.1 + XYZ + X’Z.1 + X’YZ [T1’: XY.1 = XY, X’Z.1 = X’Z] = XY(1 + Z) + X’Z(1 + Y) [T8: XY.1+ XYZ = XY(1 + Z)] = XY + X’Z
(x + y’).z + x’ Boolean Expressions and Circuits • Any Boolean expressioncan be converted into a circuit by combining basicgates. • The precedences are explicit in a circuit. • Make sure thatthe hardware does operations in the right order!
How Simplification Helps? • Here are two different but equivalent circuits • In general the one with fewer gates is “better”: • It costs less to build • It requires less power • But we had to do some work to find the second form x’y’ + xyz + x’y = x’(y’ + y) + xyz = x’1 + xyz = x’ + xyz = (x’ + x)(x’ + yz) = 1 (x’ + yz) = x’ + yz
Another Example F= X’YZ+ X’YZ’+XZ = X’Y(Z+Z’)+XZ = X’Y . 1 + XZ = X’Y+ XZ
Standard Expression Forms • Two standardexpression forms: • Sum-of-products • Sum-of-minterms • OR of AND terms • Product-of-sums • Product-of-maxterms • AND of OR terms
Minterms • A minterm is a special product of literals • Each input variable, either complemented or uncomplemented, appears exactly once • Each minterm is 1 for exactly one combination of inputs, and 0 for the others • A function with n variables has 2n minterms (since each variable can appear complemented or not) • A three-variable function, such as f(x,y,z), has 23 = 8 minterms
Sum of Minterms Form • Every function can be written as a sum of minterms • A special kind of sum of products form • The sum of minterms form for any function is unique • Converting a truth table tosum of minterms form: • Logical sum of all the minterms that produce a 1 in the truth table
Sum of Minterms Form f = x’y’z’ + x’y’z + x’yz’ + x’yz + xyz’ = m0 + m1 + m2 + m3 + m6 = m(0,1,2,3,6) f’ = xy’z’ + xy’z + xyz = m4 + m5 + m7 = m(4,5,7) f’ contains all the minterms not in f • A function that includes all the 2^n minterms is equal to logic 1 • G(X,Y)= m(0,1,2,3)= 1
Sum of Products Form • The sum-of-minterms form is a standard algebraic expression that is obtained from a truth table • When we simplify a function in SoM form by • reducing the number of product terms or • reducing the number of literals in the terms the simplified expression is said to be in Sum-of-Products form
Sum of Products Form • Sum of products expression can be implemented using a two-level circuit • literals and their complements at the “0th” level • AND gates at the first level • a single OR gate at the second level F= m(0,1,2,3,4,5,7) (SoM) = Y’ + X’YZ’ + XY (SoP)
Maxterms • A maxterm is a special sum of literals • Each input variable, either complemented or uncomplemented, appears exactly once • Each maxterm is 0 for exactly one combination of inputs, and 1 for the others • A function with n variables has 2nmaxterms
Product of Maxterms Form • Every function can be written as a product of maxterms • A special kind of product of sums form • The product of sums form for any function is unique • Converting a truth table toproduct of maxterms form: • Logical product of all the maxterms that produce a 0 in the truth table
Product of MaxtermsForm f = (x’ + y + z)(x’ + y + z’)(x’ + y’ + z’) = M4 M5 M7 = ∏M(4,5,7) f’ = (x + y + z)(x + y + z’)(x + y’ + z) (x + y’ + z’)(x’ + y’ + z) = M0 M1 M2 M3 M6 = ∏M(0,1,2,3,6) f’ contains all the maxterms not in f • A function that includes all the 2^n maxterms is equal to logic 0 • G(X,Y)= ∏m(0,1,2,3)= 0
Product of Sums Form • The product-of-maxterms form is a standard algebraic expression that is obtained from a truth table • When we simplify a function in PoM form by • reducing the number of sum terms or • reducing the number of literals in the terms, the simplified expression is said to be in Product-of-Sums form
Products of Sums Form • Product of sums expression can be implemented using a two-level circuit • literals and their complements at the “0th” level • OR gates at the first level • a single AND gate at the second level F= ∏M(0,2,3,4,5,6) (PoM) = X(Y’ + Z)(X + Y +Z’) (PoS)
Minterms and maxterms are related • Any minterm mi is the complement of the corresponding maxterm Mi • For example, m4’ = M4 because (xy’z’)’ = x’ + y + z Minterm Shorthand x’y’z’ m0 x’y’z m1 x’yz’ m2 x’yz m3 xy’z’ m4 xy’z m5 xyz’ m6 xyz m7 Maxterm Shorthand x + y + z M0 x + y + z’ M1 x + y’ + z M2 x + y’ + z’ M3 x’ + y + z M4 x’ + y + z’ M5 x’ + y’ + z M6 x’ + y’ + z’ M7
Converting Between Standard Forms • We can convert a sum of minterms to a product of maxterms • In general, just replace the minterms with maxterms, using maxterm numbers that don’t appear in the sum of minterms: • The same thing works for converting from a product of maxterms to a sum of minterms From before f = m(0,1,2,3,6) and f’ = m(4,5,7) = m4 + m5 + m7 complementing (f’)’ = (m4 + m5 + m7)’ so f = m4’ m5’ m7’ [ DeMorgan’s law ] = M4 M5 M7 [ By the previous page ] = ∏ M(4,5,7) f = m(0,1,2,3,6) = ∏ M(4,5,7)
Other Gates • NAND gate: • NOR gate:
NAND and NOR • Both NAND and NOR are universal gates • Universal gate: A gate that alone can be used to implement all • Boolean functions • It is sufficient to show that NAND (NOR) can be used to implement • AND, OR, and NOT operations
(xx)’ = x’ [ because xx = x ] ((xy)’ (xy)’)’ = xy [ from NOT above ] ((xx)’ (yy)’)’= (x’ y’)’ [ xx = x, and yy = y ] = x + y [ DeMorgan’s law ] NANDs are universal! • NOT • AND • OR