String str
representing a floating point
value (no E component) consisting of an optional sign,
digits, and a decimal point.
sign
, the integer part, and the fraction part.
1.
fract x
2
exp.
sign
, exp
, and
fract
to form a binary int i
value in the
form of a 32-bit IEEE 754 standard floating point value.
int i
to a float f
using
float f = Float.intBitsToFloat(i)
.
float
value (f
) with that
obtained by float g = Float.parseFloat(str)
.
g
right away,
mapping it to integer bits using
int i = Float.floatToIntBits(g)
,
and then operating on the bits to eventually get back to a
String strout
which you comapre with the original
str
.
This assignment will be due on: Thursday, 28 February 2008.
Your task are:
converter.lgi
/
converter.lgi
file.
Make sure that your name is on the submission (either written or
in electronic form) so that you will get credit for your work.
This assignment will be due on: Thursday, 6 March 2008.
Notes on register usage:
I was able to develop the Pmul
function and the
mul
macro.
They are in the file
multiply.asm.
The mul
macro takes source register 1 (rs1)
as the first argument,
either source register 2 (rs2) or a (simm13)
value as the second argument,
and the destination register (rd) as the third argument.
This is the same usage as the rest of the arithmetic instructions.
Note that the Pmul
function uses register %r8 to pass
the multiplicand and register %r9 to pass the multiplier to the function.
The low order part of the product is returned in register %r8.
The use of only the low order part of the product matches the behavior of
C, C++, and Java.
These registers are set by the caller (and read by the caller on return) and
therefore do not need to be saved/restored by the function.
The function uses the local registers %r16 - %r20 to perform the calculations.
Since these are in the local registers group it is assumed that they do not
need to be saved/restored within the function code.
I modified my version of Dot.asm
to include the mul
macro and Pmul
function and tested it out.
The results match those of the updated (to change the + to a *)
DotTest.java
program.
This assignment will be due on: Thursday, 8 May 2008.