This page has not been looked at yet My apologies for any issues this may cause.
4.6 : Arithmetic Logic Unit
Now that we know the basics of using boolean algebra to add bits, we can move onto more complicated adders. Just as we connected two half-adders to create a full-adder, we can connect many full-adders to add more and more bits. This is called a Parallel Adder. A Parallel Adder is made when you use multiple full-adders and cascading carries to add multiple bits. Right now we're going to set up 3 full adders to add two 3 bit numbers. But we're going to set up our adder with something extra so we can also subtract. If you remember from the binary tutorial, subtracting is just adding the negative. To negate numbers, we use two's complement, which is if you remember, switching the bits then adding 1. To do this we're going to have a subtraction input. When this subtraction input reads positive, it will add one, and switch the bits of one number. This means we should apply a XOR operator to the Y value and the subtract input. This way, if Subtract is true, then it will return the opposite of each Y bit. For the table below, I put a few random examples down. This is not the way to set up a table and I am only using this to demonstrate possible outcomes. Try them out on the circuit simulator.
X = x2x1x0 | Y = y2y1y0 | Subtract | Z = z2z1z0 |
---|---|---|---|
101 | 001 | 0 | 110 |
101 | 001 | 1 | 100 |
000 | 111 | 0 | 111 |
000 | 111 | 1 | 001 |
101 | 010 | 0 | 111 |
101 | 010 | 1 | 011 |