August
1999 QUESTION 2 Total Marks: 20 Marks |
Click here to access other
questions
SUGGESTED SOLUTIONS |
(a) | Explain how to perform negation in each of the three fixed-point representations sign-modules, one's-complement and two's-complement. | [3] |
sign-modulus: invert
the sign bit; one's-complement: invert every bit; two's-complement: invert every bit, then add 1.
|
||
(b) | Express the number -5 in 4 bits in each of these three representations. | [3] |
sign-modulus: 1101 one's-complement: 1010 two's-complement: 1011
|
||
(c) | Give one advantage of one's-complement and two's-complement representations over sign-modules. | [1] |
Subtraction is simple
(negate then add).
|
||
(d) | Give one advantage of one's-complement representation over two's-complement. | [1] |
The range is
symmetric.
|
||
(e) | Give one advantage of two's-complement representation over one's-complement. | [1] |
There is a unique
zero.
|
||
(f) | Explain how to convert a multi-digit decimal number into binary-coded decimal and back again, and how to add two multi-digit BCD numbers. | [3] |
To convert from
decimal to BCD, convert each decimal digit to a 4-bit binary value, and concatenate these
binary sequences. To convert back again, reverse this process (split the binary sequence
into 4-bit chunks, convert each to a decimal digit, and concatenate the digits). To add in
BCD, add in 4-bit chunks from the least significant end; and partial sum over 9 results in
a carry to the next chunk.
|
||
(g) | Express the numbers B.AD16
and -1.238 in normalized floating-point format, using an 11-bit mantissa and
5-bit exponent, each in two's-complement format.
|
[4] |
The number B.AD16: B.AD16 = 1011.1010 11012 = 0.101 1101 0112 x24 = 0 101 1101 011 0 0100 The number -1.238:
-1.238
|
||
(h) | Add the above two numbers, and give the result
in the same floating-point format.
|
[4] |
The number with the
smaller exponent(namely the second operand) must be rescaled to ![]() Now the mantissae may be added together:
0
101 1101 011
|