You are on page 1of 64

Digital Logic and Design

Dr. M. Najam ul Islam

PhD Electrical Engineering

Lecture 4: Boolean Algebra

Digital Logic Logic Theory is that branch of mathematics which


deals with the truthfulness of a rational statement. Example: Switches A & B must be closed to turn ON a lamp this statement can be tested for its truthfulness as follows: a. Is it necessary to have both the switches closed

b. c.
3

simultaneously for lamp to turn on? Will the lamp turn ON if switch A or switch B is closed? What will happen if both switches are open?

Binary Logic
Consists of binary (twovalue) variables and logical operations

Variables are A, B, C, x,
y, z etc.

logical operations AND,


OR, NOT etc.
4

Basic Logic Gates


OR Operator
represented by + sign

AND Operator
represented by . sign

NOT Operator
represented by '
5

Basic Logic Gates

Multiple Input Gates

Secondary Logic Gates (1)


Buffer NAND

NOR

Secondary Logic Gates (2)


XOR (Exclusive-OR)

XNOR (Exclusive-NOR)

Exercise (1)

f = (a b c) ' g = (a + b + c) '
10

Exercise (2)

f = (a b) g = (a b)'
11

Boolean Algebra

An algebra that deals with binary


variables and logic operations.

Developed by George Boole in 1854 Shannon introduced two-valued Boolean


algebra in 1938. Huntington formulated the formal definition of Boolean algebra through the postulates in 1904.
12

Postulates for Boolean Algebra


Postulate 1: Closure property for + and . Postulate 2: Identity law, 0 for +, 1 for .
x + 0 = x; x.1=x Postulate 3: Commutative property for + and . x + y = y + x; x.y=y.x Postulate 4: Distributive property (. over +, + over .) x . (y + z) = (x . y) + (x . z) x + (y . z) = (x + y) . (x + z) Postulate 5: Complement (for every x there is an x) x + x = 1 x . x = 0
13

Basic Theorems for Boolean Algebra Straight Simplification using these theorems Duality principle: One expression can be
reformulated if the binary operators and the identity elements are interchanged. Theorem # 1: (Idempotency Law)

(x + x) = x
(x . x) = x
14

Basic Theorems for Boolean Algebra


Theorem # 2:

x+1=1
(any variable + 1 = 1)

x.0=0
(any variable AND with 0 = 0 )

15

Basic Theorems for Boolean Algebra


Theorem # 3: (Involution or Double Negation)

(x) = x

16

Basic Theorems for Boolean Algebra


Theorem # 4: (Associative Law) If x , y & z are three variables, then

x + (y + z) = (x + y) + z x . (y . z) = (x . y) . z
17

Basic Theorems for Boolean Algebra


Theorem # 5: (Demorgans Law) If x & y are two variables, then

(x + y) = x . y
(x . y) = x + y
Demorgans Laws are one of the most important set of Boolean Algebraic Laws.
18

Basic Theorems for Boolean Algebra


Theorem # 6: (Absorption Law)

If x & y are two variables then,


x + xy = x or x(x + y) = x (through duality) Here variable y is absorbed by the variable x. Similarly x + xy = x + y x(x + y) = xy x + xy = x + y x(x + y) = xy
19

Proof Absorption Law


x + xy = x Proof:

x + xy = x (1 + y) = x (1) =x Hence Proved

20

Simplification by using Basic Rules Similarly:


x + xy = x + y Proof:

x + xy = x (1 + y) + xy
As 1 + y = 1 and x.1 = x

= x + xy + xy = x + (x + x) y =x+y
21

Basic Theorems for Boolean Algebra


Theorem # 7: (Consensus Theorem) If x , y and z are three variables then,

(x.y) + (y.z) + (z.x) = (x.y) + (z.x)


The proofs of all the above laws can also be obtained by using truth table.

22

Proof Consensus Theorem


(x.y) + (y.z) + (z.x) = (x.y) + (z.x) Proof:

(x.y) + (y.z) + (z.x) = xy + (x + x)yz + xz = xy + xyz + xyz + xz = xy(1 + z) + xz(y + 1) = xy + xz


23

Rule Number Boolean Expression

1
2 3 4 5 6 7 8 9

10
11 12
24

