A binary adder-subtractor is a digital circuitry that has the capability of adding or subtracting binary numbers based on a control signal. The adder-subtractor circuit has a switch mode control input that switches the mode of the circuitry between addition and subtraction.
The switch mode control uses the XOR gate logic. Setting the input control signal to logic zero causes the digital circuit to function as a binary adder and setting the input control signal to logic one causes the digital circuit to function as a binary subtractor.
The adder-subtractor circuit adds or subtracts 8-bit binary numbers using the two?s-complement notation. In this notation system, the most significant bit designates the sign of the number and is not a part of the number value. A value zero in the most significant bit location designates a positive binary number. A value one designates a negative binary number.
A carry-in and carry-out bit in the circuit determines whether an overflow occurs. Adding two positive numbers within the range where the sum is also within the range produces a correct positive result with no carry or no overflow. In the case the sum is beyond range, it signals an overflow.
During two?s-complement subtraction with a negative and a positive number, the sign bit indicates a positive value, there is no overflow and the carry bit gets discarded. Adding two?s-complement negative numbers results in the carry-in and carry-out value of one and no overflow.