Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

VIETNAM NATIONAL UNIVERSITY, HANOI

ĐẠI HỌC
CÔNG NGHỆ University of Engineering and Technology

ELT2041: Digital Design


Boolean and Switching Algebra

Xuan-Tu Tran
Faculty of Electronics and Telecommunications (FET)
VNU Key Laboratory for Smart Integrated Systems (SISLAB)

ĐẠI HỌC
CÔNG NGHỆ
History

⚫ Developed by George Boole


⚫ in his book (a treatise): “An Investigation of the Laws of Thought”
⚫ no application was made of Boolean Algebra until the late 1930s
⚫ Nakashima in Japan (1937) and Shannon at MIT (1938), each independently applied the algebra of
Boole to the analysis of networks of relays (in telephone systems).

3/29/2023 Xuan-Tu Tran 2

1
ĐẠI HỌC
CÔNG NGHỆ
The Huntington postulates

⚫ In 1904, Huntington found that


⚫ all of the results and implications of the algebra described by Boole could be derived from only
six basic postulates.

⚫ Huntington postulates: The set {B, +, ·, ¯ }


⚫ B is the set of elements or constants of the algebra
⚫ the symbols + and · are two binary operators(*)
⚫ the overbar ¯ is a unary operator(*)

is a Boolean algebra if the following hold true:

(*) The terms binary operator and unary operator refer to the number of arguments involved
in the operation: two or one, respectively.

3/29/2023 Xuan-Tu Tran 3

ĐẠI HỌC
CÔNG NGHỆ
The Huntington postulates

1. Closure (khép kín)


For all elements a and b in the set B,

⚫ a+bB

⚫ a·bB

2. Existing 0 and 1 elements


⚫ There exists a 0 element in B such that

for every element a in B, 0+a=a+0=a

⚫ There exists a 1 element in B such that

for every element a in B, a=a·1=a

3/29/2023 Xuan-Tu Tran 4

2
ĐẠI HỌC
CÔNG NGHỆ
The Huntington postulates

3. Commutativity (giao hoán)


⚫ a+b=b+a
⚫ a·b=b·a

4. Distributivity (phân phối)


⚫ a · (b + c) = a · b + a · c
⚫ a + (b · c) = (a + b) · (a + c)

3/29/2023 Xuan-Tu Tran 5

ĐẠI HỌC
CÔNG NGHỆ
The Huntington postulates

5. a  B, there exists an element a-bar in the set B such that

a + a =1
aa = 0

6. There exists at least two distinct elements in B

Switching algebra is a Boolean algebra in which the number of


elements in the set B is precisely 2.

3/29/2023 Xuan-Tu Tran 6

3
ĐẠI HỌC
CÔNG NGHỆ
Switching Algebra

⚫ is a Boolean algebra in which the number of elements in the set B is precisely 2

⚫ The two binary operators, represented by the signs + and ·, are called the OR
and the AND, respectively.

⚫ The unary operator, represented by the overbar ¯, is called the NOT or the
complement operator.

3/29/2023 Xuan-Tu Tran 7

ĐẠI HỌC
CÔNG NGHỆ
Algebra Implications

⚫ Theorem 1 – idempotence (i)


a+a =a
(Định lý hấp thụ)
(ii) aa = a
Proof

a + a = (a + a ) 1 P-2(ii) a  a= a  a + 0 P-2(i)

= (a + a )  (a + a ) P-5(i) = aa + aa P-5(ii)

= a + aa P-4(ii) = a  (a + a ) P-4(i)

= a+0 P-5(ii) = a 1 P-5(i)

=a P-2(i) =a P-2(ii)

3/29/2023 Xuan-Tu Tran 8

4
ĐẠI HỌC
CÔNG NGHỆ
Algebra Implications

Theorem 2
a0 = 0a = 0

(i)

(ii) a +1 = 1+ a = 1
Proof

a0 = 0 + a 0 P-2(i) a +1 P-2(ii)

= aa + a 0 P-5(ii)
Principle
P-5(i)

of duality
= a  (a + 0) P-4(i) P-4(ii)

= a  (a ) P-2(i) P-2(ii)

=0 P-5(ii) P-5(i)

➔ Exercise for students