Prove that (A + B) (A + C) = A + BC
(A + B) (A+C) = AA +AC + BA + BC = A + AC + BA + BC = A (1 + C) + BA + BC = A.1 +BA + BC = A + BA + BC = A (1 + B) + BC = A.1 + BC = A + BC Distributive law Rule #7 Distributive law Rule 2 Rule 4 Distributive law Rule 2

25

Operator Precedence
Operator Precedence for evaluating Boolean expressions is

Parentheses

NOT
AND OR

26

Boolean Functions
A Boolean function described by an algebraic expression
consists of binary variables, the constants 0 and 1, and the logic operation symbols. For a given value of the binary variables, the function can be equal to either 1 or 0. Example: F1 = x + y'z The function F1 is equal to 1 if x is equal to 1 or if both y' and z

27

are equal to 1. The complement operation dictates that when y' = 1, y = 0. Therefore, F1 = 1 if x = 1 or if y = 0 and z = 1. F1 is equal to 0 otherwise.

Truth table for function F1

Gate implementation of F1 = x + y' z


28

Another Example
Boolean function F2 = x' y' z + x' y z + x y' Simplifies to F2 = x' y' z + x' y z + x y' = x' z (y' + y) + x y' = x' z + x y'

29

Truth table for Function F2

F2 = x' y' z + x' y z + x y F2 = x' z + x y'


30

Gate Implementation of F2
Gate implementation of function F2

Gate implementation of simplified form of function F2

31

32

Complement of a Function
Complement of a function F is F' Obtained from an interchange of 0s for 1s and 1s for 0s
in the value of F.

Algebraically may be derived through DeMorgans


Theorems.

33

Canonical and Standard Forms


Canonical form: consists of terms comprising of all
variables e.g., xy + x' y' Sum of Product (SOP)
Sum of Minterms Standard Product (XZ) + (Y' Z) + (X' YZ)

Product of Sum (POS)


Product of Maxterms Standard Sums (X + Z) (Y' + Z) (X' + Y + Z)

Standard form: a reduced (short) form of canonical


expression.
34

Minterms & Maxterms A minterm is a special product of literals, in which


each input variable appears exactly once. 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: Each minterm is true for exactly one combination of inputs:
xyz - xyz - xyz - xyz - xyz - x yz - xyz - xyz

35

Minterm Is True when


Minterm xyz Condition x=0, y=0, z=0 Shorthand m0

xyz
xyz xyz xyz

x=0, y=0, z=1


x=0, y=1, z=0 x=0, y=1, z=1 x=1, y=0, z=0

m1
m2 m3 m4

xyz
xyz xyz
36

x=1, y=0, z=1


x=1, y=1, z=0 x=1, y=1, z=1

m5
m6 m7

Sum of Minterms Form Every function can be written as a sum of minterms,


which is a special kind of sum of products form

The sum of minterms form for any function is


unique

If you have a truth table for a function, you can


write a sum of minterms expression just by picking out the rows of the table where the function output is 1.
37

Example
x 0 0 y 0 0 z 0 1 f(x,y,z) 1 1 f(x,y,z) 0 0

0
0 1

1
1 0

0
1 0

1
1 0

0
0 1

1
1 1
38

0
1 1

1
0 1

0
1 0

1
0 1

Example
= xyz + xyz + xyz + xyz + xyz = m0 + m1 + m2 + m3 + m6 f(x,y,z) = (0,1,2,3,6) f

= xyz + xyz + xyz = m4 + m5 + m7 = (4,5,7) f contains all the minterms not in f


39

Product of Maxterms A product of sums (POS) expression contains:


Only AND (product) operations at the outermost level Each term must be a sum of literals

Product of sums expressions can be implemented


with two-level circuits literals and their complements at the 0th level OR gates at the first level a single AND gate at the second level

Compare this with sums of products


40

Product of Maxterms
A maxterm is a sum of literals, in which each input
variable appears exactly once.

A function with N variables has 2N maxterms


The maxterms for a three-variable function f(x,y,z):
x + y + z x + y + z
41

x + y + z x + y + z

x + y + z x+ y + z x + y + z x + y + z

Maxterm Is false when


Maxterm x+y+z Condition x=0, y=0, z=0 Shorthand M0

