 Last time, we built this hardware to do multiplication for us. And then we walked through an example to see how it worked. Just to show that yes, it really does do multiplication, even if it does work through it in an iterative fashion, rather than the stages that we're used to. But this isn't really a terribly efficient way of implementing multiplication. We had a 64-bit multiple can where our multiple cans are only over 32 bits, and we have a 64-bit adder there, which is relatively expensive. So this time, we're going to look at a couple different ways of improving this hardware so that it's a little faster and a little cheaper. First thing to notice is that, well, our multiple can only ever really has 32 bits in it. If all of our registers are only ever going to be 32 bits, then we can't have a 64-bit multiple can, really. Our product is the only thing that's going to end up with 64 bits. So we'd like to find a way to reduce our multiple can to only being 32 bits instead of 64. It's not a big difference, but it would help. And hopefully in the process, we could also reduce this 64-bit adder. So one way we could do this is to take another look at our original problem. Before we saw, well, we add when we see a 1 here, and then we shift our multiple can over, and then we don't do an add there, shift our multiple can over, and then add down. That gave us a 64-bit multiple can because we needed to be able to shift over 32 places, potentially. But instead, we could consider what would happen if we shifted our product instead. We'll leave our multiple can right where it is. And then, okay, I see a 1 here, so I will just add my multiple can straight down. Now, I'm going to take that product and I'm going to shift it over one place. Next I see a 0, so I'm not going to do any addition. Then I'll shift my multiplier over one more place. Now I see a 1, so I'll add in that multiple can. So now I have something that looks like this, but it's shifted 2 bits over. Then when I add them together, I get this, just shifted over 2 bits. So if I shift my product instead of my multiple can, then my multiple can doesn't move. It doesn't change ever. I'm also only ever going to do 32-bit addition because once I've shifted a bit towards the right of my product, I'm never going to be able to add to it again. So as soon as I shift my product right once, I'm not going to be able to add to this bit anymore. I don't want to anyway because my next bit would be here and I'd only ever be able to align to the next bit anyway. So I'm only ever going to be able to add to the uppermost 32 bits of this product this time. So if I draw the hardware for that, it will look something like this. So this time our hardware will look like this. Our multiplier and our control will stay the same. Our multiple can is now only 32 bits, so we have a 32-bit adder this time instead of a 64-bit one. But our product is still 64 bits. This time we're going to be shifting our product to the right instead of our multiple can to the left. And our multiplier will shift one bit to the right. So now let's see how our hardware will approach our example again. Take my multiple can, place it in the 4-bit multiple can register. I'm going to initialize my product to all zeros. And then my multiplier goes in that register. So this starts out relatively nicely. The first stage I'm going to take the leftmost 4 bits of my product, add them to the multiple can. Zero plus 1011 obviously gives me 1011. And the control unit will take the rightmost bit of the multiplier and use it to determine whether I update this register. It's a 1, so I will update the product register with this 1011. And that's going to come down into these leftmost 4 bits. Next I need to take the product and shift it one bit to the right along with the multiplier. So this is what my registers will look like at the end of the first cycle. I added 1011 and shifted my product right one bit, shifted my multiplier right one bit. For the second cycle I will add the leftmost 4 bits to the multiple can to get in. Next I'll go over to my control unit. It will say the rightmost bit is a zero, so I'm not going to update my product register with this result. Instead I'm just going to shift my product register right one bit and my multiplier right one bit. So that's what my hardware looks like at the end of the second cycle. For the third cycle I will add the multiple can to the 10. Get that for a result. Then my control unit will say the rightmost bit is a 1, so I will update the product register. But it's only going to update the leftmost 4 bits. Now I need to shift my product register right one bit and my multiplier right one bit. So this is what my hardware looks like at the end of the third cycle. In the fourth cycle I will add 0110 to 1011. Get this result. Then I go over to my control unit which says the rightmost bit is a zero, so I'm not going to update my product register with this result. Instead I'm just going to take the product register, shift it one bit to the right, and shift the multiplier one bit to the right. So at the end of the fourth cycle I'm done. This is my result. My product has the number I expect in it. My multiplier has zero in it because I shifted my multiplier all the way out. My multiple can though still has the original multiple can this time. I haven't shifted it at all. But the full 8 bits of my product here look like what I expect. So this time I've got slightly cheaper hardware. I've got a smaller adder and a smaller multiple can register. But my multiplier is the same. I can improve this a little bit more by realizing that now my product register and my multiplier are pretty much doing the same thing. They're working at about the same time. I'm just shifting and I only really care about one bit of my multiplier. And when I start with my product I don't actually have anything that I use in these rightmost bits. So I could improve this a little bit more by taking the multiplier and initially sticking it in the rightmost four bits of the product. Those bits will get shifted off as my algorithm runs. And then I just look at the rightmost bit. Use it to decide whether or not I want to update the leftmost bits of my product with the results of the addition or not. And they'll just gradually fall off the end. I won't need them because I can never update them directly. They'll just get shifted off as my algorithm runs. It will run, say, 32 times and shift off 32 bits one at a time. That would get rid of another 32-bit register, which makes my hardware a little bit cheaper, maybe not much faster but slightly cheaper, and still gives me the same power. If you wanted to improve the performance of your hardware even further, you would want to look at other methods of doing your multiplication besides the common ones that we're used to. We'd be looking at finding other patterns that hold true for any sets of multiplication that we do. Other ways to reorganize the terms that we're actually working with at an algebraic level when we're doing this algorithm.