# design a 2 bit ALU?

can anyone explain how this circuit works?

### 1 Answer

- billrussell42Lv 72 months ago
FA I think means full adder. note the carry in and carry out, which are used to expand this circuit to more bits. If this is to be used only for 2 bits, ground (0) carry in and ignore carry out.

the next two gates are the AND, then the OR, then the XOR. So all 4 operations are done at the same time on the inputs. The MUX just selects which answer to connect to the outputs. The two inputs S₀ S₁ determine which function is to be selected. Exactly which bit combo selects which function is unknown without more details about the MUXs, but probably:

S₁ S₀

0 0 selects add

0 1 selects AND

1 0 selects OR

1 1 selects XOR

The adder, need the schematic for it in order to explain further. The AND, OR, etc are simple gates that perform that logic function on a bit basis.

edit: from your other question, you want to add NOT?

first you have to define NOT, as it can only operate on one set of inputs. EG, NOT inverts inputs A and ignores input b

Then add two NOT gates below the XOR gates, with inputs connected to A inputs.

Then replace the 4 input MUXs with 8 input MUXs with the 5th input connected to the NOT gate outputs. You will now need three select lines S₀ S₁ S₂:

S₂ S₁ S₀

0 0 0 selects add

0 0 1 selects AND

0 1 0 selects OR

0 1 1 selects XOR

1 0 0 selects NOT A

Alternative: two NOT commands, first inverts A input, second inverts B inputs

Then add four NOT gates below the XOR gates, with two with inputs connected to A inputs, two with inputs connected to B inputs.

Then replace the 4 input MUXs with 8 input MUXs with the 5th input connected to the first NOT gate outputs, and 6th input to the second NOT outputs. You will now need three select lines S₀ S₁ S₂:

S₂ S₁ S₀

0 0 0 selects add

0 0 1 selects AND

0 1 0 selects OR

0 1 1 selects XOR

1 0 0 selects NOT A

1 0 1 selects NOT B

edit, since you have more functions available, I'd use two, codes 6 and 7, to connect A to output, and connect B to output. These would require no additional parts, just a few wires.

or, just draw out the circuits for each part, without the MUX, a adder, an AND circuit,, etc, each for two bits and 2 inputs.