This is equal to !(A&&B) && (A||B).
A|B|Q -+-+- 0|0|0 0|1|1 1|0|1 1|1|0
For more than two inputs, XOR returns 1 if and only if an odd number of its inputs are 1. This is required to maintain the associative property. Consider: (1 xor 0) xor 0 => 1 xor 0 => 1 1 xor (0 xor 0) => 1 xor 0 => 1 (1 xor 1) xor 1 => 0 xor 1 => 1 1 xor (1 xor 1) => 1 xor 0 => 1 but: (1 xor 0) xor 1 => 1 xor 1 => 0 1 xor (0 xor 1) => 1 xor 1 => 0
Exclusive OR is also sometimes abbreviated EOR.
See also other logic functions: AND, OR, NOT, NAND, NOR, NXOR.
xor /X'or/, /kzor/ conj.
Exclusive or. `A xor B' means `A or B, but not both'. "I want to get cherry pie xor a banana split." This derives from the technical use of the term as a function on truth-values that is true if exactly one of its two arguments is true.
--The Jargon File version 4.3.1, ed. ESR, autonoded by rescdsk.
An internet services company based in Boulder, Colorado.
Excerpt from standard marketing propaganda:
Founded in 1991, XOR serves as a single point of accountability for building and running an eBusiness solution throughout all phases of its lifecycle, giving our clients the freedom to focus on what's really important to them - their core business.
XOR is a bitwise operator and standard operation on bits and is called the 'eXclusive OR'. XOR is true whenever an odd number of inputs is true. In C-notation, XOR is written as ^ and in mathematical notation XOR is written as + with a circle around it. Also note the following characteristics:
_____ | ____|____ _ _| _| A-||_ A-||_ _| _ _| B-||_ B-||_ |_________| |____________OUT __|___ _ _| _| A-||_ B-||_ |______| __|___ _ _| _| B-||_ A-||_ |______| __|__ -|-
_ _ (A * B) + (A * B) A B | OUT 0 0 | 0 0 1 | 1 1 0 | 1 1 1 | 0
There is an interesting feature of the way XOR is defined for multiple inputs:
When ANDing multiple inputs, there is a "lazy" shortcut: if any of the inputs are 0, the output must also be 0, so there is no need to calculate the others.
Likewise, there is a shortcut for the OR gate. If any of the inputs are 1, the output must be 1; again, there is no need to resolve the other inputs.
The XOR gate has no such shortcut. Every single input must be calculated and tallied, as only an even number of TRUE inputs results in a TRUE return, and so any one input could reverse the output.
I'll add two more very simple, area-efficient, and fast MOSFET implementations of the XOR. The XOR is a critical part of many digital circuits, such as random number generators and adders. Therefore efficient XOR implementations are very desirable. The implementations below are in most ways superior to the brute-force CMOS implementations given in previous writeups.
OUT = A (XOR) B
_ B | ----- ----- | | A---------- ----- | | | OUT B |----------- | | ----- | ----- | _ | | | A---------- -----
The NMOSFETs are called "pass transistors"--they only pass the binary values on the left if they are on. The biggest problem with this pass transistor implementation is that NMOSFETs pass weak 1's (they pass the power supply voltage minus the NMOS threshold voltage). This problem can be rectified by adding PMOSFETs gated with opposite-polarity signals in parallel to the NMOSFETs. Such a parallel combination of an NMOSFET and PMOSFET is called a transmission gate. Notice that this XOR implementation does not consume static power--one of the MOSFETs is off at all times (assuming the inversion of B is instantaneous--in reality it will probably be lagged, which creates problems).
And another one (with rail to rail swing--notice that it doesn't require A to be inverted!)
B | | | - B || | A-o|| o || ----- - ----- | OUT | | |-----------| |___ A | | | - | | || ----- A--|| ----- || | - | | _ | B | _ B
printable version chaos
Everything2 Help
cooled by donfreenut