Categories

# Q7: Implement function using MUX & ADDER

Q- Design and implement the following with a combinational circuit (with A and B being 4-bit numbers):

S2           S1           S0                           Output

0              0              0                              2A

0              0              1                              A plus B

0              1              0                              A plus B’

0              1              1                              A minus 1

1              0              0                              2A + 1

1              0              1                              A plus B plus 1

1              1              0                              A minus B (2’s compliment)

1              1              1                              A

Ans: We need one 4-bit parallel ADDER and MUX to implement the above. As we can see that we need at least 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 s2=1

When S1=0 S0=0 we need 2nd input as A to get 2A & 2A+1, when S1=0 S0=1 we need 2nd input as B to get A + B & A+B+1, when S1=1 S0=0 we need 3rd input as B’ to get A + B & A+B’+1 as B’+1 is 2’s compliment of B hence A+B’+1 = A – B, when S1=1 S0=1 we need 4th  input as – 1(11112) to get A – 1  & A – 1 + 1 = A

The circuit required is as follow: