+ All Categories
Home > Documents > Boolean Algebra

Boolean Algebra

Date post: 02-Nov-2014
Category:
Upload: sudiponair1
View: 16 times
Download: 1 times
Share this document with a friend
Popular Tags:
33
Chapter 11: Boolean Algebra http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM] Chapter 11 Boolean Algebra Modified: 11/25/2012 23:41:09 © Ray Wisman Resources http://highered.mcgraw-hill.com/sites/0072880082/student_view0/index.html - Index to the Rosen text Web site learning resources. http://highered.mcgraw-hill.com/sites/0072880082/student_view0/chapter11/extra_examples.html - Extra examples with solutions. 11.1 Boolean Functions Definition Boolean algebra defines operations for the set {0, 1} Commonly used Boolean operations. Not 1 0 0 1 0 = 1 1 = 0 . And 00 0 01 0 10 0 11 1 1 . 1 = 1 + Or 00 0 01 1 10 1 11 1 1 + 1 = 1 Xor 00 0 01 1 10 1 11 0 Nor 00 1 01 0 10 0 11 0 Nand 00 1 01 1 10 1 11 0 Examples (1 . 0) + 0 = 0 (1 . 0) + 1 = 1 1 Xor (0 Xor 0) = 1 1 Nand 0 = 1 1 Nor 0 = 0 (0 Nor 1) Nor 0 = 1
Transcript
Page 1: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

Chapter 11Boolean Algebra

Modified: 11/25/2012 23:41:09

© Ray Wisman

Resources

http://highered.mcgraw-hill.com/sites/0072880082/student_view0/index.html - Index to the Rosen text Web site learningresources.

http://highered.mcgraw-hill.com/sites/0072880082/student_view0/chapter11/extra_examples.html - Extra examples withsolutions.

11.1 Boolean Functions

Definition

Boolean algebra defines operations for the set {0, 1}

Commonly used Boolean operations.

Not

1 0

0 1

0 = 1

1 = 0

. And

0 0 0

0 1 0

1 0 0

1 1 1

1 . 1 = 1

+ Or

0 0 0

0 1 1

1 0 1

1 1 1

1 + 1 = 1

Xor

0 0 0

0 1 1

1 0 1

1 1 0

Nor

0 0 1

0 1 0

1 0 0

1 1 0

Nand

0 0 1

0 1 1

1 0 1

1 1 0

Examples

(1 . 0) + 0 = 0 (1 . 0) + 1 = 1 1 Xor (0 Xor 0) = 1

1 Nand 0 = 1 1 Nor 0 = 0 (0 Nor 1) Nor 0 = 1

Page 2: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

Question 11.1

(1 . 1) + 1 = ? (1 . 0) + 0 = ? 1 Xor (0 Xor 1) = ?

1 Nand 1 = ? 0 Nor 0 = ? (0 Nor 1) Nor 1 = ?

Boolean Expressions and Boolean Functions

Definitions

Boolean variable only assumes values from the set {0, 1}

Bn = {(x1, x2, ..., xn) | xi ?{0, 1} for 1 = i = n} is the set of all n-tuples of 0s and 1s

Function from Bn to {0, 1} is a Boolean function of degree n.

Example

B2 = {(0, 0), (0, 1), (1, 0), (1, 1)}

B2 to {0, 1}

Function from B2 to {0, 1}

F(x, y) = x y

Table 1 lists where F(x, y) is 1 and 0.

Page 3: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

Example

Function from B3 to {0,1}

F(x, y, z) = 1 when:

F(x, y, z) = x y + z

or

F(x, y, z) = x y z + x y z + x y z + x y z + x y z

Page 4: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

Question 11.2.1 - F(x, y, z) in Table 2

F(1, 1, 1) = ?

F(0, 1, 1) = ?

Example

2 binary variables have 22 = 4 possible assignments

x y Assignment

0 0 0 or 1

0 1 0 or 1

1 0 0 or 1

Page 5: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

1 1 0 or 1

Each outcome can be assigned a 0 or 1

Example

4 binary variables have 24 = 16 possible assignments

a b c d Assignment

0 0 0 0 0 or 1

0 0 0 1 0 or 1

0 0 1 0 0 or 1

0 0 1 1 0 or 1

0 1 0 0 0 or 1

0 1 0 1 0 or 1

0 1 1 0 0 or 1

0 1 1 1 0 or 1

1 0 0 0 0 or 1

1 0 0 1 0 or 1

1 0 1 0 0 or 1

1 0 1 1 0 or 1

1 1 0 0 0 or 1

1 1 0 1 0 or 1

1 1 1 0 0 or 1

1 1 1 1 0 or 1

Example

Below is every possible of 16 functions of 2 Boolean values.

Page 6: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

F1 is tautology

F2 is Or

