Half adder circuits are implemented with XOR gates for the summing. Why can't the adding function be implemented with OR gates? What is the difference between using XOR gates and OR gates?

  • 4
    \$\begingroup\$ OR gates don't add two bits; XOR gates do add 2 bits. \$\endgroup\$
    – Andy aka
    Commented Apr 25, 2015 at 20:46

1 Answer 1

0 + 0 = 0 0
0 + 1 = 0 1
1 + 0 = 0 1
1 + 1 = 1 0

The ones place of a single-bit addition is equivalent to the exclusive OR operation, not the OR operation. Hence XOR is used instead. Note that this is not the only way to build a half adder, you can do it without using an XOR gate, but it requires more gates.

For example, here is a half adder built with only AND, OR, and NOT gates:

Half adder

You can see here that an OR gate is used to form the ones place output, but an AND gate is also necessary to turn off that output when the carry output is set.

One thing to note is that these adders are usually implemented not with several separate gates, but as one optimized unit, like this:

CMOS full adder

The construction with logic gates is just a functionally equivalent version of the actual implementation.

  • \$\begingroup\$ thanks for your answer. and in other cases why we are having XOR gates, instead of OR gates \$\endgroup\$ Commented Apr 25, 2015 at 18:54
  • 1
    \$\begingroup\$ @natarajan, besides the fact that XOR conditions frequently need to be evaluated in boolean logic, they also conventiently behave as a selective logic inversion - that is, "invert this signal only when this other condition is true." The truth table tells you everything you need to know. OR gates are fundamentally different, because they output a logic high when any input is high. \$\endgroup\$
    – user39962
    Commented Apr 26, 2015 at 9:33
  • \$\begingroup\$ Didn't realize that was a question. XOR gates are also used in linear feedback shift registers (including CRC computation and pseudorandom number generation), parity generation, encryption, comparison (for things like convolution), etc. \$\endgroup\$ Commented Apr 26, 2015 at 17:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.