========================================= Choosing Between Addition and Subtraction [TOC] ========================================= In the next step, the circuit will be expanded to allow choosing between addition and subtraction. First, consider the following circuit: ---- IMAGE (width=600) ----------- session02/s02_15.png ---------------------------------- With the `Op` input, you can select whether `A` is inverted. It can be easily shown with truth tables that the following holds: In the case of $Op = 0$, $S = A$, and in the case of $Op = 1$, $S = \lnot A$. This circuit uses a 4-bit wide XOR gate to invert the bit pattern: ---- IMAGE (width=600) ----------- session02/s02_16.png ---------------------------------- Use this method of selective inversion of a bit pattern to choose between addition and subtraction. ---- IMAGE (width=600) ----------- session02/s02_17.png ----------------------------------