Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic...

36
Boolean Algebra & Logic Gates By : Ali Mustafa

Transcript of Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic...

Page 1: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Boolean Algebra & Logic Gates

By : Ali Mustafa

Page 2: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Digital Logic Gates

• There are three fundamental logical operations, from which all other functions, no matter how complex, can be derived. These Basic functions are named:

–AND

–OR

–NOT (INVERTER)

Page 3: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

AND Gate

• Represented by any of the following notations:

– X AND Y

– X . Y

– X Y

• Function definition:

Z = 1 only if X=Y=1

0 otherwise

Page 4: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

OR Gate • Represented by any of the following

notations:

– X OR Y

– X + Y

• Function definition:

Z = 1 if X=1 or Y =1 or both X=Y=1

0 if X=Y=0

Page 5: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

NOT (Inverter) Gate

• Represented by a bar over the variable

• Function definition:

It is also called complement operation , as it changes 1’s to 0’s and 0’s to 1’s.

Page 6: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Logic gates timing Diagram• Timing diagrams illustrate the response of any gate to all

possible input signal combinations.

• The horizontal axis of the timing diagram represents time and the vertical axis represents the signal as it changes between the two possible voltage levels 1 or 0

Page 7: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Other Gates

Page 8: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Others Gates

Page 9: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Digital Logic

• How to describe Digital logic system?

We have two methods: • Truth Table • Boolean Expression

Page 10: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

TRUTH TABLE • A Truth Table is a table of combinations of the binary variables

showing the relationship between the different values that the input variables take and the result of the operation (output).

• The number of rows in the Truth Table is where n = number of input variables in the function.

• The binary combinations are obtained from the binary number by counting from 0 to

• Example: AND gate with 2 inputs

– n=2

– The truth table has 2 rows = 4

– The binary combinations is from

0 to (22-1=(3)) [00,01,10,11]

Page 11: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

BOOLEAN EXPRESSIONS

• We can use these basic operations to form more complex expressions:

• Some terminology and notation:– f is the name of the function.

– (x,y,z) are the input variables, each representing 1 or 0. Listing the inputs is optional, but sometimes helpful.

– A literalis any occurrence of an input variable or its complement. The function above has four literals: x, y’, z, and x’.

Page 12: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

How to get the Boolean Expression from the truth table?

Page 13: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Boolean Expressions From Truth Tables

• Each 1 in the output of a truth table specifies one term in the corresponding booleanexpression.

Page 14: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Example

• Find boolean expression?

Page 15: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Example Solution

Page 16: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Basic Logic gates

• We have defined three basic logic gates and operators

• Also, we could build any digital circuit from those basic logic gates.

• In digital Logic, we are not using normal mathematics we are using Boolean algebra

So, we need to know the laws & rules of Boolean Algebra

Page 17: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Boolean Algebra

• What’s the difference between the Boolean Algebra and arithmetic algebra?

The First obvious difference that in Boolean algebra we have only (+) and (.) operators we don’t have subtraction(-) or division(/) like math.

Page 18: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Binary Logic

• You should distinguish between binary logic and binary arithmetic.

– Arithmetic variables are numbers that consist of many digits.

Arithmetic

• A binary logic variable is always either 1 or 0.

Binary

Page 19: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Laws & Rules of Boolean Algebra

• The basic laws of Boolean algebra:

–The commutative law

–The associative law

–The distributive law

Page 20: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Commutative Law

• The commutative law of addition for two variables is written as: A+B = B+A

• The commutative law of multiplication for two variables is written as: AB = BA

Page 21: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Associative Law

• The associative law of addition for 3 variables is written as: A+(B+C) = (A+B)+C

• The associative law of multiplication for 3 variables is written as: A(BC) = (AB)C

Page 22: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Distributive Law • The distributive law for multiplication as

follows: A(B+C) = AB + AC

• The distributive law for addition is as follows A+(B.C) = (A+B)(A+C)

Page 23: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Basic Theorems of Boolean Algebra

Page 24: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Basic Theorems of Boolean Algebra

OR Laws AND Laws

Inversion Law

Page 25: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Theorem 1(a)

Proof X + X = XSolution

X + X = (X + X ) . 1 X.1=1

=(X + X)(X + X’) X + X’=1

=X + XX’ Dist X + YZ= (X+Y)(X+Z)

=X + 0 X.X’=0

=X

Page 26: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Theorem 1(b)

Prove X.X = XSolution:

X.X = XX + 0 X + 0 =X

=XX + XX’ XX’= 0

=X(X + X’)

=X(1) X + X’ =1

=X

Page 27: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Self Tasks (Theorems)

– X + 1 = 1

– X.0 = 0

– X + XY= X

Page 28: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Duality Principle • A Boolean equation remains valid if we take

the dual of the expressions on both sides of the equals sign

• Dual of expression it means,

– Interchange 1’s with 0’s (and Vice-versa)

– Interchange AND (.) with OR (+) (and Vice-versa)

Page 29: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

DeMorgan’s Law Theorem 1: NAND = Bubbled OR Complement of product is equal to addition of the compliments.

Theorem 2: NOR = Bubbled AND Complement of sum is equal to product of the compliments.

Page 30: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Truth Tables for DeMorgan’s

Page 31: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Example• Get the logic function from the following truth table

and implement it using basic logic gates (AND, OR, NOT)

Page 32: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Simplification of the logic function

• A´B´ + A´B + AB´

Solution:

A´(B´ + B) + AB´

A’(1) + AB´

(A’ + A)(A’ + B’) Hint A+AB Dist

1 (A’ + B’)

(AB)’ DeMorgan Law(1 NAND Gate only)

From 7 gates using simplification rule can be optimized to 1 gate

Page 33: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Home Task: Simplify the following Expressions

• Find the dual of the following expressions

1. A + AB = A

2. A + A’B = A + B

3. A + A’ = 1

4. (A + B)(A + C) = A + BC

Page 34: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Home Task: Simplify the following Expressions

• Prove the following binary expressions ( Using

Postulates)

1. A + AB = A

2. (A + B)(A + C) = A + BC

3. (A + B’ + AB)(A + B’)(A’B) = 0

4. AB + ABC + AB’ = A

5. AB’ + A’B + A’B’

Page 35: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Fewer Gates

XZYX F

Page 36: Boolean Algebra & Logic Gates · 2018. 10. 4. · Basic Logic gates •We have defined three basic logic gates and operators •Also, we could build any digital circuit from those

Algebraic Manipulation

XZZYX YZ X F