x + y + z
x + y + z x + y + z x + y + z

x=0, y=0, z=1


x=0, y=1, z=0 x=0, y=1, z=1 x=1, y=0, z=0

M1
M2 M3 M4

x + y + z
x + y + z x + y + z
42

x=1, y=0, z=1


x=1, y=1, z=0 x=1, y=1, z=1

M5
M6 M7

Product of Maxterms
Every function can be written as a unique product of
maxterms

If you have a truth table for a function, you can


write a product of maxterms expression by picking out the rows of the table where the function output is 0.

43

Example
x 0 0 y 0 0 z 0 1 f(x,y,z) 1 1 f(x,y,z) 0 0

0
0 1

1
1 0

0
1 0

1
1 0

0
0 1

1
1 1
44

0
1 1

1
0 1

0
1 0

1
0 1

Example
f = (x + y + z)(x + y + z)(x + y + z) = M4 M5 M7 = (4,5,7) = (x + y + z)(x + y + z)(x + y + z) (x + y + z)(x + y + z) = M0 M1 M2 M3 M6 = (0,1,2,3,6)

f contains all the maxterms not in f


45

Minterms and Maxterms are Related


Any minterm mi is the complement of the corresponding
maxterm Mi
Minterm xyz xyz xyz xyz xyz xyz xyz Shorthand m0 m1 m2 m3 m4 m5 m6

xyz
46

m7

Minterms and Maxterms are Related


Maxterm x+y+z x + y + z x + y + z Shorthand M0 M1 M2

x + y + z
x + y + z

M3
M4

x + y + z
x + y + z x + y + z

M5
M6 M7

For example, m4 = M4 because (xyz) = x + y + z


47

Conversion between Canonical 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 dont appear in the sum of minterms

The same thing works for converting from a


product of maxterms to a sum of minterms
48

Conversion between Canonical Forms


From Previous Example; f = (0,1,2,3,6) and f = (4,5,7) = m4 + m5 + m7 complementing (f) = (m4 + m5 + m7) f = m4 m5 m7 [DeMorgans law] = M4 M5 M7 [By the previous page] = (4,5,7)`
49

Conversion between Canonical Forms In general, just replace the minterms with maxterms,
using maxterm numbers that dont appear in the sum of minterms: f = m(0,1,2,3,6) = M(4,5,7)

The same thing works for converting from a product


of maxterms to a sum of minterms

50

Equivalent Circuits & its Simplification

51

Equivalent Circuits & its Simplification

52

Equivalent Circuits & its Simplification

53

Equivalent Circuits & its Simplification

54

Now simplifying the expression

55

Final Simplified Circuit....

56

Similarly

57

Review Sum-Of-Products, or SOP, Boolean expressions


may be generated from truth tables quite easily, by determining which rows of the table have an output of 1, writing one product term for each row, and finally summing all the product terms. This creates a Boolean expression representing the truth table as a whole.

Sum-Of-Products expressions lend themselves well


to implementation as a set of AND gates (products) feeding into a single OR gate (sum).
58

Review Product-Of-Sums, or POS, Boolean expressions


may also be generated from truth tables quite easily, by determining which rows of the table have an output of 0, writing one sum term for each row, and finally multiplying all the sum terms. This creates a Boolean expression representing the truth table as a whole.

Product-Of-Sums expressions lend themselves well


to implementation as a set of OR gates (sums) feeding into a single AND gate (product).
59

Multiple Input Gates


NOR does not extend easily
Associative law does not hold

60

Positive and Negative Logic


Signal levels as high (H) or low (L)

Positive logic
H1 L0

Negative logic
H0 L1

61

Positive and Negative Logic


Truth Table for H and L

In positive logic: AND

In negative logic: OR

62

Integrated Circuits (IC)


Small Scale Integration (SSI)
10s of logic gates

Medium Scale Integration (MSI)


100s 1000s of logic gates

Large Scale Integration (LSI)


1000s 10000s of logic gates
100000s of logic gates Millions of logic gates

Very Large Scale Integration (VLSI) Ultra Large Scale Integration (ULSI)

63

Standard Form
F = A + BC

Truth Table
Minterms or Maxterms Algebra

64

You might also like