# Binary Logic and Gates Binary variables take on one of two values.

## Presentation on theme: "Binary Logic and Gates Binary variables take on one of two values."— Presentation transcript:

Binary Logic and Gates Binary 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!

Binary Variables Recall that the two binary values have different names: True/False On/Off Yes/No 1/0 We use 1 and 0 to denote the two values. Variable identifier examples: A, B, y, z, or X1 for now RESET, START_IT, or ADD1 later

Logical Operations The three basic logical operations are:
AND OR NOT AND 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.

Notation Examples Examples: Note: The statement: is not the same as
is read “Y is equal to A AND B.” is read “z is equal to x OR y.” is read “X is equal to NOT A.” Y = A × B y x z + = A X Note: The statement: 1 + 1 = 2 (read “one plus one equals two”) is not the same as 1 + 1 = 1 (read “1 or 1 equals 1”).

Operator Definitions 0 · 0 = 0 0 + 0 = 0 = 1 0 · 1 = 0 0 + 1 = 1
Operations are defined on the values "0" and "1" for each operator: AND 0 · 0 = 0 0 · 1 = 0 1 · 0 = 0 1 · 1 = 1 OR 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 1 NOT 1 =

Truth Tables Tabular listing of the values of a function for all possible combinations of values on its arguments Example: Truth tables for the basic logic operations: 1 Z = X·Y Y X AND OR X Y Z = X+Y 1 1 X NOT Z =

Truth Tables – Cont’d Used to evaluate any logic function
Consider F(X, Y, Z) = X Y + Y Z X Y Z X Y Y Z F = X Y + Y Z 1

Logic Function Implementation
Using Switches Inputs: logic 1 is switch closed logic 0 is switch open Outputs: logic 1 is light on logic 0 is light off. NOT input: logic 1 is switch open logic 0 is switch closed Switches in parallel => OR Switches in series => AND C Normally-closed switch => NOT

Logic Function Implementation – cont’d
Example: Logic Using Switches Light is on (L = 1) for L(A, B, C, D) = and off (L = 0), otherwise. Useful model for relay and CMOS gate circuits, the foundation of current digital logic circuits B C A D A (B C + D) = A B C + A D

Logic Gates In the earliest computers, switches were opened and closed by magnetic fields produced by energizing coils in relays. The switches in turn opened and closed the current paths. Later, vacuum tubes that open and close current paths electronically replaced relays. Today, transistors are used as electronic switches that open and close current paths.

Logic Gate Symbols and Behavior
Logic gates have special symbols: And waveform behavior in time as follows: OR gate X Y Z = + AND gate NOT gate or inverter X 1 Y (AND) + (OR) (NOT)

Logic Diagrams and Expressions
Truth Table 1 1 1 1 1 1 0 1 0 1 1 0 0 0 1 1 0 1 0 0 0 1 0 0 0 X Y Z Z Y X F × + = Logic Equation Z Y X F + = X Y F Z Logic Diagram Boolean equations, truth tables and logic diagrams describe the same function! Truth tables are unique, but expressions and logic diagrams are not. This gives flexibility in implementing functions.

