How to write ALU control lines?

267 views Asked by At

I know logical ADD in binary is 0010, and logical AND in binary is 0000. How do I go from this to a full operation?

enter image description here

enter image description here

1

There are 1 answers

0
Erik Eidt On

There's two control lines: Ainvert, and Bnegate, which can be used to invert values before combining them.

Use them as needed!

The Bnegate control line does these two things:

  • inverts the bits of the b input to ~b, which is then fed to the other circuits as the b-side/lower input.
  • and also feeds a 1 into the carry input of the adder, +.

The combined effect of Bnegate with the + Operation, will accomplish a + ~b + 1, which is the same as a-b and also a + -b, because in two's complement, -x = ~x+1.

Though we can, we don't have to use the + with Bnegate, as others operations are still available.


Given this logic diagram, what are some things that cannot be done?

  • a + ~b  (though ~a + b can be done)
  • a | -b
  • a & -b
  • -a + b