I understand that it takes 4A and subtracts it from B but the two appended 1s that are added to B make it difficult for me to understand. What am I subtracting from 2A? 1B1?
I couldn't find any examples with similar inputs either. The answer key says it's supposed to be 2B but I do not think they are similar in any way, unless there is something I am missing?
Maybe this example with specific values will clarify the situation?
A
is multiplied by 4: 4A
.
B
is inverted 63 - B
, multiplied by 2 and added 128 + 1 = 129
: 2(63 - B) + 129 = 255 - 2B
. If we consider these 1s as part of an inversion, that will lead to the same result: 255 – 2B
.
The first adder result taking into account Cin
: 255 – 2B + 4A + 1 = 256 - 2B + 4A
. Since it is 8-bit, that leaves 4A - 2B
.
The second adder subtracts 1 from the result if it is negative.