Boolean Algebra Invented by George Boole in 1854
An algebraic structure defined by a set B = {0, 1}, together with two binary operators (+ and ·) and a unary operator ( ) Identity element 1. 3. 5. 7. 9. X + 0 = + 1 X + X X = X 2. 4. 6. 8. X . 1 = . 0 X . X Idempotence Complement Involution 10. 12. 14. 16. X + Y Y + X = (X + Y) Z + X + (Y Z) X(Y + XY XZ X . Y 11. 13. 15. 17. XY YX = (XY) Z X(Y Z) X + YZ (X + Y) (X + Z) X . Y X + Y Commutative Associative Distributive DeMorgan s

Some Properties of Boolean Algebra
Boolean Algebra is defined in general by a set B that can have more than two values A two-valued Boolean algebra is also know as Switching Algebra. The Boolean set B is restricted to 0 and 1. Switching circuits can be represented by this algebra. The dual of an algebraic expression is obtained by interchanging + and · and interchanging 0’s and 1’s. The identities appear in dual pairs. When there is only one identity on a line the identity is self-dual, i. e., the dual expression = the original expression. Sometimes, the dot symbol ‘’ (AND operator) is not written when the meaning is clear

Boolean Operator Precedence
The order of evaluation is: 1. Parentheses 2. NOT 3. AND 4. OR Consequence: Parentheses appear around OR expressions Example: F = A(B + C)(C + D)

Boolean Algebraic Proof – Example 1
A + A · B = A (Absorption Theorem) Proof Steps Justification A + A · B = A · 1 + A · B Identity element: A · 1 = A = A · ( 1 + B) Distributive = A · B = 1 = A Identity element Our primary reason for doing proofs is to learn: Careful and efficient use of the identities and theorems of Boolean algebra, and How to choose the appropriate identity or theorem to apply to make forward progress, irrespective of the application.

Boolean Algebraic Proof – Example 2
AB + AC + BC = AB + AC (Consensus Theorem) Proof Steps Justification = AB + AC + BC = AB + AC + 1 · BC Identity element = AB + AC + (A + A) · BC Complement = AB + AC + ABC + ABC Distributive = AB + ABC + AC + ACB Commutative = AB · 1 + ABC + AC · 1 + ACB Identity element = AB (1+C) + AC (1 + B) Distributive = AB AC X = 1 = AB + AC Identity element

Useful Theorems Minimization X Y + X Y = Y Absorption X + X Y = X
Simplification X + X Y = X + Y DeMorgan’s X + Y = X · Y Minimization (dual) (X+Y)(X+Y) = Y Absorption (dual) X · (X + Y) = X Simplification (dual) X · (X + Y) = X · Y DeMorgan’s (dual) X · Y = X + Y

Truth Table to Verify DeMorgan’s
X + Y = X · Y X · Y = X + Y X Y X·Y X+Y X · Y 1 Generalized DeMorgan’s Theorem: X1 + X2 + … + Xn = X1 · X2 · … · Xn X1 · X2 · … · Xn = X1 + X2 + … + Xn We can also use algebraic properties in doing this proof. We will show that, x’ . y’, satisfies the definition of the complement of (x + y), defined as (x + y)’ by DeMorgan’s Law. To show this we need to show that A + A’ = 1 and A.A’ = 0 with A = x + y and A’ = x’. y’. This proves that x’. y’ = (x + y)’. Part 1: Show x + y + x’. y’ = 1. x + y + x’. y’ = (x + y + x’) (x + y + y’) X + YZ = (X + Y)(X + Z) (Distributive Law) = (x + x’ + y) (x + y + y’) X + Y = Y + X (Commutative Law) = (1 + y)(x + 1) X + X’ = 1 = X = 1 = X = 1 Part 2: Show (x + y) . x’. y’ = 0. (x + y) . x’. y’ = (x . x’. y’ + y . x’. y’) X (Y + Z) = XY + XZ (Distributive Law) = (x . x’. y’ + y . y’ . x’) XY = YX (Commutative Law) = (0 . y’ x’) X . X’ = 0 = (0 + 0) X = 0 = X + 0 = X (With X = 0) Based on the above two parts, x’y’ = (x + y)’ The second DeMorgans’ law is proved by duality. Note that DeMorgan’s Law, given as an identity is not an axiom in the sense that it can be proved using the other identities.

Complementing Functions
Use DeMorgan's Theorem: 1. Interchange AND and OR operators 2. Complement each constant and literal    Example: Complement F = F = (x + y + z)(x + y + z) Example: Complement G = (a + bc)d + e G = (a (b + c) + d) e x + z y G' = ((a (b' + c'))+ d ) e' = (a (b' + c') + d) e'

Expression Simplification
An application of Boolean algebra Simplify to contain the smallest number of literals (variables that may or may not be complemented) = AB + ABCD + A C D + A C D + A B D = AB + AB(CD) + A C (D + D) + A B D = AB + A C + A B D = B(A + AD) +AC = B (A + D) + A C (has only 5 literals) + D C B A

Download ppt "Binary Logic and Gates Binary variables take on one of two values."

Similar presentations