F8 is And

Question 11.2.2

F9 is ?

Identities of Boolean Algebra

Notice that many Boolean identities have logical analogues.

Example

x + y = y + x Boolean + commutes

p v q = q v p and so does (logical) v

Page 7: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

Example

Verification of Boolean identities are similar to truth table proofs.

x(y + z) = xy + xz

Page 8: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

Question 11.3 - Verify De Morgan's Law:

xy = x + y

Duality

Definition

Dual of a Boolean expression interchanges:

sums and products

0s and 1s

Example

Dual of:

x(y+0) is x+(y.1)

Page 9: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

(x.1) + (y+z) is (x+0)(yz)

Example

Construct an identity from the absorption law x(x+y) = x by taking duals.

Duals of both sides

x(x+y) = x

is

x+(xy) = x

Example

Construct an identity from the commutative law x + y = y + x by taking duals.

Duals of both sides

x + y = y + x

is

xy = yx

Question 11.4 - What is the dual of:

xy = x + y

Definition

Dual of a Boolean expression interchanges:

sums and products

0s and 1s

11.2 Representing Boolean Functions

Sum of Products Expansion

Page 10: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

Definition

Sum of products for Boolean function is a Boolean expression constructed by:

Where each function result is a 1

form product of all variables

sum each product

Example

Find Boolean expressions that represent F and G of Table 1.

F(x,y,z) = xyz The sum of one product.

G(x,y,z) = xyz + xyz The sum of two products.

Page 11: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

Definition 1

Literal

is a Boolean variable or its complement.

Minterm

of the Boolean variables x1, x2, ..., xn is a Boolean product y1, y2, ..., yn where yi=xi or yi=xi

Example

F and G of Table 1 are expressed as sum of minterms.

Page 12: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

F(x, y, z) = xyz The sum of one minterm.

G(x, y, z) = xyz + xyz The sum of two minterms.

Example

Minterm that is 1 for x1 = 0, x2 = 0, x3 = 1, x4 = 1

x1x2x3x4 = 1

Example

x y z F G H

0 0 0 0 1 x y z 0

0 0 1 0 0 0

0 1 0 0 0 0

0 1 1 1 xyz 0 1

1 0 0 0 0 0

1 0 1 0 0 0

1 1 0 1 xyz 0 1

1 1 1 0 1 xyz 1

Sum of Products

F(x, y, z) = xyz + xyz

G(x, y, z) = x y z + xyz

Question 11.5 - What is H(x,y,z) as sum of minterms (products)?

Question 11.6 - Give the function definition table for:

I(x, y, z) = x y z + x y z + x y z

Definition

Sum-of-products expansion

is the sum of minterms.

Page 13: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

Disjunctive normal form

is the same as sum-of-products.

Example

Find the sum-of-products for: F(x, y, z) = (x+y)z

F(x, y, z) = (x+y)z

= xz+yz Distributive Law

= xz(y+y) +yz(x+x) Identity and Unit property Law

= xyz+x y z + xyz+xyz Distributive Law

= xy z + xyz + xyz Idempotent Law

Example

Find the sum-of-products for: F(x, y, z) = (x+y)z

1 in table wherever (x+y)z = 1

Page 14: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

x y z x+y z (x+y)z minterms

0 0 0 0 1 0

0 0 1 0 0 0

0 1 0 1 1 1 x y z

0 1 1 1 0 0

1 0 0 1 1 1 x y z

1 0 1 1 0 0

1 1 0 1 1 1 x y z

1 1 1 1 0 0

F(x, y, z) = (x+y)z = xy z + xyz + xyz

Question 11.7.1 - Find the sum-of-products for: F(x, y, z) = x z + y

x y z z xz xz+y minterms

0 0 0 1

0 0 1 0

0 1 0 1

0 1 1 0

1 0 0 1

1 0 1 0

1 1 0 1

1 1 1 0

Page 15: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

Functional Completeness

Definition

Functionally complete (universal)

operators are the set of sum, product and complement, can represent every Boolean function.

Nand and Nor

operations are also functionally complete alone.

Means circuits of And, Or and Not gates can be replaced with Nor or Nand gates exclusively.

Example

? Nor

0 0 1

0 1 0

1 0 0

1 1 0

| Nand

0 0 1

0 1 1

1 0 1

1 1 0

x+y = x ? y Not OR = Nor

xy = x | y Not AND = Nand

x = x | x

x = x ? x

Example

x + y = x + y = x y = x | y = (x | x)| (y | y)

x y x+y (x | x) (y | y) (x | x)| (y | y)

0 0 0 1 1 0

0 1 1 1 0 1

1 0 1 0 1 1

1 1 1 0 0 1

Page 16: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

x y = x y = x + y = x ? y )= (x ? x)?(y ? y)

