Jump to content

XOR gate: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Added a "See also" section to correspond with the other electronic gate articles.
Line 63: Line 63:
==More than two inputs==
==More than two inputs==


The case of a three, or more, input XOR operation tends to be an ill-considered case. An XOR operation with three ''simultaneous'' inputs is not so easily expressed in most popular programming languages. When expressed as successive [[binary operation]]s the result is a simple [[parity (telecommunication)|parity]], giving a TRUE result for any odd number of TRUE inputs.
The case of a three or more XOR operation
tends to be an ill-considered case XOR operation with three ''simultaneous'' inputs is not so easily expressed in most popular programming languages. When expressed as successive [[binary operation]]s the result is a simple [[parity (telecommunication)|parity]].
[[image:Three ones EORed.png|right|three ones XORed simultaneously]] a operation the formal definition yields the result TRUE when one, and only one, of its inputs is TRUE. For example in the case where three inputs are all TRUE (as shown on the right, in the [[Logic gate#Symbols|IEC]] symbology to emphasise the definition) the result would have FALSE the "only one of its inputs is TRUE".

[[image:Three ones EORed.png|right|three ones XORed simultaneously]] When taken as a multi-input black box whose operation follows the formal definition and yields the result TRUE when one, and only one, of its inputs is TRUE, the behaviour is inconsistent with the successive binary mode. For example; in the case where three inputs are all TRUE (as shown on the right, in the [[Logic gate#Symbols|IEC]] symbology to emphasise the definition) the result would have to be FALSE because it does not meet the condition that "only one of its inputs is TRUE".


==See also==
==See also==

Revision as of 01:41, 19 April 2007

INPUT
A   B
OUTPUT
A XOR B
0 0 0
0 1 1
1 0 1
1 1 0

The XOR gate is a digital logic gate that implements exclusive disjunction - it behaves according to the truth table to the right. A HIGH output (1) results if one, and only one, of the inputs to the gate is HIGH (1). If both inputs are LOW (0) or both are HIGH (1), a LOW output (0) results.

This function is addition modulo 2. As a result, XOR gates are used to implement binary addition in computers. A half adder consists of an XOR gate and an AND gate.

Symbols

There are two symbols for XOR gates: the 'military' symbol and the 'rectangular' symbol. For more information see Logic Gate Symbols

'Military' XOR Symbol
'Rectangular' XOR Symbol


Hardware description and pinout ==

XOR gates are basic logic gates, and as such they are recognised in TTL and CMOS ICs. The standard, 4000 series, CMOS IC is the 4070, which includes four independent, two-input, XOR gates. The 4070 replaces the less reliable 4030, but keeps the pinout. The pinout diagram is as follows:

 1  Input A1
 2  Input B1
 3  Output Q1
 4  Input A2
 5  Input B2
 6  Output Q2
 7  VG
 8  Input A3
 9  Input B3
 10 Output Q3
 11 Input AA
 12 Input B4
 13 Output Q4
 14 VCC

This device is available from most semiconductor manufacturers such as Philips. It is usually available in both through-hole DIL and SOIC format. Datasheets are readily available in most Datasheet Databases.

Alternatives

If no specific XOR gates are available, one can be made from four NAND or five NOR gates in the configurations shown below. Interestingly, any logic gate can be made from a combination of NAND gates or a combination of NOR gates.

XOR Gate Constructed Using Only NAND Gates
XOR Gate Constructed Using Only NOR Gates


More than two inputs

The case of a three or more inputs the XOR operation gives a TRUE result for any odd number of TRUE inputs. This tends to be an ill-considered case as an XOR operation with three simultaneous inputs is not so easily expressed in most popular programming languages. When expressed as successive binary operations the result is a simple parity.

three ones XORed simultaneously
three ones XORed simultaneously

The behavior of a three or more inputs XOR operation does not easily follow the formal definition for a two input XOR operation (which yields the result TRUE when one, and only one, of its inputs is TRUE). For example, in the case where three inputs are all TRUE (as shown on the right, in the IEC symbology to emphasise the definition) the result is actually TRUE but it would have been FALSE if we were to apply the two input XOR definition "only one of its inputs is TRUE in order to have a TRUE output".

See also