AND, OR, XOR
AND
The logic AND operation output is only true when all of its inputs are true, otherwise the output is false.
A |
B |
AND |
---|---|---|
0 |
0 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
1 |
1 |
1 |
OR
The logic OR operation output is only true if one or more of its inputs are true, otherwise the output is false.
A |
B |
OR |
---|---|---|
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
1 |
XOR
The logic exclusive-OR or XOR function gives a true output when the number of true inputs is odd.
A |
B |
XOR |
---|---|---|
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
0 |
The difference between the OR and XOR logic operations is that the output from the XOR operation is logical “1” if and only if there is an unequal number of “1” and “0” inputs.
In the simple case of an XOR operation with two inputs, this means that the inputs must be different to one another to obtain the output “1”. “1” must be present at precisely one of the two inputs.
A |
B |
OR |
XOR |
---|---|---|---|
0 |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
1 |
1 |
0 |
In contrast to a simple OR logic operation, the condition is deemed not to be met if a "1" is present at both inputs.
With an XOR gate, the result in this case is a "0". Each additional input at the gate alters the behavior accordingly
A |
B |
C |
OR |
XOR |
---|---|---|---|---|
0 |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
0 |
1 |
1 |
0 |
1 |
1 |
1 |
0 |
1 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
0 |
1 |
1 |
0 |
1 |
0 |
1 |
1 |
1 |
1 |
1 |