boolean algebra and logic gates logic and computer design fundamentals
TRANSCRIPT
Boolean Algebra
and Logic Gates
Logic and Computer Design Fundamentals
Boolean Algebra and Logic Gates 2
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!
Boolean Algebra and Logic Gates 3
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
Boolean Algebra and Logic Gates 4
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.
Boolean Algebra and Logic Gates 5
Examples:• 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.”
Notation Examples
Note: The statement: 1 + 1 = 2 (read “one plus one equals two”)
is not the same as1 + 1 = 1 (read “1 or 1 equals 1”).
BAY yxz
AX
Boolean Algebra and Logic Gates 6
Operator Definitions
Operations are defined on the values "0" and "1" for each operator:
AND
0 · 0 = 00 · 1 = 01 · 0 = 01 · 1 = 1
OR
0 + 0 = 00 + 1 = 11 + 0 = 11 + 1 = 1
NOT
1001
Boolean Algebra and Logic Gates 7
01
10
X
NOT
XZ
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:
111
001
010
000
Z = X·YYX
AND OR
X Y Z = X+Y
0 0 0
0 1 1
1 0 1
1 1 1
Boolean Algebra and Logic Gates 8
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 Y Z F = X Y + Y Z0 0 0 0 1 0 00 0 1 0 1 1 10 1 0 0 0 0 00 1 1 0 0 0 01 0 0 0 1 0 01 0 1 0 1 1 11 1 0 1 0 0 11 1 1 1 0 0 1
Boolean Algebra and Logic Gates 9
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
Logic Function Implementation
Switches in series => AND
Switches in parallel => OR
CNormally-closed switch => NOT
Boolean Algebra and Logic Gates 10
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
Logic Function Implementation – cont’d
B
A
D
C
A (B C + D) = A B C + A D
Boolean Algebra and Logic Gates 11
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.
Boolean Algebra and Logic Gates 12
Logic Gate Symbols and Behavior
Logic gates have special symbols:
And waveform behavior in time as follows:
X 0 0 1 1
Y 0 1 0 1
X · Y(AND) 0 0 0 1
X + Y(OR) 0 1 1 1
(NOT) X 1 1 0 0
OR gate
X
YZ = X + Y
X
YZ = X · Y
AND gate
X Z= X
NOT gate orinverter
Boolean Algebra and Logic Gates 13
Logic Diagrams and Expressions
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.
X
Y F
Z
Logic Diagram
Logic Equation
ZY X F
Truth Table
11 1 1
11 1 0
11 0 1
11 0 0
00 1 1
00 1 0
10 0 1
00 0 0
X Y Z Z Y X F
Boolean Algebra and Logic Gates 14
1.
3.
5.
7.
9.
11.
13.
15.
17.
Commutative
Associative
Distributive
DeMorgan’s
2.
4.
6.
8.
X . 1 X=
X . 0 0=
X . X X=
0=X . X
Boolean Algebra
10.
12.
14.
16.
X + Y Y + X=
(X + Y) Z+ X + (Y Z)+=X(Y + Z) XY XZ+=
X + Y X . Y=
XY YX=
(XY) Z X(YZ)=
X + YZ (X + Y) (X + Z)=
X . Y X + Y=
X + 0 X=
+X 1 1=
X + X X=
1=X + X
X = X
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 ( )
Idempotence
Complement
Involution
Identity element
Boolean Algebra and Logic Gates 15
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 Algebra and Logic Gates 16
Boolean Operator Precedence
The order of evaluation is:
1. Parentheses2. NOT3. AND4. OR
Consequence: Parentheses appear around OR expressions
Example: F = A(B + C)(C + D)
Boolean Algebra and Logic Gates 17
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 · 1 1 + 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 Algebra and Logic Gates 18
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 . 1 + AC . 1 1+X = 1= AB + AC Identity element
Boolean Algebraic Proof – Example 2
Boolean Algebra and Logic Gates 19
Useful Theorems
MinimizationX Y + X Y = Y
AbsorptionX + X Y = X
SimplificationX + 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
Boolean Algebra and Logic Gates 20
Truth Table to Verify DeMorgan’s
X Y X·Y X+Y X Y X+Y X · Y X·Y X+Y
0 0 0 0 1 1 1 1 1 10 1 0 1 1 0 0 0 1 11 0 0 1 0 1 0 0 1 11 1 1 1 0 0 0 0 0 0
X + Y = X · Y X · Y = X + Y
Generalized DeMorgan’s Theorem:
X1 + X2 + … + Xn = X1 · X2 · … · Xn
X1 · X2 · … · Xn = X1 + X2 + … + Xn
Boolean Algebra and Logic Gates 21
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 zyzyx
Boolean Algebra and Logic Gates 22
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)
DCBADCADBADCABA