(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.
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-
Get Answers For Free
Most questions answered within 1 hours.