3/29/2023 Xuan-Tu Tran 9

ĐẠI HỌC
CÔNG NGHỆ
Algebra Implications

⚫ Theorem 3
Let a be an element of B. Then a-bar is unique.

Proof

Assume that a has 2 distinct complements


a = a 1 b = b 1 P-2(ii)
(not equal), a-bar and b. Then by P-5, we
must have that: = a  ( a + b) = b( a + a )
= a  a + a b = ba +ba P-4(i)
a +b =1 and a + a =1
= 0 + a b = 0+ba
and
= a b = a b P-2(i)
a b = 0 and aa = 0

3/29/2023 Xuan-Tu Tran


a =b 10

5
ĐẠI HỌC
CÔNG NGHỆ
Algebra Implications – Basic logic operations

⚫ From this point, we will restrict our attention to switching algebras only.
⚫ Switching algebra is basically a two-element Boolean algebra which, obviously,
has the two elements 0 and 1.

⚫ AND operation

Symbols
x y z=x·y
x
0 0 0 Theorem 1(ii) z
y
0 1 0 Theorem 2(i)
1 0 0 Postulate 3(ii) x
z
1 1 1 Theorem 1(ii) y 

3/29/2023 Xuan-Tu Tran 11

ĐẠI HỌC
CÔNG NGHỆ
Algebra Implications – Basic logic operations

Symbols
⚫ OR operation
x
x y z=x+y z
y
0 0 0 Derived from which

0 1 1 theorem, postulate?
x
1 0 1 Exercise for Students z
y 1
1 1 1

⚫ NOT operation Symbols

Derived from which x z


x z = x-bar
0 1 theorem, postulate?
1 0 Exercise for Students x z
1

3/29/2023 Xuan-Tu Tran 12

6
ĐẠI HỌC
CÔNG NGHỆ
Algebra Implications – Basic logic operations

⚫ NAND operation
Symbols
x y z=x·y
x
0 0 1 z
y
0 1 1
1 0 1 x
z
y 
1 1 0
⚫ NOR operation

Symbols
x y z=x+y
x
0 0 1 z
y
0 1 0
1 0 0 x
z
y 1
1 1 0
3/29/2023 Xuan-Tu Tran 13

ĐẠI HỌC
CÔNG NGHỆ
Algebra Implications – Basic logic operations

⚫ XOR operation
Symbols
x y z=xy
x
0 0 0 z
y
0 1 1
1 0 1 x
z
y =1
1 1 0

z = x  y = xy + x y

- Construct XOR gate from NOT, AND, and OR ?

3/29/2023 Xuan-Tu Tran 14

7
ĐẠI HỌC
CÔNG NGHỆ
Algebra Implications – Basic logic operations

⚫ NXOR operation
Symbols
x y z=xy
x
0 0 1 z
y
0 1 0
1 0 0 x
z
y =1
1 1 1

z = x  y = x. y + x. y
- Construct NXOR gate from NOT, AND, and OR ?

3/29/2023 Xuan-Tu Tran 15

ĐẠI HỌC
CÔNG NGHỆ
Algebra Implications

⚫ Theorem 4 – Involution
Định lý phủ định của phủ định

Let x be a switching variable. Then (x ) = x


Proof

x x (x ) Since the left column is identical to the right


0 1 0
column and we have listed all possibilities,
1 0 1 we have proved the result.

3/29/2023 Xuan-Tu Tran 16

8
ĐẠI HỌC
CÔNG NGHỆ
Algebra Implications

⚫ Theorem 5
Let x and y be two switching variables. Then (i) x + x y = x
(ii) x  (x + y ) = x
Proof

x y x y x + x y
0 0 0 0 + 0 0
0 1 0 0 + 0 0
1 0 0 1 + 0 1
1 1 1 1 + 1 1

3/29/2023 Xuan-Tu Tran 17

ĐẠI HỌC
CÔNG NGHỆ
Algebra Implications

⚫ Theorem 6
Let x, y, and z be switching variables. Then

1. Associativity (định lý kết hợp) (i) x  ( y  z ) = (x  y )  z


