Half-Adder Exercise

479 Views Asked by At

My exercise is the following:

Make a circuit which outputs X^3 of two bit input of X.
Use the lowest number of HALF ADDERS as you can.

I don't really understand how to compute $X^3$ with half adders.

Any hints or any help is appreciated.

Edit: the exercise is meant for $X^3$ rather than $X \oplus 3$.

2

There are 2 best solutions below

1
On

I would assume X^3 is $X \oplus 3$. Since a half adder is a XOR gate and an AND gate, you would just use 2 half adders with the other input being 11, the binary notation of 3.

If you really mean X cubed, you would require a multiplier (or more simply a lookup table) with conditional addition. This could be done with the AND gates of the half adder, but I doubt your exercise would ask for this.

4
On

If you really want to compute 2 bits cubed, then you are trying to compute:

$$\begin{align} bXY^3 &= bA\,BCDE \\ \hline b00^3 &= b0\,0000 \\ b01^3 &= b0\,0001 \\ b10^3 &= b0\,0100 \\ b11^3 &= b1\,1011 \\ \end{align}$$

A half adder lets you compute a carry bit and a sum bit:

$$\text{CarryOut} = \text{Maj2}(A,B,\text{CarryIn})$$ $$\text{sum} = A \text{ xor } B \text{ xor } \text{CarryIn}$$

So using the above two functions, you want to create the above table. I'll use $\bot$ for zero or ground.

$$\begin{align} E &= Y \\ D &= \text{Maj2}(X, Y, \bot) \\ C &= \text{Maj2}(X,Y,\bot) \text{ xor } X \text{ xor } \bot \\ B &= \text{Maj2}(X,Y,\bot) \\ A &= \text{Maj2}(X,Y,\bot) \end{align}$$

That's two half adders and some wiring. Good luck.