You are on page 1of 9

XOR gates

XOR gates are expensive to implement in silicon, but they are very useful for circuits like parity checkers and arithmetic circuits (e.g., adders, subtractors, and so forth). Sometimes, we can find an XOR gate hidden or buried inside of a lot of AND, OR and NOT gates. If we can find and extract the XOR gate, we can take advantage of it to get a large savings in circuit size. Recall truth tables for XOR and NXOR These gates perform the odd and even functions, respectively (with 2-inputs, they perform the difference or equivalence functions, respectively).

ECE124 Digital Circuits and Systems

Page 1

4-input XOR and NXOR truth tables (for illustration purposes)

ECE124 Digital Circuits and Systems

Page 2

XOR and XNOR functions using AND, OR and NOT gates


Notice that we can implement XORs using AND, OR and NOT gates:

ECE124 Digital Circuits and Systems

Page 3

K-Maps for 4-Input XOR and XNOR


XOR and XNOR gates have checker-board patterns in their K-Maps.

x1x2 x3x4 00 01 11 10

00 0 1 0 1

01 1 0 1 0

11 0 1 0 1

10 1 0 1 0

x1x2 x3x4 00 01 11 10

00 1 0 1 0

01 0 1 0 1

11 1 0 1 0

10 0 1 0 1

ECE124 Digital Circuits and Systems

Page 4

How can XORs Sometimes Reduce Implementation Size?


Sometimes, it might be true that XORs are hidden inside of other logic. By finding and extracting an XOR, we might get a very simple circuit.
x1x2 x3x4 00 01 11 10

00 0 1 0 1

01 1 0 1 0

11 0 1 0 1

10 0 1 0 1

The first equation above is the minimum Sum-Of-Products 6 AND gates (2, 4-input, 4, 3-input) and 1 OR gate (6 inputs).
ECE124 Digital Circuits and Systems Page 5

Continuing Our Example

x1x2 x3x4 00 01 11 10

00 0 1 0 1

01 1 0 1 0

11 0 1 0 1

10 0 1 0 1

ECE124 Digital Circuits and Systems

Page 6

Finishing Our Example


We can draw a circuit

We can see what is happening with the XOR by drawing the K-Maps for x1, x2, x3, x4 and overlaying them We are taking advantage of the XOR odd property.
x1x2 x3x4 00 01 11 10 x1x2 x3x4 00 01 11 10
x1x2 x3x4 00 01 11 10

x1x2 x3x4 00 01 11 10

00 0 0 1 1

01 0 0 1 1

11 0 0 1 1

10 0 0 1 1

00 0 1 1 0

01 0 1 1 0

11 0 1 1 0

10 0 1 1 0

00 0 0 0 0

01 1 1 1 1

11 0 0 0 0

10 0 0 0 0

00 0 1 0 1

01 1 0 1 0

11 0 1 0 1

10 0 1 0 1

ECE124 Digital Circuits and Systems

Page 7

XOR Summary
In general, finding and extracting XOR gates is a complicated and hard problem. When we can write a function as the XOR of a bunch of Product Terms (ANDs), we are finding not Sum-Of-Products, but rather Exclusive Sum-Of-Products (ESOP).

ECE124 Digital Circuits and Systems

Page 8

Another XOR Example


Just another example of finding an XOR (but not an ESOP) The K-Map appears to have an XOR pattern
x1x2 x3x4 00 01 11 10 00 0 1 0 0 01 1 0 0 0 11 0 1 0 0 10 1 0 0 0

The input x3 is acting like a gating signal, preventing the XOR from affecting the output when it shouldnt (we can gate signals with ANDs).

ECE124 Digital Circuits and Systems

Page 9

You might also like