boolean algebra & logic circuits dr. ahmed el-bialy dr. sahar fawzy

37
Boolean Algebra Boolean Algebra & & Logic Circuits Logic Circuits Dr. Ahmed El-Bialy Dr. Ahmed El-Bialy Dr. Sahar Fawzy Dr. Sahar Fawzy

Upload: beverly-golden

Post on 18-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Boolean Algebra Boolean Algebra & &

Logic CircuitsLogic Circuits

Dr. Ahmed El-BialyDr. Ahmed El-Bialy

Dr. Sahar FawzyDr. Sahar Fawzy

Page 2: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Binary LogicBinary Logic Binary logic deals with Binary logic deals with binarybinary variables that variables that

take on two discrete values and with the take on two discrete values and with the operationsoperations of mathematical logic applied to of mathematical logic applied to these variables.these variables.

RegularAlgebra

BooleanAlgebra

Values NumbersI ntegersReal NumbersComplex Numbers

Zero (0)One (1)

Operators Add, SubtractMultiply, DivideLogarithm, etc.

ANDORComplement

Page 3: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Logic Logic GatesGates

Page 4: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Truth TableTruth Table

A truth table is a table of combinations of the binary variables showing the relationship between the values that the variables take on and the values of the result of the operation

If there are n inputs, there will be 2n rows in the table A B C = A • B

0 0 00 1 01 0 01 1 1

Page 5: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Represented by a dot (.) or by the absence of an operator

AND Operation

The definition of logical (.) is:

0 • 0 = 0 0 • 1 = 0

1 • 0 = 0 1 • 1 = 1

A B C = A • B

0 0 00 1 01 0 01 1 1

A

BC

It looks like multiplication, but it is not. Therefore symbol is used for AND instead of a dot.

Page 6: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

OR OperationOR Operation

Represented by a plus (+)

The definition of logical (+) is:

0 + 0 = 0 0 + 1 = 1

1 + 0 = 1 1 + 1 = 1

It looks like addition, but it is not. Therefore symbol is used for OR instead of a plus.

A B C = A + B

0 0 00 1 11 0 11 1 1

A

B

C

Page 7: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Not (Complement) Operation

Represented by a bar over the variable or a prime (’)

The definition of logical (’) is:

0’ = 1

1’ = 0

If X = 1 then X’ = 0

If X = 0 then X’ = 1

X X’

Page 8: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

NAND: the complement of the AND operation

A B C =( A • B)’

0 0 10 1 11 0 11 1 0

A

B

C

NOR: the complement of the OR operation

A B C = (A + B)'

0 0 10 1 01 0 01 1 0

A

B

C

Page 9: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

XOR: exclusive OR is represented by

Its definition logic is:

0 0 = 0 0 1 = 1

1 0 = 1 1 1 = 0

A

BC = A B =AB’+A’B

A B A B

0 0 00 1 11 0 11 1 0

XNOR: exclusive-NOR is the complement of the exclusive-OR and expressed as:

(A B)’=AB+A’B’

Page 10: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Exclusive-OR Theorem:

X 0 = X X 1 = X'

X X = 0 X X' = 1

X Y = Y X

( X Y) Z = X

( Y Z ) = X

Y Z

( X Y)' = X Y' = X' Y

Odd function: multiple-variable exclusive-OR operation : is one whenever the corresponding binary truth-table values have an odd number of 1’s.

Page 11: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Boolean Expression

Boolean expressions are made up of variables combined by Logical operations .

Examples: [ A B ( C + B’ ) + D] B • E C’

Literals each instance of a variable

This expression has 4 variables and 10 literals:

a’bd + bcd + ac’ + a’d’

Page 12: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Evaluation of Boolean Expression

Boolean expressions can be represented in a truth table which lists all possible combinations of the values of all variables in the expression.

F = A’ + B C

A B C A' B C F = A' + B C

0 0 0 1 0 10 0 1 1 0 10 1 0 1 0 10 1 1 1 1 11 0 0 0 0 01 0 1 0 0 01 1 0 0 0 01 1 1 0 1 1

Page 13: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Boolean Expression

Boolean expressions can be transformed from an algebraic expression into a circuit diagram composed of logic gates.

F = A’ + B C

Page 14: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Boolean Expression

F = X + Y ( X’ +Y’)

XYX'Y'X'+Y'Y(X'+Y')X+Y(X'+Y')

001110 0

011011 1

100110 1

110000 1

X

Y

X’+Y’

Y(X’+Y’)

X+Y(X'+Y')

X+Y

 0

 1

 1

 1

But

We used 5 gates Only one gate

