2
$\begingroup$

Note: This problem is from Introduction to Computing Systems: From Bits and Beyond(2nd) edition, 3.15, page 86.

The Problem:

enter image description here

I was able to do the problem and ended up with sum being 0010 and the last carry bit of 1.

Using a tow bit full adder, would the last carry bit be appended to the beginning of the sum, making it 10010(18 the correct answer with decimal alue addition)) or does it get omitted, making the answers different?

If it does get appended, how would I justify the answers are the same? The full adder takes account carry bits and binary bits?

$\endgroup$
  • $\begingroup$ Don't use images as main content of your post. This makes your question impossible to search and inaccessible to the visually impaired; we don't like that. Please transcribe text and mathematics (note that you can use LaTeX) and don't forget to give proper attribution to your sources! $\endgroup$ – D.W. May 17 '15 at 16:46
2
$\begingroup$

Addition on $w$-bit registers (or memory locations) is effectively addition modulo $2^w$, that is the carry bit is thrown away. However, on x86 CPUs at least, before getting thrown away, it is copied to the carry flag or overflow flag (so the carry bit is actually not thrown away). An additional instruction, "add with carry", adds two inputs together with the carry flag. Using these instructions, you can (1) detect overflow (which happens if the carry flag is set), and (2) implement addition on multiples on $w$ bits. For example, suppose you want to add two integers $x_1x_0$ and $y_1y_0$, where $x_i,y_i$ is each a $w$-bit memory location. You first add $x_0$ and $y_0$, and then add $x_1$ and $y_1$ along with the carry.

To answer your specific problem, for 4-bit wide registers, 0111+1011=0010, and additionally the carry flag is set, if any.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.