Addition and subtraction operation is the fundamental operation performed in arithmetic and logical unit of CPU. Adder-subtractor circuit is the logic circuit which performs both addition and subtraction operation using n-bit adder circuit.
The adder-subtractor circuit performs respective operation based on the input signal called A/S which is add/subtract. When A/S signal is logic 0, it performs addition operation and when it is logic 1, it performs subtraction operation of two n-bit number.
We know that we can add two number using adder circuit. Let's consider a two n-bit number A and B and the addtion S of these two number is $$S = A + B$$ For performing above operation, n-bit adder is required. If we want to subtract using adder we can perform the operation $$S = A + (-B)$$ If we use negative number, we can perform subtration operation. In binary number, we can make positive number to negative by doing it's 2's complement operation.
In 2's complement first we make number complement of original number and we add binary 1 in it. So, $$-B = \overline B + 1$$ Hence subtraction operation becomes. $$A - B \text{ (is equivalent to) } = A + \overline B + 1$$
The circuit diagram of 4-bit adder-subtractor is given below.
In circuit diagram, A/S is connected to ex-or input and another input to ex-or is B. If one of the input of ex-or is logic 1, it's output is complement of other input. So input to the adder becomes complement of B. Now input to the 1-bit adder is $$\text{A and } \overline B \text{ and } 1$$ Hence it performs $$A + \overline B + 1 $$ Which is equivalent to subtraction operation of inputs A and B
If one of the input of ex-or is logic 0, it's output is same as other input. So input to the adder not change and it is same B. Now input to the 1-bit adder is $$\text{A and } B \text{ and } 0$$ Hence it performs $$A + B + 0$$ Which is equivalent to addtion operation of inputs A and B