58
Boolean Algebra U.U.Samantha Rajapaksha BSc. Eng. (Moratuwa), MSc in IT Senior Lecturer Sri Lanka Institute of Information Technology New Kandy Road, Malabe, Sri Lanka Tel:0112-301904 email: [email protected] Web: www.sliit.lk

Logic Gates

Embed Size (px)

DESCRIPTION

Logic Gates

Citation preview

  • Boolean AlgebraU.U.Samantha Rajapaksha BSc. Eng. (Moratuwa), MSc in IT Senior Lecturer Sri Lanka Institute of Information Technology New Kandy Road, Malabe, Sri LankaTel:0112-301904 email: [email protected] Web: www.sliit.lk

  • Binary Logic and GatesBinary variables take on one of two values.Logical operators operate on binary values and binary variables.Basic logical operators are the logic functions AND, OR and NOT.Logic gates implement logic functions.Boolean Algebra: a useful mathematical system for specifying and transforming logic functions.We study Boolean algebra as a foundation for designing and analyzing digital systems!

  • Logical OperationsThe three basic logical operations are:AND ORNOTAND is denoted by a dot (). OR is denoted by a plus (+).NOT is denoted by an overbar ( ), a single quote mark (') after, or (~) before the variable.

  • Operator Definitions Operations are defined on the values "0" and "1" for each operator:

  • Truth TablesTruth table - a tabular listing of the values of a function for all possible combinations of values on its argumentsExample: Truth tables for the basic logic operations:

    ORXYZ = X+Y000011101111

  • Boolean AlgebraThe truth table for the Boolean function:

    To make evaluation of the Boolean function easier, the truth table contains extra (shaded) columns to hold evaluations of subparts of the function.

  • Logic Gate Symbols and BehaviorLogic gates have special symbols:

    And waveform behavior in time as follows:

  • Logic GatesAnother very useful gate is the exclusive OR (XOR) gate. The output of the XOR operation is true only when the values of the inputs differ.Note the special symbol for the XOR operation.

  • Logic GatesNAND and NOR are two very important gates. Their symbols and truth tables are shown at the right.

  • Logic Diagrams and ExpressionsBoolean equations, truth tables and logic diagrams describe the same function!Truth tables are unique; expressions and logic diagrams are not. This gives flexibility in implementing functions.

  • ExerciseShow that A+BC =(A+B)(A+C) is true using a truth table.

  • Boolean AlgebraAn algebraic structure defined on a set of at least two elements, B, together with three binary operators (denoted +, and ) that satisfies the following basic identities:

  • MintermsMinterms are AND terms with every variable present in either true or complemented form. Given that each binary variable may appear normal (e.g., x) or complemented (e.g., ), there are 2n minterms for n variables.Example: Two variables (X and Y)produce 2 x 2 = 4 combinations: (both normal) (X normal, Y complemented) (X complemented, Y normal) (both complemented)

    Thus there are four minterms of two variables.

    YXx

  • MaxtermsMaxterms are OR terms with every variable in true or complemented form.Given that each binary variable may appear normal (e.g., x) or complemented (e.g., x), there are 2n maxterms for n variables. Example: Two variables (X and Y) produce 2 x 2 = 4 combinations: (both normal) (x normal, y complemented) (x complemented, y normal) (both complemented)

  • Minterm and Maxterm RelationshipReview: DeMorgan's Theorem and Two-variable example: and Thus M2 is the complement of m2 and vice-versa.Since DeMorgan's Theorem holds for n variables, the above holds for terms of n variables

    giving:

    and Thus Mi is the complement of mi.yx y x+=yxyx=+ y x M2+=yx m2=

  • Standard Forms of Boolean ExpressionsAll Boolean expressions, regardless of their form, can be converted into either of two standard forms:The sum-of-products (SOP) formThe product-of-sums (POS) formStandardization makes the evaluation, simplification, and implementation of Boolean expressions much more systematic and easier.

  • Sum-of-Products (SOP)

  • The Sum-of-Products (SOP) FormAn SOP expression when two or more product terms are summed by Boolean addition.Examples:

    Also:

    In an SOP form, a single overbar cannot extend over more than one variable; however, more than one variable in a term can have an overbar:example: is OK!

    But not:

  • Implementation of an SOPAND/OR implementationNAND/NAND implementationX=AB+BCD+ACABBCDACXABBCDACX

  • General Expression SOPAny logic expression can be changed into SOP form by applying Boolean algebra techniques.ex:

  • The Standard SOP FormA standard SOP expression is one in which all the variables in the domain appear in each product term in the expression.Example:

    Standard SOP expressions are important in: Constructing truth tablesThe Karnaugh map simplification method

  • Converting Product Terms to Standard SOPStep 1: Multiply each nonstandard product term by a term made up of the sum of a missing variable and its complement. This results in two product terms. As you know, you can multiply anything by 1 without changing its value.Step 2: Repeat step 1 until all resulting product term contains all variables in the domain in either complemented or uncomplemented form. In converting a product term to standard form, the number of product terms is doubled for each missing variable.

  • Converting Product Terms to Standard SOP (example)Convert the following Boolean expression into standard SOP form:8

  • ExerciseConvert the following Boolean expression into standard SOP form:

  • Binary Representation of a Standard Product TermA standard product term is equal to 1 for only one combination of variable values.Example: is equal to 1 when A=1, B=0, C=1, and D=0 as shown below

    And this term is 0 for all other combinations of values for the variables.

  • Product-of-Sums (POS)

  • The Product-of-Sums (POS) FormWhen two or more sum terms are multiplied, the result expression is a product-of-sums (POS):Examples:

    Also:

    In a POS form, a single overbar cannot extend over more than one variable; however, more than one variable in a term can have an overbar:example: is OK!

    But not:

  • Implementation of a POSOR/AND implementationX=(A+B)(B+C+D)(A+C)ABBCDACX

  • The Standard POS FormA standard POS expression is one in which all the variables in the domain appear in each sum term in the expression.Example:

    Standard POS expressions are important in: Constructing truth tablesThe Karnaugh map simplification method

  • Converting a Sum Term to Standard POSStep 1: Add to each nonstandard product term a term made up of the product of the missing variable and its complement. This results in two sum terms.As you know, you can add 0 to anything without changing its value.Step 2: Apply rule 12 A+BC=(A+B)(A+C).Step 3: Repeat step 1 until all resulting sum terms contain all variable in the domain in either complemented or uncomplemented form.

  • Converting a Sum Term to Standard POS (example)Convert the following Boolean expression into standard POS form:

  • ExerciseConvert the following Boolean expression into standard POS form:

  • Binary Representation of a Standard Sum TermA standard sum term is equal to 0 for only one combination of variable values.Example: is equal to 0 when A=0, B=1, C=0, and D=1 as shown below

    And this term is 1 for all other combinations of values for the variables.

  • SOP/POS

  • Converting Standard SOP to Standard POSThe Facts:The binary values of the product terms in a given standard SOP expression are not present in the equivalent standard POS expression.The binary values that are not represented in the SOP expression are present in the equivalent POS expression.

  • Converting Standard SOP to Standard POSWhat can you use the facts?Convert from standard SOP to standard POS.How?Step 1: Evaluate each product term in the SOP expression. That is, determine the binary numbers that represent the product terms.Step 2: Determine all of the binary numbers not included in the evaluation in Step 1.Step 3: Write the equivalent sum term for each binary number from Step 2 and express in POS form.

  • Converting Standard SOP to Standard POS (example)Convert the SOP expression to an equivalent POS expression:

    The evaluation is as follows:

    There are 8 possible combinations. The SOP expression contains five of these, so the POS must contain the other 3 which are: 001, 100, and 110.

  • Exercises

  • Karnaugh Maps (K-map)A K-map is a collection of squaresEach square represents a mintermThe collection of squares is a graphical representation of a Boolean functionAdjacent squares differ in the value of one variableAlternative algebraic expressions for the same function are derived by recognizing patterns of squaresThe K-map can be viewed asA reorganized version of the truth tableA topologically-warped Venn diagram as used to visualize sets in algebra of sets

  • Two Variable MapsA 2-variable Karnaugh Map:Note that minterm m0 andminterm m1 are adjacentand differ in the value of thevariable ySimilarly, minterm m0 and minterm m2 differ in the x variable.Also, m1 and m3 differ in the x variable as well. Finally, m2 and m3 differ in the value of the variable y

  • K-Map and Truth TablesThe K-Map is just a different form of the truth table. Example Two variable function:We choose a,b,c and d from the set {0,1} to implement a particular function, F(x,y). Function TableK-Map

  • K-Map Function RepresentationExample: F(x,y) = x

    For function F(x,y), the two adjacent cells containing 1s can be combined using the Minimization Theorem:

  • Three Variable MapsA three-variable K-map:

    Where each minterm corresponds to the product terms:

    Note that if the binary value for an index differs in one bit position, the minterms are adjacent on the K-Map

  • Alternative Map LabelingMap use largely involves:Entering values into the map, andReading off product terms from the map.Alternate labelings are useful:yyy zz10243567x0100011110x

  • Example FunctionsBy convention, we represent the minterms of F by a "1" in the map and leave the minterms of blankExample:

    Example:

    Learn the locations of the 8 indices based on the variable order shown (x, most significant and z, least significant) on the map boundaries

  • Combining SquaresBy combining squares, we reduce number of literals in a product term, reducing the literal cost, thereby reducing the other two cost criteria On a 3-variable K-Map:One square represents a minterm with three variablesTwo adjacent squares represent a product term with two variablesFour adjacent terms represent a product term with one variableEight adjacent terms is the function of all ones (no variables) = 1.

  • Example: Combining SquaresExample: Let

    Applying the Minimization Theorem three times:

    Thus the four terms that form a 2 2 square correspond to the term "y".

  • Three-Variable MapsReduced literal product terms for SOP standard forms correspond to rectangles on K-maps containing cell counts that are powers of 2. Rectangles of 2 cells represent 2 adjacent minterms; of 4 cells represent 4 minterms that form a pairwise adjacent ring.Rectangles can contain non-adjacent cells as illustrated by the pairwise adjacent ring above.

  • Three-Variable MapsExample Shapes of 2-cell Rectangles:

    Read off the product terms for the rectangles showny

  • Three-Variable MapsExample Shapes of 4-cell Rectangles:

    Read off the product terms for the rectangles showny

  • Three Variable Maps z)y,F(x,=

  • Three-Variable Map SimplificationUse a K-map to find an optimum SOP equation for

  • Four Variable Terms Four variable maps can have rectangles corresponding to: A single 1 = 4 variables, (i.e. Minterm) Two 1s = 3 variables, Four 1s = 2 variables Eight 1s = 1 variable, Sixteen 1s = zero variables (i.e. Constant "1")

  • Four-Variable MapsExample Shapes of Rectangles:

  • Four-Variable MapsExample Shapes of Rectangles:XYZW

  • Four-Variable Map Simplification )8,10,13,152,4,5,6,7, (0, Z)Y,X,F(W,mS=

  • 3,14,15Four-Variable Map Simplification

    )(3,4,5,7,9,1 Z)Y,X,F(W,mS=

  • Exercise

    *********************************F = W' X Y' + W' Y Z + WXY + WY'Z