Q- Design and implement the following with a combinational circuit (with A and B being 4-bit numbers):
S1 S0 Output
0 0 A plus B
0 1 left shift A
1 0 A plus B plus 1
1 1 2A + 1
Ans: We need one 4-bit parallel ADDER and MUX to implement the above. As we can see that we need atleast one A at the input of ADDER so put A at one of the inputs
And for the 2nd input we have to choose out of different options, hence we use a MUX
And we see that we have to add an extra 1 when s1=1 & s0=0 and s1=1 & s0=1. In both cases we have s1=1 so we attach s1 to carry pin also.
Left shifting A would make it 2A hence we add A to A to get left shift of A.
The circuit required is as follow: