Sie sind auf Seite 1von 38

CHAPTER 4

BOOLEAN ALGEBRA AND LOGIC GATES

Computer Systems Organization Flow IPOS (Input, Process, Output, Storage)

Process and Storage (CPU, Registers, Memory)


CPU (Binary Numbers) Binary Numbers (Encoded as Signals in Digital Form known as Data Encoding) Data Encoding (Made and interpret by Transistors that made up the CPU and act like switches) Switches (Act in accordance to Binary Values)

1 / 28

Binary Logic and Gates Binary variables take on one of two values.

Logical operators operate on binary values and binary variables.


Basic logical operators are the logic functions AND, OR and NOT. Logic gates implement logic functions.

Boolean Algebra: a useful mathematical system for specifying and transforming logic gates.
We study Boolean algebra as a foundation for designing and analyzing COMPUTER SYSTEMS!

LEVELS OF MODERN COMPUTING SYSTEMS

3 / 28

Binary Variables Recall that the two binary values have different names:
True/False On/Off Yes/No 1/0

We use 1 and 0 to denote the two values. Variable identifier examples:


A, B, y, z, or X1 for now

RESET, START_IT, or ADD1 later

Logical Operations The three basic logical operations are:


AND OR

NOT

AND is denoted by a dot (). OR is denoted by a plus (+). NOT is denoted by an overbar ( ), a single quote mark (') after, or (~) before the variable.

Basic Definitions Binary Operators


AND
z=xy=xy OR z=1 if x=1 AND y=1

z=x+y
NOT z = x = x

z=1 if x=1 OR y=1

z=1 if x=0

Boolean Algebra
Binary Variables: only 0 and 1 values

Algebraic Manipulation

6 / 28

Boolean Algebra Postulates Commutative Law

xy=yx
Identity Element x1=x Complement x x = 0

x+y=y+x

x+0=x x + x = 1

7 / 28

Boolean Algebra Theorems Duality


The dual of a Boolean algebraic expression is obtained by interchanging the AND and the OR operators and replacing the 1s by 0s and the 0s by 1s.
x(y+z)=(xy)+(xz) x+(yz)=(x+y)(x+z)
Applied to a valid equation produces a valid equation

Theorem 1
xx=x x+x=x

Theorem 2
x0=0 x+1=1
8 / 28

Boolean Algebra Theorems Theorem 3: Involution

( x ) = x
(xy)z=x(yz)

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

Theorem 4: Associative & Distributive


x(y+z)=(xy)+(xz) x+(yz)=(x+y)(x+z)

Theorem 5: DeMorgan
( x y ) = x + y (xy) =x +y x(x+y)=x ( x + y ) = x y (x+y) = xy x+(xy)=x
9 / 28

Theorem 6: Absorption

Operator Precedence Parentheses


( . . . ) ( . . .)

x [ y z ( w x )]
( w x) ( w x) z ( w x) y z ( w x) x [ y z ( w x )]

NOT
x + y

AND
x+xy

OR

10 / 28

DeMorgans Theorem

a [b c (d e )] a [b c (d e )] a b (c (d e )) a b (c (d e )) a b (c (d e))
a b (c d e)
11 / 28

Boolean Functions Boolean Expression


Example: F = x + y z
x 0 0 0 0 y 0 0 1 1 z 0 1 0 1 F 0 1 0 0

Truth Table
All possible combinations of input variables

Logic Circuit
x y z F

1
1 1 1

0
0 1 1

0
1 0 1

1
1 1 1

12 / 28

Logic Function Implementation Using Switches


Inputs:
logic 1 is switch closed logic 0 is switch open

Switches in parallel => OR

Outputs:
logic 1 is light on logic 0 is light off.

Switches in series => AND

NOT input:
logic 1 is switch open logic 0 is switch closed
Boolean Algebra and Logic Gates 13

Normally-closed switch => NOT C

Logic Function Implementation contd


Example: Logic Using Switches
B C A

Light is on (L = 1) for L(A, B, C, D) = A (B C + D) = A B C + A D


and off (L = 0), otherwise.
Boolean Algebra and Logic Gates 14

Useful model for relay and CMOS gate circuits, the foundation of current digital logic circuits

Logic Gates In the earliest computers, switches were opened and closed by magnetic fields produced by energizing coils in relays. The switches in turn opened and closed the current paths. Later, vacuum tubes that open and close current paths electronically replaced relays. Today, transistors are used as electronic switches that open and close current paths.
Boolean Algebra and Logic Gates 15

Logic Gate Symbols and Behavior


Logic gates have special symbols:
X Y AND gate Z = X Y X

Y
OR gate

Z= X+ Y

X NOT gate or inverter

Z= X

And waveform behavior in time as follows:


X 0 0 1 1

(AND)

X Y

(OR)
Boolean Algebra and Logic Gates 16

X+ Y

(NOT)

Algebraic Manipulation Literal:


A single variable within a term that may be complemented or not.

Use Boolean Algebra to simplify Boolean functions to produce simpler circuits


Example: Simplify to a minimum number of literals F = x + x y ( 3 Literals)
Distributive law (+ over )

= x + ( x y )
= ( x + x ) ( x + y ) =(1)(x+y)=x+y

( 2 Literals)
17 / 28

Complement of a Function DeMorgans Theorm

F A B C
F A B C F A B C

Duality & Literal Complement

F A B C F A B C
F A B C
18 / 28

Canonical Forms Minterm


Product (AND function)
Contains all variables Evaluates to 1 for a specific combination Example A=0 A B C 0

A B C
0 0 0

Minterm
m0

ABC ABC ABC ABC ABC ABC ABC ABC


19 / 28

1
2

0 0 1
0 1 0

m1
m2

3
4

0 1 1
1 0 0

m3
m4

B=0
C=0

(0) (0) (0)


1 1 1=1

5
6

1 0 1
1 1 0

m5
m6

1 1 1

m7

Canonical Forms Maxterm


Sum (OR function)
Contains all variables Evaluates to 0 for a specific combination Example A=1 A B C 0

A B C
0 0 0

Maxterm
M0 A B C

1
2

0 0 1
0 1 0

M1 A B C M2 A B C M3 A B C M4 A B C M5 A B C M6 A B C M7 A B C
20 / 28

3
4

0 1 1
1 0 0

5
6

1 0 1
1 1 0

B=1
C=1

(1) + (1) + (1)


0 + 0 + 0=0

1 1 1

Canonical Forms Truth Table to Boolean Function


A B C
0 0 0 0 0 1 0 1 0 0 1 1

F
0 1 0 0

F ABC A BC A BC ABC

1 0 0
1 0 1 1 1 0 1 1 1

1
1 0 1
21 / 28

Canonical Forms Sum of Minterms


F ABC ABC ABC ABC F m1 m4 m5 m7
0
1 2 3

A B C 0 0 0
0 0 1 0 1 0 0 1 1

F 0
1 0 0

F 1
0 1 1

F (1,4,5,7)
Product of Maxterms F ABC ABC ABC ABC
F A BC ABC ABC AB C

4
5 6 7

1 0 0
1 0 1 1 1 0 1 1 1

1
1 0 1

0
0 1 0

F A BC ABC ABC AB C F ( A B C )( A B C )( A B C )( A B C ) F M0 M2 M3 M6

F (0,2,3,6)

22 / 28

Standard Forms Sum of Products (SOP)


F ABC ABC ABC ABC

A B (C C ) A B (1) AB
AC ( B B ) AC

BC ( A A) BC F BC ( A A) A B (C C ) AC ( B B)
F BC AB AC
23 / 28

Standard Forms Product of Sums (POS)


F ABC ABC ABC ABC
BC ( A A) AC ( B B )
F AC ( B B ) AB (C C ) BC ( A A) F AC AB BC F ( A C )( A B )( B C )
24 / 28

AB (C C )

Two - Level Implementations Sum of Products (SOP)


F BC AB AC
B C A B A C F

Product of Sums (POS)


F ( A C )( A B )( B C )

A C A B B C
25 / 28

Logic Operators AND


x 0 0 1 1 y 0 1 0 1 AND 0 0 0 1

x y

xy

NAND (Not AND)

x y

xy

x 0 0 1 1

y NAND 0 1 1 1 0 1 1 0
26 / 28

Logic Operators OR
x 0 0 1 1 y 0 1 0 1 OR 0 1 1 1

x y

x+y

NOR (Not OR)

x y

x+y

x 0 0 1 1

y 0 1 0 1

NOR 1 0 0 0
27 / 28

Logic Operators XOR (Exclusive-OR)


x y x y xy+xy
x 0 0 1 1 x 0 0 1 1 y 0 1 0 1 XOR 0 1 1 0

XNOR (Exclusive-NOR) (Equivalence)


x y x y x y xy+xy

y XNOR 0 1 1 0 0 0 1 1

28 / 28

Logic Operators NOT (Inverter)


x x
1 0 x 0 NOT 1

Buffer
x x

x
0 1

Buffer
0 1

29 / 28

Multiple Input Gates

30 / 28

DeMorgans Theorem on Gates AND Gate


F=xy F = ( x y) F=x+y

OR Gate
F=x+y F = ( x + y) F=xy

Change the Shape and bubble all lines

31 / 28

Homework Mano
Chapter 2
2-4 2-5 2-6 2-8 2-9 2-10 2-12 2-15 2-18 2-19
32 / 28

Homework Mano
2-4 Reduce the following Boolean expressions to the indicated number of literals:

(a) AC + ABC + AC
(b) (xy + z) + z + xy + wz (c) AB (D + CD) + B (A + ACD) (d) (A + C) (A + C) (A + B + CD)

to three literals
to three literals to one literal to four literals

2-5

Find the complement of F = x + yz; then show that FF = 0 and F + F = 1

33 / 28

Homework
2-6 Find the complement of the following expressions: (a) xy + xy (b) (AB + C)D + E

(c) (x + y + z) (x + z) (x + y)
2-8 2-9 List the truth table of the function: F = xy + xy + yz Logical operations can be performed on strings of bits by considering each pair of corresponding bits separately (this is called bitwise operation). Given two 8-bit strings A = 10101101 and B = 10001110, evaluate the 8-bit result after the following logical operations: (a) AND, (b) OR, (c) XOR, (d) NOT A, (e) NOT B.
34 / 28

Homework
2-10 Draw the logic diagrams for the following Boolean expressions: (a) Y = AB + B (A + C) (c) Y = A + CD (b) Y = BC + AC (d) Y = (A + B) (C + D)

2-12 Simplify the Boolean function T1 and T2 to a minimum number of literals. A B C T T


1 2

0 0 0 0 1 1 1 1

0 0 1 1 0 0 1 1

0 1 0 1 0 1 0 1

1 1 1 0 0 0 0 0

0 0 0 1 1 1 1 1
35 / 28

Homework
2-15 Given the Boolean function F = xyz + xyz + wxy + wxy + wxy (a) Obtain the truth table of the function. (b) Draw the logic diagram using the original Boolean expression. (c) Simplify the function to a minimum number of literals using Boolean algebra. (d) Obtain the truth table of the function from the simplified expression and show that it is the same as the one in part (a) (e) Draw the logic diagram from the simplified expression and compare the total number of gates with the diagram of part (b).
36 / 28

Homework
2-18 Convert the following to the other canonical form: (a) F (x, y, z) = (1, 3, 7)

(b) F (A, B, C, D) = (0, 1, 2, 3, 4, 6, 12)


2-19 Convert the following expressions into sum of products and product of sums: (a) (AB + C) (B + CD) (b) x + x (x + y) (y + z)

37 / 28