(ii) x + ( y + z ) = (x + y ) + z
2.
(i) x+xy = x+ y
(ii) x  (x + y ) = x  y
3. Consensus (đồng tâm)
(i) x y + x z + yz = x y + x z
(ii) (x + y )  (x + z )  ( y + z ) = (x + y )  (x + z )
3/29/2023 Xuan-Tu Tran 18

9
ĐẠI HỌC
CÔNG NGHỆ
Algebra Implications – De Morgan’s Theorem

⚫ De Morgan’s Theorem
Let x and y be two switching variables. Then

(x + y ) = x  y
(x  y ) = x + y
Proof

This theorem may easily verified by complete enumeration.


Exercise for Students

3/29/2023 Xuan-Tu Tran 19

ĐẠI HỌC
CÔNG NGHỆ
Algebra Implications – De Morgan’s Theorem

⚫ Used for the evaluation of complements of switching expressions.

⚫ For example, (x + y  (z + w))


= ( x )  ( y  ( z + w))
(
= (x )  y + (z + w) )
= ( x )  (y + ( z )  w )
= x  (y + z  w )
= x y + xzw

3/29/2023 Xuan-Tu Tran 20

10
ĐẠI HỌC
CÔNG NGHỆ
Algebra Implications – De Morgan’s Theorem

⚫ Corollary of De Morgan’s Theorem

(x1 + x2 +  + xn ) = x1  x2   xn
(x1  x2   xn ) = x1 + x2 +  + xn
Expand the following function:

((x  ( y + z )) ( y + w  z ) (x + z ))

3/29/2023 Xuan-Tu Tran 21

ĐẠI HỌC
CÔNG NGHỆ
Truth tables

⚫ Truth table

⚫ a simple way of representing a switching function is to make a list of the possible


variable assignments and note the value the function takes on for each
assignment. This list is called Truth Table.

⚫ How to create the Truth Table of a switching function?


⚫ For example,
F ( x, y, z ) = x + yz

3/29/2023 Xuan-Tu Tran 22

11
ĐẠI HỌC
CÔNG NGHỆ
Truth tables

F ( x, y, z ) = x + yz
x y z F (x, y, z)
0 0 0 1
0 0 1 1
0 1 0 1
0 1 1 1
2n assignment 1 0 0 0
possibilities 1 0 1 0
1 1 0 1
1 1 1 0

- Write the Truth Table for the following switching function: F (x, y, z) = x y z + x y
3/29/2023 Xuan-Tu Tran 23

ĐẠI HỌC
CÔNG NGHỆ
Truth tables

⚫ Find a switching function from a truth table

x y F (x, y)

0 0 0 F (x, y) ???
0 1 0

1 0 0

1 1 1

3/29/2023 Xuan-Tu Tran 24

12
ĐẠI HỌC
CÔNG NGHỆ
Canonical forms: Minterm - Maxterm

⚫ Alternatives to the tabular representation


⚫ To list only the assignments for which a function is 1 or,
⚫ To list those for which the function is 0
➔ Canonical representation

⚫ F = 1 whenever x = 1 and y = 1
x y F (x, y)
0 0 0

F ( x, y ) = xy 0 1 0
1 0 0
1 1 1

3/29/2023 Xuan-Tu Tran 25

ĐẠI HỌC
CÔNG NGHỆ
Canonical forms: Minterm - Maxterm

⚫ Sum of Products (SOP) expression

x y z F (x, y, z) If a product term involves all the


0 0 0 0 variables of a function, it is
0 0 1 1 referred to as a Minterm
0 1 0 1
0 1 1 0 A SOP is made of minterms only is
1 0 0 0
called a canonical minterm
1 0 1 1
expression or expansion of the
1 1 0 0
function F(x, y, z)
1 1 1 0

F ( x, y, z ) = x yz + x yz + xyz
3/29/2023 Xuan-Tu Tran 26

13
ĐẠI HỌC
CÔNG NGHỆ
Canonical forms: Minterm - Maxterm

⚫ Sum of Products (SOP) expression


x y z F (x, y, z)
Write the SOP expression and
0 0 0 1
simplify the function !
0 0 1 1
0 1 0 1
F ( x, y , z ) =
0 1 1 1
1 0 0 0 = x yz + x yz + x yz + x yz + xyz
1 0 1 0 = x y ( z + z ) + x yz + yz ( x + x)
1 1 0 1
= x y + x yz + yz
1 1 1 0
= x + yz

