Sie sind auf Seite 1von 33

Chapter 11: Boolean Algebra

Chapter 11 Boolean Algebra


Ray Wisman Resources

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

Search C251/I201

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 0 0 1 1 0 1 1

And 0 0 0 1 0 0 0 1 1 0 1 1

+ Or 0 1 1 1 0 0 0 1 1 0 1 1

Xor 0 1 1 0 0 0 0 1 1 0 1 1

Nor 1 0 0 0 0 0 0 1 1 0 1 1

Nand 1 1 1 0

0 = 1 1 = 0

1 .1 = 1 Examples (1 . 0) + 0 = 0 1 Nand 0 = 1

1 + 1 = 1

(1 . 0) + 1 = 1 1 Nor 0 = 0

1 Xor (0 Xor 0) = 1

(0 Nor 1) Nor 0 = 1

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

Chapter 11: Boolean Algebra

Question 11.1 (1 . 1) + 1 = ? 1 Nand 1 = ? (1 . 0) + 0 = ? 0 Nor 0 = ? 1 Xor (0 Xor 1) = ?

(0 Nor 1) Nor 1 = ?

Boolean Expressions and Boolean Functions Definitions Boolean variable only assumes values from the set {0, 1} Bn = {(x1 , x 2 , ..., x n ) | x i ?{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.

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

Chapter 11: Boolean Algebra

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

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

Chapter 11: Boolean Algebra

Question 11.2.1 - F(x, y, z) in Table 2 F(1, 1, 1) = ? F(0, 1, 1) = ?

Example 2 binary variables have 2 2 = 4 possible assignments x y Assignment 0 0 0 1 1 0 0 or 1 0 or 1 0 or 1

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

Chapter 11: Boolean Algebra

1 1

0 or 1

Each outcome can be assigned a 0 or 1 Example 4 binary variables have 2 4 = 16 possible assignments a b c d Assignment 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 Example Below is every possible of 16 functions of 2 Boolean values. 0 or 1 0 or 1 0 or 1 0 or 1 0 or 1 0 or 1 0 or 1 0 or 1 0 or 1 0 or 1 0 or 1 0 or 1 0 or 1 0 or 1 0 or 1 0 or 1

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

Chapter 11: Boolean Algebra

F 1 is tautology F 2 is Or F 8 is And Question 11.2.2 F 9 is ?

Identities of Boolean Algebra Notice that many Boolean identities have logical analogues. Example x + y = y + x pv q= qv p Boolean + commutes and so does (logical) v

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

Chapter 11: Boolean Algebra

Example Verification of Boolean identities are similar to truth table proofs. x(y + z) = xy + xz

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

Chapter 11: Boolean Algebra

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)


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

Chapter 11: Boolean Algebra

(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

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

Chapter 11: Boolean Algebra

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 G(x,y,z) = xyz + xyz The sum of one product. The sum of two products.

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

Chapter 11: Boolean Algebra

Definition 1 Literal is a Boolean variable or its complement. Minterm of the Boolean variables x 1 , x 2 , ..., x n is a Boolean product y 1 , y 2 , ..., y n where y i=xi or y i=x i

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


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

Chapter 11: Boolean Algebra

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

The sum of one minterm. The sum of two minterms.

Example Minterm that is 1 for x 1 = 0, x 2 = 0, x 3 = 1, x 4 = 1 x1 x2 x3 x4 = 1 Example x 0 0 0 0 1 1 1 1 y 0 0 1 1 0 0 1 1 z 0 1 0 1 0 1 0 1 F 0 0 0 1 xyz 0 0 1 xyz 0 G 1 x y z 0 0 0 0 0 0 1 xyz H 0 0 0 1 0 0 1 1 G(x, y, z) = x y z + xyz Sum of Products F(x, y, z) = xyz + 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.


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

Chapter 11: Boolean Algebra

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 Identity and Unit property Law Distributive Law Idempotent Law

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

= xyz+x y z + xyz+xyz

= xy z + xyz + xyz

Example Find the sum-of-products for: F(x, y, z) = (x+y)z 1 in table wherever (x+y)z = 1
http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

Chapter 11: Boolean Algebra

x 0 0 0 0 1 1 1 1

y 0 0 1 1 0 0 1 1

z 0 1 0 1 0 1 0 1

x+y 0 0 1 1 1 1 1 1

z 1 0 1 0 1 0 1 0

(x+y)z 0 0 1 0 1 0 1 0

minterms

x y z

x y z

x y z

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 0 0 0 0 1 1 1 1 y 0 0 1 1 0 0 1 1 z 0 1 0 1 0 1 0 1 z 1 0 1 0 1 0 1 0 xz xz+y minterms

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

Chapter 11: Boolean Algebra

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 0 1 1 0 1 1 1 0 0 0 0 0 0 1 1 0 1 1 | Nand 1 1 1 0

x+y = x ? y xy = x | y x = x | x x = x ?x Example

Not OR = Nor Not AND = Nand

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 1 1 0 1 1 1 1 1 0 0 1 0 1 0 0 1 1 1

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

Chapter 11: Boolean Algebra

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 1 1 0 0 0 1 1 1 0 0 1 0 1 0 0 0 0 1

Result is often more operations but can build logic on a chip from a single operation device type, usually more efficient 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 0 1 1 0 1 1 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 1 0 0

x y + Or 0 0 0 1 0 1

x 1 0

Not 0 1

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

Chapter 11: Boolean Algebra

1 0 1 1

0 1

1 0 1 1

1 1

0 = 1 1 = 0

1 .1 = 1

1 + 1 = 1

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 0 0 1 y 0 1 0 x 1 1 0 x+y 0 1 1 (x+y)x 0 1 0 Sum-of-products

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

Chapter 11: Boolean Algebra

x y

(b) Function table x 0 0 0 0 1 1 1 1 y 0 0 1 1 0 0 1 1 z 0 1 0 1 0 1 0 1 x 1 1 1 1 0 0 0 0 z 1 0 1 0 1 0 1 0 y+z 1 0 1 1 1 0 1 1 ___ y+z 0 1 0 0 0 1 0 0 ____ x(y+z) 0 1 0 0 0 0 0 0 Sum-of-products x y z

(c) Function table x 0 0 0 0 1 1 1 1 y 0 0 1 1 0 0 1 1 z 0 1 0 1 0 1 0 1 x 1 1 1 1 0 0 0 0 y 1 1 0 0 1 1 0 0 z 1 0 1 0 1 0 1 0 x+y+z 0 1 1 1 1 1 1 1 x y z 1 0 0 0 0 0 0 0 (x+y+z)(x y z) 0 0 0 0 0 0 0 0 Sum-of-products does not exist.

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

Chapter 11: Boolean Algebra

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.

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

Chapter 11: Boolean Algebra

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 three voting 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
http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

Chapter 11: Boolean Algebra

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

0 0 0 0 0 1 0 1

0 0 0 1 0 0 0 1

0 0 0 1 0 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 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 0 1 1 0 1 0 0 1 x y z x y z x y z x y z

Sum-of-Products x y z + x y z + x y z + x y z
http://homepages.ius.edu/RWISMAN/C251/html/chapter11.htm[1/30/2013 10:52:36 PM]

Chapter 11: Boolean Algebra

Adders Binary numbers are represented in a positional system similar to decimal numbers. 56310 = 5*102 + 6*101 + 3*100 = 56310 10 2 10 1 10 0 5 6 3

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


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

Chapter 11: Boolean Algebra

23 22 21 20 1 1 0 1

Question 11.11.1 - Convert to base 10.

43710 = ? 1112 = ? 10112 = ?

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

11 carry 6710 + 5810 ___ 125 10 sum


Question 11.11.2 a. b.

11 012 + 112 ___ 100 2

carry

sum

111 101 2 +1112 ___ 11002

carry

sum

c.

856 10 +46710 ____

101 2 +0012 ____

11112 +1101 2 ____

Example Parallel 2-bit adder Adding 2-bits:

0 1 +1 1

y1 y0

+x1

x0

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

Chapter 11: Boolean Algebra

____ 1 0 0

______
c s1 s0

produces a carry, c, and 2-bit sum, s 1 s 0 . x1 x0 y1 y0 c s1 s0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 1 0 1 0 0 1 1 1 0 0 0 1 1 0 1 0 1 0 1 1 0 0 0 1 1 1 0 0 1 0 1 1 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0

Question 11.11.3 a. What are: c s1 s0 y1 y0 +x1 x0

1 1 +1 0 ____

______
c s1 s0

b. Give the carry minterms, c c. There are 16 (2 4 ) rows for a 2-bit adder. How many rows for a parallel 64-bit adder in your 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

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

Chapter 11: Boolean Algebra

___ C S a u r m r y

___ 0 0

___ 0 1

___ 0 1

___ 1 0

Half-adder

s = x y + x y = (x+y)(xy) c = xy Question 11.12 - What are c and s? Consult Table 3 above.

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

Chapter 11: Boolean Algebra

x + y ___ C S a u r m r y

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
Question 11.13

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

a. What is the sum-of-products expression from Table 4 for c i+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 ___

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

Chapter 11: Boolean Algebra

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 = ? c i+1 = ?


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

Chapter 11: Boolean Algebra

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 ___

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

Chapter 11: Boolean Algebra

ci+1

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 = ? c i+1 = ?

1 0

Adding multiple bits using multiple 1-bit full-adders: The first carry-in is 0. Binary Decimal

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

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

Question 11.17 - What are: ci+1 s

ci 111 x + 101 y ____ ci+1 s

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

Chapter 11: Boolean Algebra

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

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

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


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

Chapter 11: Boolean Algebra

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

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

Chapter 11: Boolean Algebra

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 11010 + 1 11011 2's complement -5 5-bit binary of -5 1's complement of +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 00100 + 1 -00101 5-bit binary of -5 2's complement -5

1's complement of -5

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

1101 +0101 10010

-3 +5 2

The carry out (underlined) is ignored.


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

Chapter 11: Boolean Algebra

Question 11.19

1011 +0010

-5 +2

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

Das könnte Ihnen auch gefallen