Page 15: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Basic Boolean Algebra TheoremsBasic Boolean Algebra Theorems1. X+0=X2. X+1=13. X+X=X4. X+X’=1

5. X • 1=X6. X • 0=07. X • X=X8. X • X’=0

Associative Law:12. (X + Y) + Z = X + (Y + Z) = X + Y + Z13. ( X • Y ) • Z = X • ( Y • Z) = X • Y • ZDistributive Law:14. X ( Y + Z ) = X Y + X Z

15. X+ X • Y= X16. X ( X + Y) = X17. (X + Y)(X+Z) = X+ Z•Y18. X + X’ • Y = X+Y19. XY + YZ + Y’Z =XY+Z

9. (X’)’=X Commutative Law:10. X • Y = Y • X11. X + Y = Y + X

Page 16: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Basic Boolean Algebra TheoremsBasic Boolean Algebra Theorems

DeMorganDeMorgan’’s Law:s Law:

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

Proof:Proof: X Y X' Y' X + Y (X + Y)' X'Y' X Y (XY)' X' + Y'

0 0 1 1 0 1 1 0 1 10 1 1 0 1 0 0 0 1 11 0 0 1 1 0 0 0 1 11 1 0 0 1 0 0 1 0 0

DeMorgan’s Law- one step rule: [ f ( X1, X2, … XN, 0, 1, +, •) ]’ = f ( X1 ’, X2 ’, … XN ’, 1, 0, •, +)

Replace all variables with the inverse

Replace + with • and • with +

Replace 0 with 1 and 1 with 0

Be careful of hierarchy ( )

Page 17: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Methods of Boolean Expression Simplification

• Combine terms

• Eliminate terms

• Eliminate literals

• Add redundant terms if needed

A’B + A’B’C’D’ + ABCD’

A’( B + B’C’D’) + ABCD’

A’( B + C’D’) + ABCD’

A’B + A’C’D’ + ABCD’

A’C’D’ + B( A’ +ACD’)

A’C’D’ + B( A’ +CD’)

A’B + BCD’ + A’C’D’

Page 18: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Standard FormsStandard Forms

Product term : (e.g., XYZ) (Minterms) Sum term : (e.g., X+Y+Z) (Maxterms)

They do not imply arithmetic operations in Boolean algebra; instead, they specify the logical operation AND and OR, respectively

Page 19: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

X Y ZX Y ZMinMinMintermsMintermsMaxMaxMaxtermsMaxterms

0 0 00 0 0m0m0XX’’YY’’ZZ’’M0M0X+Y+ZX+Y+Z

0 0 10 0 1m1m1XX’’YY’’ZZM1M1X+Y+ZX+Y+Z’’

0 1 00 1 0m2m2XX’’YZYZ’’M2M2X+YX+Y’’+Z+Z

0 1 10 1 1m3m3XX’’YZYZM3M3X+YX+Y’’+Z+Z’’

1 0 01 0 0m4m4XYXY’’ZZ’’M4M4XX’’+Y+Z+Y+Z

1 0 11 0 1m5m5XYXY’’ZZM5M5XX’’+Y+Z+Y+Z’’

1 1 01 1 0m6m6XYZXYZ’’M6M6XX’’+Y+Y’’+Z+Z

1 1 11 1 1m7m7XYZXYZM7M7XX’’+Y+Y’’+Z+Z’’

Page 20: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

A Boolean function F is equal to 1 for each of the following binary combinations of the variables X, Y, and Z: 000, 001,100, 110.

Derive its algebraic expression

Example 1: (Sum of Product SoP)

Page 21: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Truth table and logic sum of minterms

X Y ZX Y ZMinMinMintermsMintermsFF

0 0 00 0 0m0m0XX’’YY’’ZZ’’11

0 0 10 0 1m1m1XX’’YY’’ZZ11

0 1 00 1 0m2m2XX’’YZYZ’’00

0 1 10 1 1m3m3XX’’YZYZ00

1 0 01 0 0m4m4XYXY’’ZZ’’11

1 0 11 0 1m5m5XYXY’’ZZ00

1 1 01 1 0m6m6XYZXYZ’’11

1 1 11 1 1m7m7XYZXYZ00

Sum-of-Product Boolean expressions for F:

F = m0+m1+m4+m6

=X’Y’Z’+X’Y’Z+XY’Z’+XYZ’

Page 22: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Example 2: (Sum of Product SoP)

Design a gate network with the following rules:

1. It has three inputs and one output

2. The output is one when

a) All inputs are zero’s

b) The 3rd is zero & 1st , 2nd are ones

c) The 3rd is one & 1st , 2nd are zeros

d) All inputs are one’s

Page 23: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