3/29/2023 Xuan-Tu Tran 27

ĐẠI HỌC
CÔNG NGHỆ
Canonical forms: Minterm - Maxterm

⚫ Product of Sums (POS) expression


x y z F (x, y, z)
0 0 0 1
F ( x, y, z ) = xyz + xyz + xyz
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 0
F ( x, y , z ) = F ( x, y , z ) =
1 0 1 0
1 1 0 1 = xyz + xyz + xyz
1 1 1 0
= xyz  xyz  xyz
= ( x + y + z )( x + y + z )( x + y + z )
3/29/2023 Xuan-Tu Tran
= x + yz 28

14
ĐẠI HỌC
CÔNG NGHỆ
Canonical forms: Minterm - Maxterm

⚫ Product of Sums (POS) expression


x y z F (x, y, z)
0 0 0 0
F ( x, y , z ) = F ( x, y , z )
0 0 1 1
0 1 0 0 = x yz + x yz + x yz + xyz + xyz
0 1 1 0 = ( x + y + z )( x + y + z )( x + y + z )
1 0 0 0
1 0 1 1
( x + y + z )( x + y + z )
1 1 0 1
Each sum term involves all the
1 1 1 0
variables of a function is called a
Maxterm

3/29/2023 Xuan-Tu Tran 29

Conversion of SOP and POS expressions to canonical


forms
ĐẠI HỌC
CÔNG NGHỆ

F ( A, B, C ) = A B + AC
= A B 1 + A 1  C = A B + AC
= A B (C + C ) + A( B + B )C = ( A B + A)( A B + C )
= A BC + A BC + ABC + AB C = ( A + A )( A + B )(C + A )(C + B )
= 1  ( A + B )( A + C )( B + C )
= ( A + B )( A + C )( B + C )
= ( A + B )( A + C ) [concensus]
A+ B = A+ B +0
= A + B + CC
= ( A + B + C )( A + B + C ) P - 4(ii)

F ( A, B, C ) = ( A + B + C )( A + B + C )( A + B + C )( A + B + C )

3/29/2023 Xuan-Tu Tran 30

15
Conversion of SOP and POS expressions to canonical
forms
ĐẠI HỌC
CÔNG NGHỆ

Variable
Minterm (m) Maxterm (M)
A B C
A B C A B C =m0 A + B + C = M7
A B C A B C =m1 A + B + C = M6
A B C A B C =m2 A + B + C = M5
A B C A B C =m3 A + B + C = M4
A B C A B C =m4 A + B + C = M3
A B C A B C =m5 A + B + C = M2
A B C A B C =m6 A + B + C = M1
A B C A B C =m7 A + B + C = M0

3/29/2023 Xuan-Tu Tran M 0 = m0 31

Conversion of SOP and POS expressions to canonical


forms
ĐẠI HỌC
CÔNG NGHỆ

F ( A, B, C ) = A B + AC
= A B 1 + A 1  C
= A B (C + C ) + A( B + B )C
=  m(3, 2, 7, 5)
= A BC + A BC + ABC + AB C =  M (0, 1, 4, 6)

F ( A, B, C ) = ( A + B + C )( A + B + C )( A + B + C )( A + B + C )

3/29/2023 Xuan-Tu Tran 32

16
ĐẠI HỌC
CÔNG NGHỆ
Example

⚫ Construct a XOR gate from NOR and NOT


gates ? z = x  y = xy + x y

⚫ Construct a XOR gate from NAND and NOT


gates ?

3/29/2023 Xuan-Tu Tran 33

ĐẠI HỌC
CÔNG NGHỆ

3/29/2023 Xuan-Tu Tran 34

17
ĐẠI HỌC
CÔNG NGHỆ
Simplification of Switching Functions

⚫ Hardware cost of an equation


⚫ Related to the number of terms and the number of literals in each term of the expression.
⚫ The complexity of an equation should be reduced.

⚫ Three fundamental approaches can be used to simplify switching


expressions
⚫ Use postulates and other results to reduce the form of an expression algebraically. (require a good
deal of experience)
⚫ Use Karnaugh map (group of minterms are easily identified, limited variables)
⚫ Quine-McCluskey algorithm

