It should output 1 if A is less than b and 0 otherwise. This is often related to AB calculation, for which you need ALU.
Now, if he simply computed the sign bit A - B
, it would be superfluous, but consider the case when A = -2147483648 = 0x80000000
and B = 1 = 0x00000001
, here the result of the subtraction will be 0x7fffffff = 2147483647
, which does not have the most significant value bit, even if A < B
.
As shown in the table from "Patterson, David A., Hennessy, John L.: Computer Organization and Design." I refer you to chapter 3, in particular the subsection devoted to “additions and subtraction” (3.3 in the 2nd edition, 3.2 in the 4th). It has a table regarding overflow / downstream where you can view corner cabinets.
Also remember that the ALU result is 32 bits, so even if the result was only a signed bit of the subtraction result, it still needs a different ALU operation code to signal that the 31 zeros associated with the result should be returned sooner than the full subtraction result .
The Zero line, which you probably mean, is in the architectures discussed in the book. IIRC is used only for comparisons with respect to an equal branch / non-equal branch. SLT/SLTI
in a hand stores its result in the register.
source share