X Y ZX Y ZMinMinMintermsMintermsFF

0 0 00 0 0m0m0XX’’YY’’ZZ’’11

0 0 10 0 1m1m1XX’’YY’’ZZ00

0 1 00 1 0m2m2XX’’YZYZ’’00

0 1 10 1 1m3m3XX’’YZYZ11

1 0 01 0 0m4m4XYXY’’ZZ’’11

1 0 11 0 1m5m5XYXY’’ZZ00

1 1 01 1 0m6m6XYZXYZ’’00

1 1 11 1 1m7m7XYZXYZ11

Sum-of-Product Boolean expressions for F:S = m0+m3+m4+m7

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

Page 24: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Example 3:

Design a gate network with the following rules:

1. It has Two inputs and Two outputs

2. The outputs S & C are:

a) If the two inputs are zero’s the two outputs are zeros

b) If one of the inputs is one the S output is one and the C is zero

c) If the two inputs are one’s the S output is zero the C is one

Page 25: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Sum-of-Product Boolean expressionsSum-of-Product Boolean expressions S =X’Y+XY’ S =X’Y+XY’ XOR XOR C =XYC =XY AND AND

Half AdderHalf Adder

Page 26: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Half AdderHalf Adder

00001111

00110011

SS00111100

CC00000011

+++ +

Page 27: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Design a gate network with the following specs:

It has three inputs (A, B, Ci) and two outputs (S, C)

1. The outputs S & C are:a) If the only one input is 1 S=1 C=0

b) If two of the inputs are 1 S=0 C=1

c) If all of the three inputs are 1 S=1 C=1

Example 4

Page 28: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

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

C= A’BC+AB’C+ABC+ABC’C= A’BC+AB’C+ABC+ABC’

Page 29: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Map Simplification Karnaugh map: a diagram made up of squares, with

each square representing one minterm of the function.

be done systematically

Simpler to find the minimum solution

Two variables K-map:

A

B 0 1

0

1A=O, B=0

A=O, B=1

A=1, B=0

A=1, B=1

Page 30: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Map Simplification

A B F

0 0 10 1 11 0 01 1 0

F = A’B’ + A’B

F = A’

A

B 0 1

0

1

1

1

0

0

1

1

A = 0B = 0 or 1

0

0

1

1

Example of a two-variable K-map:

Page 31: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Map Simplification

Three variables K-map:

The order of BC variables are 00, 01, 11 and 10. They are Gray code (i.e. only one bit is changed each time).

AB C

0

1

00 11 1001

m0 m1 m3 m2

m4 m5 m7 m6

Each minterm corresponds to a location on K-map: m0

…m7

Page 32: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Example of a three-variable K-map:

Map Simplification

F (A,B,C) = m ( 2, 3, 5, 7 )

11 1

1

1 1

11

11

AB C

0

1

00 11 1001

0 0

0 01

11

1

A B C F

0 0 0 00 0 1 00 1 0 10 1 1 11 0 0 01 0 1 11 1 0 01 1 1 1

Page 33: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

AB C

0

1

00 11 1001

0 0

0 01

11

1

Map Simplification

A = 0, B = 1, C= don’t care(0 or 1)

F = A’B

C = 1, B = 1, A= don’t care

A = 1, C = 1, B= don’t care

F = A’B+CB +AC

Page 34: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Map Simplification

ABCD

00 11 1001

m0 m1 m3 m2

m4 m5 m7 m6

00

11

10

01

m12 m13 m15 m14

m8 m9 m11 m10

Four variables K-map :

- Note that the orders of AB and CD follow Gray code.

Each minterm corresponds to a location on K-map: m0

…m15

Page 35: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Example of a four-variable K-map:

Map Simplification

Simplify function F = m ( 1, 2, 3, 5, 7, 10, 14, 15 )

ABCD

00 11 1001

00

11

10

01

0

0 0

0 0

0 0 0

1 1 1

1 1

1 1

1

F =A’DF =A’D+A’B’CF =A’D+A’B’C+ABCF =A’D+A’B’C+ABC+ACD’

or

B’CD’

Page 36: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

K-Map with “Don’t Care” Values :

- “Don’t care conditions” means unspecified

minterms of a function, which is marked with

“X”

Map Simplification

F (A,B,C,D) = m ( 1, 5, 6, 10, 11, 14 ) + d ( 0, 7, 9, 15 )= AC + BC + A’C’D

ABCD

00 1101

00

11

10

01

X

0 1

0 0

0 X 1

1 0 0

1 X

X 1

1

10

Page 37: Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy

Thank youThank you

see you in see you in

Combinational CircuitsCombinational Circuits