Question

(2marks) Consider the following 12-bit numbers below. Assuming they are unsigned, add them to produce a...

(2marks) Consider the following 12-bit numbers below. Assuming they are unsigned, add them to produce a 12-bit sum the same way a computer would. Also, state whether or not an error results using the same method a computer would.

110010001001

011010001101

Repeat the addition and error detection from the previous question, but this time assuming that the numbers are in two’s complement representation. Also: without converting to decimal, but simply by intuition, i.e. looking at the three numbers and applying your knowledge of two’s complement, justify that the result of the computer’s error detection process is what you would expect.

Homework Answers

Answer #1

Assuming the numbers are unsigned, the binary addition would be -

1 1 0 0 1 0 0 0 1 0 0 1

+ 0 1 1 0 1 0 0 0 1 1 0 1

= 0 0 1 1 0 0 0 1 0 1 1 0 (with a carry of 1)

Since the result has overflowed and cannot be kept in 12 bits, overflow error has occurred here, and if only 12 bits are considered answer will be wrong. While if carry is taken into account, the answer would be correct but would require 13 bits to be represented.

Now, let's consider the numbers to be signed. Then the MSB(Most significant bit) of both the numbers will represent its sign. Hence the number would be of 11 bits + 1-bit sign. The addition is performed in the same way as for unsigned, but we ignore the carry of the result.

So the result will be - 0 0 1 1 0 0 0 1 0 1 1 0.

In this case, the result is correct. Now without converting numbers to decimal we can identify the correctness as-

  • Ignoring the signed bits, the values of the next 2 bits are - 10 and 11. We know that 11>10. Hence the second number will be greater than the first number. Since the second number is positive(signed bit=0), and our result has 0 as MSB, so result is also a positive number. Hence, we say that the result is correct.
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT