I have constructed a half-adder that looks like this:
And a half-subtractor like this:
It's basically the same circuit except the AND gate at the bottom has a
NOT before it for one of the inputs. I would like to combine the two so that I can perform (half-) addition or subtraction based upon a third boolean input. Zero would mean Add and One would mean Subtraction. What would be an example of how I could 'route' the input into an optional NOT gate based upon the type of operation being performed?
One idea I had was to put the operation input into an XOR gate before the AND input.