Design an arithmetic circuit with one selection variable S and two n-bit data inputs A and B. The circuit generates the following four arithmetic operations in conjunction with the input carry Cin. Draw the logic diagram for the first two stages.
S |
Cin = 0 |
Cin = 1 |
0 |
D= A+B (add) |
D= A+1 (increment) |
1 |
D= A-1 (decrement) |
D= A+B′+1 (subtract) |