binary logic - lms.uop.edu.jo

62
Binary logic • Binary logic deals with variables like (a, b, c , …, x, y) that take on two discrete values (0 , 1) and with operations that assume logic meaning ( AND, OR, NOT) Truth table is a table of all possible combinations of the variables showing the relation between the values that the variables may take and the result of operation. Ex. AND ( . ) z= x . y z= x and y z=xy z=x and y Dr.Abu-Arqoub 1

Upload: others

Post on 18-Dec-2021

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Binary logic - lms.uop.edu.jo

Binary logic

• Binary logic deals with variables like (a, b, c , …, x, y) that take on two discrete values (0 , 1) and with operations that assume logic meaning ( AND, OR, NOT)

• Truth table is a table of all possible combinations of the variables showing the relation between the values that the variables may take and the result of operation.

•Ex.

AND ( . )

z= x . y z= x and y

z=xy z=x and y

Dr.Abu-Arqoub1

Page 2: Binary logic - lms.uop.edu.jo

AND GATE

Z=x.yyx

000

010

001

111

• 0 off

• 1 on

~`

X Y

Dr.Abu-Arqoub2

Page 3: Binary logic - lms.uop.edu.jo

OR GATE

• OR (+)

Z=X+Y Z= x or y

Z=X+YYX

000

110

101

111

Dr.Abu-Arqoub3

Page 4: Binary logic - lms.uop.edu.jo

OR GATE

~`

X

Y

Dr.Abu-Arqoub4

Page 5: Binary logic - lms.uop.edu.jo

NOT GATE

• NOT (Bar), (Prime)

• Z = X‘ , Z = X NOT

X, X Bar, X Prime

Z=X’X

10

01

Dr.Abu-Arqoub5

Page 6: Binary logic - lms.uop.edu.jo

NOT GATE

