What is unsigned underflow and what's the relationship of subtraction produced a borrow
? This is an excerpt from ARM Architecture Reference Manual.
For a subtraction, including the comparison instruction CMP, C is set to 0 if the subtraction produced a borrow (that is, an unsigned underflow), and to 1 otherwise.
From https://cwe.mitre.org/data/definitions/191.html, integer underflow means subtracting a value from a negative signed value to get positive value (for example with 2 bit system, b10[-2] - b01 [1] = b10 + b10 + 1 = b01 = +1). I used the fact that in 2's complement system, subtraction is addition with bit reversals + 1.
Unsigned undeflow should be different from the integer underflow because the same operation results in the correct one (for example b10[2] - b01[1] = b10 + b10 + 1 = b01 = +1). But I'm not sure what makes the unsigned underflow condition. I also can't see how this has something to do with the condition when subtraction produced a borrow
.
Added
I kinda understand that unsigned underflow occurs when b00 [0] - b01[1] = b00 + b10 + 1 = b11 = 3. But it's confusing to understand because it's unsigned underflow but doesn't seem to produce a borrow (no carry generated) -- From John Bollinger's answer A "borrow" is the subtraction analogue of a "carry".
Then, borrow is an opposite of a carry?