3/29/2023 Xuan-Tu Tran 35

ĐẠI HỌC
CÔNG NGHỆ
Simplification of Switching Functions

⚫ Algebraic Manipulation

⚫ Simplified expression: contains a minimal number of literals and terms

⚫ Minimal SOP, Minimal POS

⚫ All theorems and postulates are used to find the minimal form

⚫ Depend on your experience !!!

⚫ 3 basic results are usually used for minimizing SOP expressions:

Result 1 : xy + x y = y (Verified using Distributivity)

Result 2 : x + x y = x + y Theorem 6, part 2(i)

Result 3 : x z + xy + yz = x z + xy Theorem 6, part 3(i) (consensus)

3/29/2023 Xuan-Tu Tran 36

18
ĐẠI HỌC
CÔNG NGHỆ
Simplification of Switching Functions

⚫ Algebraic Manipulation (cont’d)


⚫ Example:

f ( w, x, y, z ) = w x z + w xz + xyz + wxy
= ( x ( w z ) + x( w z ) ) + xyz + wxy
= w z + w( xy ) + z ( xy )
= w z + wxy

Result 1 : xy + x y = y
Result 2 : x + x y = x + y
Result 3 : x z + xy + yz = x z + xy

3/29/2023 Xuan-Tu Tran 37

ĐẠI HỌC
CÔNG NGHỆ
Simplification of Switching Functions

⚫ Algebraic Manipulation (cont’d)


⚫ Example (for students):

g ( A, B, C , D) = ABC + ABC + BCD + A CD + AB C D


= [( AB)C + ( AB)C ] + BCD + A CD + AB C D
= AB + BCD + A CD + AB C D
= A[ B + B (C D )] + BCD + A CD
= A[ B + C D ] + BCD + A CD
Result 1 : xy + x y = y = AB + AC D + BCD + A CD
Result 2 : x + x y = x + y = [ A( B ) + A (CD ) + B (CD )] + AC D
Result 3 : x z + xy + yz = x z + xy
= AB + A CD + AC D

3/29/2023 Xuan-Tu Tran 38

19
ĐẠI HỌC
CÔNG NGHỆ
Simplification of Switching Functions

⚫ Algebraic Manipulation (cont’d)


⚫ Example:
x + y + z + y ( w + z ) + x z = ( x + x z ) + [ y + y ( w + z )] + z
Result 1 : xy + x y = y
= x+z + y+w+ z+z
Result 2 : x + x y = x + y
Result 3 : x z + xy + yz = xz + xy

None of the listed results can be applied for the above expression.
It’s OK or NOT yet ?

Attention: z + z =1
➔ The above expression should equal 1
3/29/2023 Xuan-Tu Tran 39

ĐẠI HỌC
CÔNG NGHỆ
Simplification of Switching Functions

⚫ Prime implicants
⚫ An implicant is a "covering" (sum term or product term) of one or more minterms in a sum of
products (or maxterms in a product of sums) of a boolean function.

⚫ In an SOP expression, each of the product terms ➔ an implicant of the function if it implies the
function (e.g., if the product term is 1 then the function is also 1).

3/29/2023 Xuan-Tu Tran 40

20
ĐẠI HỌC
CÔNG NGHỆ
Simplification of Switching Functions

⚫ Prime implicants
h( w, x, y, z ) = w x yz + w xyz + wx yz + wxyz
➔ Each of the minterm is an implicant.

= w ( x yz + xyz ) + w( x yz + xyz ) Smaller in

= x yz + xyz ➔ Each of these products is term of the


also an implicant. number of

= yz ➔ is also an implicant.
literals

A prime implicant of a function is an implicant that cannot be covered by a more


general (more reduced - meaning with fewer literals) implicant.

3/29/2023 Xuan-Tu Tran 41

ĐẠI HỌC
CÔNG NGHỆ
Simplification of Switching Functions

⚫ Minimal expression
⚫ Any other expression having fewer terms and literals will not represent the original function.

⚫ Minimal SOP = minimal expression in SOP form

⚫ Minimal POS = minimal expression in POS form

3/29/2023 Xuan-Tu Tran 42

