 One other thing we might like to use our ALU for is doing comparisons, determining whether two things are equal or whether one is less than the other. We're going to use the same sort of strategy for both of them, because we can say that when A equals B, then A minus B equals zero. So if we can find an easy way to say our results are all zero, then we can do this. We can do something similar for A less than B, because A less than B means that A minus B is less than zero. So if we can find an easy way to show that our result is negative, then we can easily say that A is less than B. We'll start with the zero operation, because that one's really easy to look at. If the results of our ALU are zero, then that means that all of the bits in our result were zero. So what we could do is we could just build one very big OR gate, type all 32 of our result bits into this, and we'd have a result. So this OR gate will tell us if any one of our bits is one, which is almost what we want. If we make that a NOT gate, then this result will only ever be true if none of these bits is one. If any one of them is one, then our OR gate would be one and not one would be zero. So now we have an easy way to tell whether two things are equal. We can just do a subtraction operation and look at what the results of this zero line are. We can do something similar for less than. Remember we're going to be using two's complement numbers. That means that if the results are negative, less than zero, then the most significant bit will be one. Some of the others may be as well, but the most significant bit will be one. So if we really want to know if something is negative, we just need to look at this most significant bit. If it's one, then it's negative, otherwise it's positive. There's a few ways we could do this. We could do something similar to the zero line where we just take this one bit and send it out. Say that's the less than line. But in our case, what we're going to do is actually extend our hardware a little bit. We'll give our one bit ALU one more operation that I can do. I'll have a operation number three down there. This will be the less than operation. Remember, all it needs to do is pass out this one bit as the result of our entire 32 bit ALU. So all we're going to really do is pass in some bit and it will just go out the other side. We'll name this the less bit. And for most of these, it's just zero. I add in the less bit, all of these. It's not really going to be interesting in most cases. It's just zero, except in the least significant case. That's the one where we want it to be true if A is less than B. So for this one case, we will take the result of the most significant ALU, pass that all the way back to the first ALU, and use that as the end to the less line. So this time, we're going to do subtraction again to calculate A minus B. So A invert is zero, B invert is one, and this topmost carry in is one. But then we select opcode three. That means that we'll get the results of the less line, which are primarily zero. But we'll also include the most significant bit of the subtraction operation as the results of our operation. That tells us whether our result is negative and in turn whether A was in fact less than B. So there are two comparison operations that we can do really easily just with this existing hardware. For zero, we just took the results of all of our result bits from doing subtraction and looked at all of those bits were zero. So we have an or gate there. To do less than, well we do subtraction and we only look at the most significant bit. That tells us whether our results were positive or negative.