x y x y (x ? x) (y ? y) (x ? x) ? (y ? y)

0 0 0 1 1 0

0 1 0 1 0 0

1 0 0 0 1 0

1 1 1 0 0 1

Result is often more operations but can build logic on a chip from a single operation device type, usually moreefficient use of chip area.

Question 11.7.2 Complete the following table proving that:

x y = x y = x | y = (x | y)| (x | y)

| Nand

0 0 1

0 1 1

1 0 1

1 1 0

x y x y x | y x | y (x | y) | (x | y)

0 0

0 1

1 0

1 1

11.3 Logic Gates

Logic gates implement Boolean operations.

All computer logic can be performed using these three logic gates.

x y . And

0 0 0

0 1 0

x y + Or

0 0 0

0 1 1

x Not

1 0

0 1

Page 17: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

1 0 0

1 1 1

1 . 1 = 1

1 0 1

1 1 1

1 + 1 = 1

0 = 1

1 = 0

The following gates implement the Boolean operations above.

Multiple input logic gates.

Combinations of Gates

The three logic gates can be combined to implement complex logic operations.

Examples

(a) Function table

x y x x+y (x+y)x

0 0 1 0 0

0 1 1 1 1

1 0 0 1 0Sum-of-products

Page 18: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

1 1 0 1 0 x y

(b) Function table

x y z x z y+z ___y+z

____x(y+z)

0 0 0 1 1 1 0 0

0 0 1 1 0 0 1 1

0 1 0 1 1 1 0 0

0 1 1 1 0 1 0 0

1 0 0 0 1 1 0 0

1 0 1 0 0 0 1 0

1 1 0 0 1 1 0 0

1 1 1 0 0 1 0 0

Sum-of-products

x y z

(c) Function table

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

0 0 0 1 1 1 0 1 0

0 0 1 1 1 0 1 0 0

0 1 0 1 0 1 1 0 0

0 1 1 1 0 0 1 0 0

1 0 0 0 1 1 1 0 0

1 0 1 0 1 0 1 0 0

1 1 0 0 0 1 1 0 0

1 1 1 0 0 0 1 0 0

Sum-of-products does not exist.

Page 19: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

Output is always 0.

Question 11.8

a. Add the logic produced at the output of each gate.

b. Give the corresponding function table.

c. Give the corresponding sum-of-products.

Question 11.9

a. Add the logic produced at the output of each gate.

Page 20: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

b. Give the corresponding function table.

c. Give the corresponding sum-of-products.

Question 11.10

a. Using the devices below, give (draw) the circuit for:

(x+y)(x y)

b. Using the devices below, give (draw) the circuit for:

(xyz)+(x y)

Example of Circuits

Critical processes (e.g. Space Shuttle control) may use majority voting to settle conflicting evidence, two out of threevoting in favor win.

A circuit that requires at least two to agree (e.g. xy, x and y both 1) the evidence is true:

x y z xy xz yz xy+xz+yz

Page 21: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

0 0 0 0 0 0 0

0 0 1 0 0 0 0

0 1 0 0 0 0 0

0 1 1 0 0 1 1

1 0 0 0 0 0 0

1 0 1 0 1 0 1

1 1 0 1 0 0 1

1 1 1 1 1 1 1

Example

A room with 3 doors normally has three light switches, flipping any will change lights from ON to OFF, or OFF to ON.

Switches all 0, light is OFF, 0: x y z

Flipping switch z, light is ON, 1: x y z

x y z Light Minterms

0 0 0 0

0 0 1 1 x y z

0 1 0 1 x y z

0 1 1 0

1 0 0 1 x y z

1 0 1 0

1 1 0 0

1 1 1 1 x y z

Sum-of-Products

x y z + x y z + x y z + x y z

Page 22: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

Adders

Binary numbers are represented in a positional system similar to decimal numbers.

56310 = 5*102 + 6*101 + 3*100 = 56310

102 101 100

5 6 3

11012 = 1*23 + 1*22 + 0*21 + 1*20 = 8 + 4 + 1 = 1310

Page 23: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

23 22 21 20

1 1 0 1

Question 11.11.1 - Convert to base 10.

43710 = ?

1112 = ?

10112 = ?

Adding decimal numbers carries out 1010, 10010, 100010, etc. from one column to the next.

Adding binary numbers carries out 102, 1002, 10002, etc. (2, 4, 8, etc.) from one column to the next.

11 carry 6710+ 5810 ___ 12510 sum

11 carry 012+ 112 ___ 1002 sum

111 carry 1012+1112 ___11002 sum

Question 11.11.2

a. b. c.

85610+46710 ____

1012+0012 ____

11112+11012 ____

Example Parallel 2-bit adder

Adding 2-bits:

01 +1 1

y1 y0

+x1 x0

