Answer the following questions: 1) Use the 16-bit format depicted below (referre
ID: 3916081 • Letter: A
Question
Answer the following questions:
1) Use the 16-bit format depicted below (referred to as fpx) to perform the following:
a) Convert ED80 from fpx to decimal – Use answer from assignment 5.
b) Convert 1.745 * 10–3 from decimal to fpx - Use answer from assignment 5.
c) Add two fpx numbers (7780 + 6F00): You have to convert the mantissas to 2’s complement, ad and then convert back to sign and magnitude.
d) Subtract two fpx numbers (7300 – 78F0): You have to convert the mantissas to 2’s complement, subtract and then convert back to sign and magnitude.
e) Multiply two fpx numbers (7500 * A70A);
In addition, assume that the exponent of +16 is not reserved for exceptions
2) Assume that a device that generates random numbers is connected to the MIPS I/O space located at offset of 0x40 from the I/O base address. When the device is ready it can supply a random 32-bit integer.
Write a MIPS polling routine that checks if the device is ready and once it is ready it reads the current random number.
Explanation / Answer
Bits layout in 16 bit (Half Precision) floating point format is as follows.
(1 Sign bit, 5 Exponent bits, 10 Fraction/Significand bits)
Exponent bias (b) = 15
In the response below, suffixes H and B are used to indicate hexadecimal and binary values respectively.
a) Convert ED80 from fpx to decimal
(ED80)H = (1110 1101 1000 0000)B
Sign bit (S) = 1
Exponent bits (e) = (11011)B = 27
Fraction bits (f) = (01 1000 0000)B
Equivalent decimal number = (-1)^S * 2^(e-b) * (1.f)B
= (-1)^1 * 2^(27-15) * (1.0110000000)B
= - 2^12 * (1.0110000000)B
= - (1011000000000)B
= - (4096+1024+512)
= - 5632 or -5632.00
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.