XOR Operator

25
XOR Operator A short digression… … to introduce another Boolean operation: exclusive-OR (XOR) A B A + B 0 0 0 0 1 1 1 0 1 1 1 0 XOR

description

XOR. XOR Operator. A short digression… … to introduce another Boolean operation: exclusive-OR (XOR). XOR Operator. Also referred to as an “odd” function since it returns a 1 only when an odd number of 1’s are input. Simplification. - PowerPoint PPT Presentation

Transcript of XOR Operator

Page 1: XOR Operator

XOR Operator• A short digression…• … to introduce another Boolean operation: exclusive-

OR (XOR)

A B A + B

0 0 0

0 1 1

1 0 1

1 1 0

XOR

Page 2: XOR Operator

XOR Operator

• Also referred to as an “odd” function since it returns a 1 only when an odd number of 1’s are input

A B C A+B+C0 0 0 00 0 1 10 1 0 10 1 1 01 0 0 11 0 1 01 1 0 01 1 1 1

Page 3: XOR Operator

Simplification

• Using the axioms to “prove” that a simplified version of a circuit is equivalent to the complex version takes a special kind of person…– …of which I’m not one

• Fortunately, there’s another way…

Page 4: XOR Operator

Karnaugh Maps

• Also known as K-Map• Recall that an expression can be written

in the formF(A,B,C) = Σ(0,2,4,5,6)

• Which means the functional value is 1 at binary input patterns 0, 2, 4, 5, 6 and 0 at all other input patterns– What does the truth table look like?

Page 5: XOR Operator

K-Maps• F(A,B,C) = Σ(0,2,4,5,6) is called a “sum of

minterms” representation• The expression for such a representation is

F(A,B,C) = A’B’C’ + A’BC’ + AB’C’ + AB’C + ABC’

• We could simplify this via the axioms, right? (assuming we were that special kind of person)

• It’s painful!!!

Page 6: XOR Operator

K-Maps

• A K-Map is a grid (map) where each square corresponds to a minterm

0 1 3 24 5 7 8

12 13 15 148 9 11 10

ABCD

00

01

11

10

00 01 11 10

0 13 2

0

1

10A B

0 110A 0 1 3 2

4 5 7 8

A

0

1

00 01 11 10BC

Note the ordering here is Gray code, not binary

Page 7: XOR Operator

K-Maps

• Notice how neighboring squares (minterms) differ by a single bit…this is the key to the whole thing– Consider minterms 1 and 3

• 1: A’B’C• 3: A’BC

– If we were to OR these together• (A’B’C + A’BC) would simplify to A’C via the

axioms

Page 8: XOR Operator

K-Maps

• Great, now what do we do with them?• Place 1’s on the squares that

correspond to minterms in the truth table

• Place 0’s on all other squares• Group adjacent 1’s into the largest

group whose size is a power of 2

Page 9: XOR Operator

K-Maps

• Notes:– Adjacencies wrap top-to-bottom and left-to-

right– 1’s can be part of more than one group– When you are grouping adjacent squares

you’re essentially applying axiom 4 (x + x’ = 1) so the variable that is being “spanned” can be removed from the minterm

Page 10: XOR Operator

Simplification via Axioms(aka Proofs)• Here’s a little insight that no one ever taught me

F(x, y, z) = xy’z + x’y’z + x’yz• Notice how the middle term shares two

elements with each of the others• Using association, distribution, and inverse:

F(x, y, z) = y’z + x’yz• One more application of distribution

F(x, y, z) = z(y’ + x’y)• We could have arrived at a similar solution by

grouping the 2nd two terms

Page 11: XOR Operator

Simplification via Axioms(aka Proofs)• But, can we do better?

• Notice that we use the minterm x’y’z in two groupings

• What does that mean in terms of an axiomatic proof?

0 1 1 00 1 0 0

xyz

00 01 11 100

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

Page 12: XOR Operator

Simplification via Axioms(aka Proofs)• It means exactly this…

F(x, y, z) = xy’z + x’y’z + x’yzF(x, y, z) = xy’z + x’y’z + x’y’z + x’yz

• …by idempotence over OR• Now we can form two associative

groupings and arrive at the same answer that the Karnaugh Map gave us

Page 13: XOR Operator

Karnaugh Maps• What is the truth-table?• What is the expression in

sum-of-minterms form?• What is the simplified

expression?• What is the (schematic)

logic gate implementation?

1 0 100 0 000 0 001 0 10

00 01 11 1000

01

11

10

ABCD

Page 14: XOR Operator

Sum-of-Products

• This is what we previously called the “sum-of-minterms”

• Form the largest power-of-two groupings of 1’s on the K-map

• Create the schematic

Page 15: XOR Operator

Product-Of-Sums• Instead of forming large adjacent groups

of 1’s (on the K-map), form large adjacent groups of 0’s– What does this mean in terms of the original

expression/truth-table?– It means you have simplified F’, instead of F– To “fix” what you’ve done you need only

negate the final result them apply De Morgan’s theorem

Page 16: XOR Operator

Example – Sum-of-Products• F(A,B,C,D) = Σ(0,1,2,5,8,9,10)• Form the truth-table• Form the K-map• Simplify the K-map using sum-of-

products• Formulate the boolean expression• Draw the schematic diagram

Page 17: XOR Operator

Example – Sum-of-Products

B’

D’

C’

A’

D

F

Page 18: XOR Operator

Example – Product-of-Sums• F(A,B,C,D) = Σ(0,1,2,5,8,9,10)• Form the truth-table• Form the K-map• Simplify the K-map using product-of-sums• Formulate the boolean expression• Negate, apply De Morgan’s• Draw the schematic diagram

Page 19: XOR Operator

Example – Product-of-Sums

B’

D

A’

C’

D’

F

Page 20: XOR Operator

So What?

• As it turns out, the sum-of-products can be easily implemented with NAND gates

• Similarly, the product-of-sums can be easily implemented with NOR gates

• This may greatly simplify the design thus saving us money!

Page 21: XOR Operator

NAND/NOR Implementations

B’

D

A’

C’

D’

B’

D’

C’

A’

D

Page 22: XOR Operator

Combinational Circuits

• Definition: A connected arrangement of logic gates with a set of inputs and outputs

• Specifically, they have no memory!• Basically, it’s the stuff we’ve been

working on so far

Page 23: XOR Operator

Combinational Circuit Design• Design a Half-Adder

– A combinational circuit that adds 2 bits• Input 1 is call the “Augend”• Input 2 is called the “Addend”• Output 1 is called the “Sum”• Output 2 is called the “Carry”

Augend

Addend

Sum

CarryHalf-Adder

Page 24: XOR Operator

Combinational Circuit Design• Design a Full-Adder

– A combinational circuit that adds 3 bits• Input 1 is call the “Augend”• Input 2 is called the “Addend”• Input 3 is call the “Carry-in”• Output 1 is called the “Sum”• Output 2 is called the “Carry-out”

AugendAddend

Sum

Carry-outFull-Adder

Carry-in

Page 25: XOR Operator

Homework

• Pages 37, 38: 1-8, 1-9, 1-10, 1-12, 1-13• Due Thursday (next lecture)