21
ĐẠI HỌC
CÔNG NGHỆ
Simplification of Switching Functions

⚫ Karnaugh map
⚫ M. Karnaugh published an article describing a geometrical method for finding a
minimal closed cover (1953) ➔ Karnaugh map method

⚫ Based on mapping minterms onto a surface in such a way that minterms that differ
in one literal are adjacent to each other on the surface.
⚫ Reason: when 2 minterms differ in one literal, they can be combined to form a
product term which has this literal missing.

⚫ For example, ĀBC and ABC differ in only one literal (Ā and A) → the sum reduces
to A BC + ABC = BC

3/29/2023 Xuan-Tu Tran 43

ĐẠI HỌC
CÔNG NGHỆ
Simplification of Switching Functions

⚫ Karnaugh map
All minterms in the column labeled B contain the literalA B B
⚫ AB
B, all those in the other column contain B-bar. Similar
for the rows 1 0

⚫ 1 in each square corresponds to a minterm of the A 1 1


function f
AB AB
⚫ Prime implicants can be found by grouping the 1 cells f ( A, B )
into as large a block of adjacent cells as possible.

= AB + A B
⚫ For example, the pair of cells and group
together to give AB AB = B ( A + A)
B =B
3/29/2023 Xuan-Tu Tran 44

22
ĐẠI HỌC
CÔNG NGHỆ
Simplification of Switching Functions

⚫ Karnaugh map
1-cube: a single square B

B
⚫ 2-cube: two adjacent squares are taken together
1 0
⚫ 4-cube: two adjacent 2-cubes or two 2-cubes have a
long edge in common.
A 1 1
The largest cube of 1s represent the prime implicants.

A
⚫ In the figure, the prime implicants are A and B
therefore: f ( A, B )

f ( A, B) = A + B

How do we achieve the minimal SOP from minterm SOP expression?

3/29/2023 Xuan-Tu Tran 45

ĐẠI HỌC
CÔNG NGHỆ
Simplification of Switching Functions

⚫ Karnaugh map for 3 variables


⚫ Two 2-variable Karnaugh map are placed side by side after
reflecting one of the two 2-variable maps → get a 3-variable
map

x yz x yz y
x yz
x yz
0 1 1 1

x 1 1 1 1
xyz

xyz z xyz
xyz
3/29/2023 Xuan-Tu Tran 46

23
ĐẠI HỌC
CÔNG NGHỆ
Simplification of Switching Functions

y wy
⚫ Karnaugh map for 4 variables
⚫ Two 3-variable Karnaugh map are
placed side by side after reflecting one
of the two 3-variable maps → get a 4-
variable map w

⚫ How to find prime implicants for the dash x


boxes ?
z
w

z y

3/29/2023 Xuan-Tu Tran 47

ĐẠI HỌC
CÔNG NGHỆ
Simplification of Switching Functions

⚫ Karnaugh map examples


⚫ Simples examples for Karnaugh map

⚫ Timing Hazards

⚫ Karnaugh map examples with timing hazards

3/29/2023 Xuan-Tu Tran 48

24
ĐẠI HỌC
CÔNG NGHỆ
Delay in gate networks (cont’d)

⚫ Generation of a “glitch” in a combinational circuit.

Timing diagrams assuming


that B and C are both high
throughout.

“Glitch” dues to the physical


3/29/2023 Xuan-Tu Tran
delays in a network 49

ĐẠI HỌC
CÔNG NGHỆ
Delay in gate networks (cont’d)

⚫ Adding the consensus (đồng tâm) to


the equation

The glitch will vanish because


BC = 1 throughout the various
transitions on A and A-bar

Note: Remove the consensus may cause undesired behavior

3/29/2023 Xuan-Tu Tran 50

25
ĐẠI HỌC
CÔNG NGHỆ

3/29/2023 Xuan-Tu Tran 51

ĐẠI HỌC
CÔNG NGHỆ

AB
CD

1 1
z
1 1

1 1

3/29/2023 Xuan-Tu Tran 52

26
ĐẠI HỌC
CÔNG NGHỆ

AB A
CD

1 1
D
z
1 1
C
1 1

B
3/29/2023 Xuan-Tu Tran 53

27

You might also like