Page 24: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

____1 00

______c s1 s0

produces a carry, c, and 2-bit sum, s1s0.

x1 x0 y1 y0 c s1 s0

0 0 0 0 0 0 0

0 0 0 1 0 0 1

0 0 1 0 0 1 0

0 0 1 1 0 1 1

0 1 0 0 0 0 1

0 1 0 1 0 1 0

0 1 1 0 0 1 1

0 1 1 1 1 0 0

1 0 0 0 0 1 0

1 0 0 1 0 1 1

1 0 1 0 1 0 0

1 0 1 1 1 0 1

1 1 0 0 0 1 1

1 1 0 1 1 0 0

1 1 1 0 1 0 1

1 1 1 1 1 1 0

Question 11.11.3

a. What are: c s1 s0

1 1 +1 0 ____

y1 y0 +x1 x0

______c s1 s0

b. Give the carry minterms, c

c. There are 16 (24) rows for a 2-bit adder. How many rows for a parallel 64-bit adder inyour PC?

Example Half-adder (http://simcironline.appspot.com)

Adding two bits produces a sum bit and a carry out bit.

All possible values of sum and carry out for 1-bit values:

x+ y

0 x+ 0 y

0+ 1

1+ 0

1+ 1

Page 25: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

___C Sa ur mry

___0 0

___0 1

___0 1

___1 0

s = x y + x y = (x+y)(xy)

c = xy

Half-adder

Question 11.12 - What are c and s? Consult Table 3 above.

Page 26: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

x+ y ___C Sa ur mry

0 x+ 0 y ___

0 x+ 1 y___

1 x+ 0 y___

1 x+ 1 y___

Example

Full-adder

Adding two bits and a carry-in produces a sum and carry-out bit.

All possible values for sum and carry out:

ci x + y ___ci+1 s

0 0+ 0 __0 0

0 0+ 1___0 1

0 1+ 0___0 1

0 1+ 1___1 0

1 0+ 0___0 1

1 0+ 1___1 0

1 1+ 0___1 0

1 1+ 1___1 1

Question 11.13

a. What is the sum-of-products expression from Table 4 for ci+1?

b. What are ci+1 and s values from Table 4?

ci x + y ___ ci+1 s

0 0+ 0 __

0 0+ 1___

0 1+ 0___

0 1+ 1___

1 0+ 0___

1 0+ 1___

1 1+ 0___

1 1+ 1___

Page 27: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

Question 11.15

Determine from Table 3 the above full-adder results when:

x=1 y=1 ci = 1

Bottom half-adder output = ?

Top half-adder output = ?

s = ?

ci+1 = ?

Page 28: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

Example

Multiple bit adder

Adding two bits and a carry-in (ci) produces a sum and carry-out (ci+1) bit.

The carry-out of a lower column (right) is the carry-in of the next column (left).

All possible values for sum and carry out:

ci x + y ___

0 0+ 0 __

0 0+ 1___

0 1+ 0___

0 1+ 1___

1 0+ 0___

1 0+ 1___

1 1+ 0___

1 1+ 1___

Page 29: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

ci+1 s 0 0 0 1 0 1 1 0 0 1 1 0 1 0 1 1

Question 11.16 - For the 1-bit full-adder below, from Table 4, what is:

s = ?

ci+1 = ?

1

0

1

Adding multiple bits using multiple 1-bit full-adders:

The first carry-in is 0.

Binary

1110 ci 101 x + 111 y ____ 1 100ci+1 s

Decimal

110 ci 567 + 685 ___ 1 252ci+1 s

Question 11.17 - What are: ci+1 s

ci 111 x + 101 y ____ ci+1 s

Page 30: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

Full-adders used by connecting the low-order adder carry-in to 0.

1110 ci 111 x + 101 y ____ 1 100ci+1 s

Half-adder used in lowest order bit because no carry-in.

Page 31: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

111 ci 111 x + 101 y ____ 1 100ci+1 s

Page 32: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

2's complement

Negative values can be represented by defining the left-most bit to be a sign:

0 is positive

1 is negative

2's complement represents a negative number by forming one's complement and adding 1.

-00101 5-bit binary of -5

11010 1's complement of +5

+ 1

11011 2's complement -5

Question 11.18

a. 5-bit 1's complement of 011012?

b. 5-bit 2's complement of 011012?

2's complement can be converted to a negative binary number by forming one's complement and adding 1.

11011 2's complement -5

00100 1's complement of -5

+ 1

-00101 5-bit binary of -5

2's complement allows an adder to perform subtraction and addition.

1101 -3

+0101 +5

10010 2

The carry out (underlined) is ignored.

Page 33: Boolean Algebra

Chapter 11: Boolean Algebra

http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

Question 11.19

1011 -5

+0010 +2


Recommended