`X~

Dr.Abu-Arqoub6

Page 7: Binary logic - lms.uop.edu.jo

Boolean algebra and logic gates

• Boolean algebra is an algebraic structure defined on a set of elements B together with two binary operators +(OR) and .(AND) providing the following postulates:

1. cloused with respect to operator +(OR)(مغلقة)

a + b=c a, b, c Є B

and closer with respect to operator .(AND)

a . b=c a, b, c Є B

2. An identity (محايد) element with respect to +(OR) by 0 and an identity element with respect to .(AND) by 1

x+0=0+x=x

x. 1=1. x=x

3. Commutative(تبديلي) with respect to +: x +y=y + x

Commutative with respect to . : x. y=y. x

4. Distributive (توزيعي)

. (AND) is distributive over +(OR): x (y + z)=x . y + x . z

+(OR) is distributive over .(AND): x +(y . z)=(x + y) . (x + z)

Dr.Abu-Arqoub7

Page 8: Binary logic - lms.uop.edu.jo

Boolean algebra and logic gates

5. For every element x Є B, there exist an

element x’ Є B called the complement of x

such that : x+x’=1 and x.x’=0

6. There exist at least two elements x, y Є B

such that x ≠ y

Dr.Abu-Arqoub8

Page 9: Binary logic - lms.uop.edu.jo

Boolean algebra and logic gates

• Example :

• a two – valued Boolean algebra is defined on a set of two elements B={ 0,1}, with rules for the two binary operators (+) & (.) such

1. Closed results 0 or 1

and (0,1) Є B

2. It has the two identity elements 0 for (+) and 1 for (.)

3 commutative since x+y=y+x & x.y=y.x

4.------ next slide

5. For each x there is x’ : x+x’=1

• 0+1=1

• 1+0=1

6. Two elements (0,1) with 0≠ 1

x.x’x+x’x’x+yx.yyx

0110000

0111010

0101001

0101111

Dr.Abu-Arqoub9

Page 10: Binary logic - lms.uop.edu.jo

Boolean algebra and logic gates

4. Distributive since

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

xy+xzx.(y+z)Y+zx.zx.yzyx

00000000

00100100

00100010

00100110

00000001

11110101

11101011

11111111Dr.Abu-Arqoub10

Page 11: Binary logic - lms.uop.edu.jo

Basic theorems and properties of Boolean algebra

• Duality (ازدواجية): in duality leave the

element (variables) of the set of B the

same, then change the (+) by (.)

operators, the (.) by (+) & replace the 1’s

by zeros, and zeros by ones.

• Ex

x+0=x by duality x.1=x

Dr.Abu-Arqoub11

Page 12: Binary logic - lms.uop.edu.jo

Postulates & Theorems of Boolean Algebra

1. X + 0 = X X . 1 = X

2. X + X’ = 1 X . X’ = 0

3. X + X = X X . X = X

4. X + 1 = 1 X . 0 = 0

5. (X’)’ = X

6. X + Y = Y + X X . Y = Y . X

7. X + ( Y + Z ) = ( X + Y ) + Z

X . ( Y . Z ) = ( X . Y ) . Z

Dual

Dr.Abu-Arqoub12

Page 13: Binary logic - lms.uop.edu.jo

Postulates & Theorems of Boolean

Algebra

8. X . ( Y + Z ) = X . Y + X . Z

X + ( Y . Z ) = X + Y . X + Z

9. ( X + Y )’ = X’ . Y’ (De Morgan Theorem)

( X . Y )’ = X’ + Y’

10. X + XY = X X . ( X + Y ) = X

X . ( X + Y ) = X . X + X . Y

= X + XY

= X ( 1 + Y )

= X . 1

= X

Dr.Abu-Arqoub13

Page 14: Binary logic - lms.uop.edu.jo

Postulates & Theorems of Boolean

Algebra

Dr.Abu-Arqoub14

Page 15: Binary logic - lms.uop.edu.jo

Boolean Functions

• A Boolean function is an expression

formed with binary variables, the two

binary operators OR & AND, the unary

operator NOT, parentheses, and

equal sign.

• A Boolean function may be represented in

a truth table.

Dr.Abu-Arqoub15

Page 16: Binary logic - lms.uop.edu.jo

Boolean Functions

• Ex: Suppose we have three Boolean

functions: F1, F2, and F3.

F1 = F2 & F1 ≠ F3

F3 (X, Y)F2 (X, Y)F1 (X, Y)YX

10000

11110

11101

11111

Dr.Abu-Arqoub16

Page 17: Binary logic - lms.uop.edu.jo

Boolean Functions

• Two functions of n variables are said to be

equal if they have the same value for all

possible 2n combinations of n variables.

• The complement of a function F is F’ and

it’s obtained from an interchange of 0’s for

1’s and 1’s for 0’s in the value of F.

Dr.Abu-Arqoub17

Page 18: Binary logic - lms.uop.edu.jo

Boolean Functions

• Ex:

Note: (F1)’≠ (F2) ,(F1 dual F2) but (F1)’=(F3)

F3 (X, Y, Z) =

X’ + Y’ + Z’

F2 (X, Y, Z) =

X + Y + Z

F1 (X, Y, Z) =

X . Y . Z

ZYX

100000

110100

110010

110110

110001

110101

110011

011111

Dr.Abu-Arqoub18

Page 19: Binary logic - lms.uop.edu.jo

Examples on functions

• Draw a logic circuit that represents the

following function:

F=x+y’z

Dr.Abu-Arqoub19

Page 20: Binary logic - lms.uop.edu.jo

Examples on functions

• Draw a logic circuit that represents the

following function:

F=xy’+x’z

Dr.Abu-Arqoub20

Page 21: Binary logic - lms.uop.edu.jo

Examples on functions

• Draw a logic circuit that represents the following

functions:

Dr.Abu-Arqoub21

Page 22: Binary logic - lms.uop.edu.jo

Simplification of Boolean Functions

• Simplify the following Boolean functions:• 1. x(x’+y)

• 2. x+x’y

• 3. (x+y).(x+y’)

• 4. xy+x’z+yz

Dr.Abu-Arqoub

22

Page 23: Binary logic - lms.uop.edu.jo

Simplification of Boolean Functions

• Simplify the following Boolean functions:

F=x’y’z+x’yz+xy’

=x’z(y’+y)+xy’

=x’z.1+xy’

= x’z+xy’

Dr.Abu-Arqoub23

Page 24: Binary logic - lms.uop.edu.jo

Complement of a Boolean function

• To find the complement of any Boolean

function we can use:

• 1. Direct method (using Demorgan law)

• 2. Dual of the function and complement of

each literal.

• 3. min-max terms

Dr.Abu-Arqoub24

Page 25: Binary logic - lms.uop.edu.jo

Complement a function using Demorgan law

• In this method• 1. the relation between elements changed from AND to OR

and vice versa

• 2. each element individually inversed

• Examples:

– find the complement of the following functions:

• 1. F=x’yz’+x’y’z

F’

Dr.Abu-Arqoub25

Page 26: Binary logic - lms.uop.edu.jo

Examples

• 2.

F1’

• 3. F2=x.(y’z+yz’)

F2’=x’+(y’z+yz’)’

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

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

Dr.Abu-Arqoub26

Page 27: Binary logic - lms.uop.edu.jo

Complement a function using Duality

• In this method :• 1. take the dual of the function

• 2. take the complement of each literal

• Example:

F=x.(y’z+yz’) find F’

1. dual x+(y’+z).(y+z’)

2. complement of each litiral

x’+(y+z’).(y’+z)

Dr.Abu-Arqoub27

Page 28: Binary logic - lms.uop.edu.jo

Example

Given F (X, Y, Z) = XY’Z + XYZ’, Find F’

using:

1.De Morgan’s theorem

2.Dual & then complement the variables.

Continue Dr.Abu-Arqoub28

Page 29: Binary logic - lms.uop.edu.jo

Example

1. Using De Morgan’s theorem

F’(X, Y, Z) = (XY’Z + XYZ’ )’

= (X’ + Y + Z’) . (X’ + Y’ + Z)

2. Using dual & then complement the

variables

Duality of F (X + Y’ + Z) . (X + Y + Z’)

Then complement the variables

F’(X, Y, Z) = (X’ + Y + Z’) . (X’ + Y’ + Z)Dr.Abu-Arqoub29

Page 30: Binary logic - lms.uop.edu.jo

Digital logic gates

Dr.Abu-Arqoub30

Page 31: Binary logic - lms.uop.edu.jo

Digital logic gates

Dr.Abu-Arqoub31

Page 32: Binary logic - lms.uop.edu.jo

NAND (NOT AND) Gate

• F1(X, Y, Z)

• F1‘ (X, Y, Z)

• We can describe it using the NAND gate as

follows: Continue

Dr.Abu-Arqoub32

Page 33: Binary logic - lms.uop.edu.jo

NAND Gate

Continue Dr.Abu-Arqoub33

Page 34: Binary logic - lms.uop.edu.jo

NOR (NOT OR) Gate

• F2(X, Y, Z)

• F2‘ (X, Y, Z)

• We can describe it using the NOR gate as

follows: Continue

Dr.Abu-Arqoub34

Page 35: Binary logic - lms.uop.edu.jo

NOR Gate

• Note: A simple way for deriving the complement

of a function is to take the dual & complement

each literal.

Dr.Abu-Arqoub35

Page 36: Binary logic - lms.uop.edu.jo

Boolean Functions (Min-terms)

• Any Boolean function can be expressed as a sum of

min-terms (“sum” : ORing of terms) and the function will

be in sum of Product (SOP).

• n variables forming an AND term with each variable

being primed (if equal to 0) or unprimed (if equal to 1)

providing 2n possible combinations called min-term (mj)

or Standard of Product.

Dr.Abu-Arqoub36

Page 37: Binary logic - lms.uop.edu.jo

Boolean Functions (Min-terms)

• Ex:

m0 = X’ . Y’ m2 = X . Y’

m1 = X’ . Y m3 = X . Y

F(X, Y) = m1 + m2 = X’Y + XY’ = ∑(1, 2) (SOP) (Canonical form)

F(X, Y) = m1 + m2mjYX

0m000

1m110

1m201

0m311

Dr.Abu-Arqoub37

Page 38: Binary logic - lms.uop.edu.jo

Boolean Functions (Min-terms)

• Ex:

F(X, Y, Z)mjZYX

0m0000

1m1100

0m2010

1m3110

0m4001

1m5101

1m6011

1m7111

Dr.Abu-Arqoub38

Page 39: Binary logic - lms.uop.edu.jo

Boolean Functions (Min-terms)

• m0 = X’ . Y’ . Z’ m1= X’ . Y’ . Z

• m2 = X’ . Y . Z’ m3 = X’ . Y . Z

• m4 = X . Y’ . Z’ m5 = X . Y’ . Z

• m6 = X . Y . Z’ m7 = X . Y . Z

F(X, Y, Z) = m1 + m3 + m5 + m6 + m7

= ∑ (1, 3, 5, 6, 7)

Dr.Abu-Arqoub39

Page 40: Binary logic - lms.uop.edu.jo

Boolean Functions (Max-terms)

• A Boolean function can be expressed as the product of

max-terms (“Product” = ANDing of the terms) and the

function would be then in the product of Sum (POS).

• n variables forming an OR term with each variable being

primed (if equal to 1) or unprimed (if equal to 0) providing

2n possible combinations called max-term (Mj) or

Standard Sum.

Dr.Abu-Arqoub40

Page 41: Binary logic - lms.uop.edu.jo

Boolean Functions (Max-terms)

• Ex:

M0 = X + Y M2 = X’ + Y

M1 = X + Y’ M3 = X’ + Y’

F(X, Y) = M0 . M3 = (X + Y) . (X’ + Y’) =

(POM)

F ( X, Y )MjYX

0M000

1M110

1M201

0M311

)3,0(

Dr.Abu-Arqoub41

Page 42: Binary logic - lms.uop.edu.jo

Boolean Functions (Max-terms)

Note that

∑ (1,2) is a complement of

(mj)’ = Mj ( Mj)’ = mj

(m0)’ = M0

(X + Y)’ = X’ . Y’

If given F(x,Y)= m1 + m2 = X’Y + XY’ = ∑(1, 2) = M0 . M3 = (X + Y) .

(X’ + Y’)= ∏(0,3) then

F’(x,y)=m0+m3=x’y’+xy= ∑(0, 3)

=M1.M2=(x+y’)(X’+y)= ∏(1,2)

)2,1(

Dr.Abu-Arqoub42

Page 43: Binary logic - lms.uop.edu.jo

Conversion between canonical forms

Mm

0,1,2,43,5,6,7F

3,5,6,70,1,2,4F’

Dr.Abu-Arqoub43

Page 44: Binary logic - lms.uop.edu.jo

Boolean Functions (Max-terms)

• Ex:F (X, Y, Z)MjZYX

0M0000

1M1100

0M2010

1M3110

0M4001

1M5101

1M6011

1M7111

Dr.Abu-Arqoub44

Page 45: Binary logic - lms.uop.edu.jo

Boolean Functions (Max-terms)

• M0 = X + Y + Z

• M1 = X + Y + Z’

• M2 = X + Y’ + Z

• M3 = X + Y’ + Z’

• M4 = X’ + Y + Z

• M5 = X’ + Y + Z’

• M6 = X’ + Y’ + Z

• M7 = X’ + Y’ + Z’

• F (X, Y, Z) = M0 . M2 . M4

• F (X, Y, Z) = )4,2,0(

Dr.Abu-Arqoub45

Page 46: Binary logic - lms.uop.edu.jo

Boolean Functions

• To convert from one Canonical form to another,

interchange the symbols ∑ with ∏ and list those

numbers missing from the original form.

• The total number of min-terms or max-terms is 2n where

n is the number of binary variables in the function.

• Ex: Given F(X, Y) = ∑ (1, 3), Find F(X, Y) = ∏ (?)

F(X, Y) = ∏ (0, 2) (POM)

Dr.Abu-Arqoub46

Page 47: Binary logic - lms.uop.edu.jo

Boolean Functions

• Ex: Given F(X, Y, Z) = (0, 3, 7),

Find F(X, Y, Z) = ∑ (?)

F(X, Y, Z) = ∑ (1, 2, 4, 5, 6) (SOM)

Dr.Abu-Arqoub47

Page 48: Binary logic - lms.uop.edu.jo

Boolean Functions

If the Boolean function is not in “SOP”, it can be made so

by first expanding the expression into a sum of AND

terms, then if any term missing one or more variables

it’s ANDed with an expression such as (X + X’) ( X is

one of the missing variables).

Ex:

F(A, B, C) = B + A’C, Find the SOM form of F(A, B, C)

Dr.Abu-Arqoub48

Page 49: Binary logic - lms.uop.edu.jo

Boolean Functions

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

= (BA + BA’) (C + C’) + A’BC + A’B’C

= ABC + ABC’ + A’BC + A’BC’ + A’BC + A’B’C

= m7 + m6 + m3 + m2 + m3 + m1

= ∑ (1, 2, 3, 6, 7) (SOM)

F(A, B, C) = (0, 4, 5) (POM)

= (A + B + C ) . (A’ + B + C ) . (A’ + B + C’ )

Dr.Abu-Arqoub49

Page 50: Binary logic - lms.uop.edu.jo

Boolean Functions

• If the Boolean function is not in “POM”, it can be

made so by first expanding the expression into a

product of OR terms (using the distributive rule),

then if any term missing one or more variables

it’s ORed with an expression such as (X X’) (

X is one of the missing variables).

• Ex:

• F(A, B, C) = B + A’C, Find the POM form of F(A, B, C)

Dr.Abu-Arqoub50

Page 51: Binary logic - lms.uop.edu.jo

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

=(B+A’)(B+C)

=(B+A’+CC’)(B+C+AA’)

=(B+A’+C)(B+A’+C’)(B+C+A) (B+C+A’)

=(A’+B+C)(A’+B+C’)(A+B+C)

=M4.M5.M0

=M0.M4.M5

= (0,4,5)∏

Dr.Abu-Arqoub51

Page 52: Binary logic - lms.uop.edu.jo

Boolean Functions

• Ex:

1. Find F2 (X, Y) = F1 (X, Y)

2. Find F3 (X, Y) = (F1)’(X, Y)

3. Express F1 (X, Y) in sum of min-terms (SOM)

4. Express F1 (X, Y) in product of max-terms (POM)

5. Express F3 in SOM

6. Implement F1 (X, Y) using logic gates (Logic Diagram).

F1 (X, Y)YX

100

010

001

111

Dr.Abu-Arqoub52

Page 53: Binary logic - lms.uop.edu.jo

Boolean Functions

Note: 1 & 2 answers are shown in the table.

3. F1 (X, Y) = m0 + m3 = X’ Y’ + XY = ∑ (0, 3)

4. F1 (X, Y) = M1 . M2 = (X + Y’) . (X’ + Y) = ∏ (1, 2)

F3 (X, Y)F2 (X, Y)F1 (X, Y)YX

01100

10010

10001

01111

Dr.Abu-Arqoub53

Page 54: Binary logic - lms.uop.edu.jo

Boolean Functions

5. F3 (X, Y) = m1 + m2 = X’Y + XY’ = ∑ (1, 2)

X Y

6. F1 (X, Y) = X’Y’ + XY

Dr.Abu-Arqoub54

Page 55: Binary logic - lms.uop.edu.jo

Boolean Functions

• Ex:

Given F1 (X, Y, Z) = X’YZ + XY’Z + XYZ.

1. Find Truth Table for F1 (X, Y, Z).

2. Express F1 (X, Y, Z) in Product of Max-terms (POM).

3. Find F2 (X, Y, Z) = (F1)’(X, Y, Z).

4. Express F2 (X, Y, Z) in SOM.

5. Implement F1 (X, Y, Z) using logic gates.

Dr.Abu-Arqoub55

Page 56: Binary logic - lms.uop.edu.jo

Boolean Functions

1. F1 (X, Y, Z) = m3 + m5 + m7 = ∑ (3, 5, 7)

F2 (X, Y, Z) F1 (X, Y, Z) ZYX

10000

10100

10010

01110

10001

01101

10011

01111

Dr.Abu-Arqoub56

Page 57: Binary logic - lms.uop.edu.jo

Boolean Functions

2. F1 (X, Y, Z) = ∏ (0, 1, 2, 4, 6)

= M0 . M1 . M2 . M4 . M6

= (X + Y + Z) . (X + Y + Z’) . (X + Y’ + Z) .

(X’ + Y + Z) . (X’ + Y’ + Z)

3. F2 (X, Y, Z) = (F1)’(X, Y, Z)

=[ (X’YZ) + (XY’Z) + (XYZ) ]’

= (X + Y’ + Z’) . (X’ + Y + Z’) . (X’ + Y’ + Z’)

= M3 . M5 . M7 (Look at Truth Table)

Dr.Abu-Arqoub57

Page 58: Binary logic - lms.uop.edu.jo

Boolean Functions

4. F2 (X, Y, Z) = m0 + m1 + m2 + m4 + m6

= (X’.Y’. Z’) + (X’.Y’. Z) +

(X’.Y.Z’) + (X.Y’.Z’) . (X.Y.Z’)

5. Logic Diagram

Dr.Abu-Arqoub58

Page 59: Binary logic - lms.uop.edu.jo

Boolean Functions

Logical Function can be expressed in Canonical forms:

1. Sum of min-terms (SOM).

2. Product of max-terms (POM).

Or the logical Function can be expressed in the standard

forms:

1. Sum of Product (SOP).

2. Product of Sum (POS).

Dr.Abu-Arqoub59

Page 60: Binary logic - lms.uop.edu.jo

Boolean Functions

Ex:

F(X, Y, Z) = X’ + XZ + XYZ’ Sum of Products

Ex:

F(X, Y, Z) = Y (X’ + Y) (X + Y’ + Z) Product of Sums

Ex: Given F(X, Y, Z) = XY + XZ + YZ

Find 1. The truth table of F(X, Y, Z).

2. Express F(X, Y, Z) in SOM.

3. Implement F(X, Y, Z) using logic gates.

SOP

Dr.Abu-Arqoub60

Page 61: Binary logic - lms.uop.edu.jo

Boolean Functions

1. The answer is shown in the table.

F(X, Y, Z)ZYX

0000

0100

0010

1110

0001

1101

1011

1111

Dr.Abu-Arqoub61

Page 62: Binary logic - lms.uop.edu.jo

Boolean Functions

2. F(X, Y, Z) = XY (Z + Z’) + XZ (Y + Y’) + YZ (X + X’)

= XYZ + XYZ’ + XYZ + XY’Z + XYZ + X’YZ

= m7 + m6 + m5 + m3

3. Logic Diagram

Dr.Abu-Arqoub62