I'm studying computer architecture and I wonder why the inverter is needed in this ALU?

enter image description here

  • 3
    \$\begingroup\$ How else would you get the inverted value of B? \$\endgroup\$ Feb 5 '18 at 5:51
  • \$\begingroup\$ @IgnacioVazquez-Abrams Now I almost understand. But when is the inverted value of B needed? For what operations? \$\endgroup\$
    – Niklas R.
    Feb 5 '18 at 5:53
  • 2
    \$\begingroup\$ Inversion, subtraction, etc. \$\endgroup\$ Feb 5 '18 at 5:53
  • \$\begingroup\$ @IgnacioVazquez-Abrams I accept that as an answer. Thanks! \$\endgroup\$
    – Niklas R.
    Feb 5 '18 at 5:54
  • 1
    \$\begingroup\$ @IgnacioVazquez-Abrams. Not to step on your turf, but you should post your comment as an answer since the OP accepted it. I could do so but it would be a copy-cat version. \$\endgroup\$
    – user105652
    Feb 5 '18 at 6:22

Inversion of an input is used in some operations, including but not limited to subtraction, XNOR, and of course inversion. It can also simplify some operations when used as an input of an AND or OR gate.


Practically, in the ALU circuit you posted, with only defined function F[2:0] as 000 (A AND B operation), not only inverter is not needed, but also small mux device, adder, zero extender and big mux.

As it is a picture from the learning material, you may guess that this ALU circuit diagram may have some other functions, defined by the value of vector input F[2:0]. For example:

If F[2:0]==001 then ALU outputs A OR B;

If F[2:0]==010 then ALU outputs A+B with no carry bit;

If F[2:0]==100 then ALU outputs A AND (NOT B);

If F[2:0]==101 then ALU outputs A OR (NOT B);

If F[2:0]==110 then ALU outputs A + (NOT B).

Not all operations may have sense without understanding the context ALU is implemented in though. I also do not know the "zero extend" device and its purpose here. Seems device returns True (1) if resulting number is negative, and False (0) if positive, but it does not elaborate on overflow thus output makes no use for further binary arithmetic operations.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.