XOR gates
Categories: logic logic gates
An Exclusive OR (XOR) gate has two inputs and one output. It is similar to an OR gate, except that the output obeys a slightly different rule.
The two inputs can each have values 0 or 1.
The state of the inputs controls the state of the output. The output value is 1 if either (but not both) inputs are 1, otherwise it is 0.
Another way to look at this is that the output will be 1 if the 2 inputs are different, but it will be 0 if both inputs are the same.
Symbol
Here is the symbol for an XOR gate. The inputs are labelled A and B, the output is labelled Q.
Truth table
A truth table is a table which shows all possible combinations of inputs (A and B), and the resulting value of the output, Q. Here is the truth table for an XOR gate, as you can see the output is 1 if either (but not both) inputs are 1.
See also
Sign up to the Creative Coding Newletter
Join my newsletter to receive occasional emails when new content is added, using the form below:
Popular tags
555 timer abstract data type abstraction addition algorithm and gate array ascii ascii85 base32 base64 battery binary binary encoding binary search bit block cipher block padding byte canvas colour coming soon computer music condition cryptographic attacks cryptography decomposition decryption deduplication dictionary attack encryption file server flash memory hard drive hashing hexadecimal hmac html image insertion sort ip address key derivation lamp linear search list mac mac address mesh network message authentication code music nand gate network storage none nor gate not gate op-amp or gate pixel private key python quantisation queue raid ram relational operator resources rgb rom search sort sound synthesis ssd star network supercollider svg switch symmetric encryption truth table turtle graphics yenc