14.06.2015 Views

Power ISA™ Version 2.03 - Power.org

Power ISA™ Version 2.03 - Power.org

Power ISA™ Version 2.03 - Power.org

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Version</strong> <strong>2.03</strong><br />

A.3 Floating-Point Convert from Integer Model<br />

The following describes algorithmically the operation of the Floating Convert From Integer Doubleword instruction.<br />

sign (FRB) 0<br />

exp 63<br />

frac 0:63 (FRB)<br />

If frac 0:63 = 0 then go to Zero Operand<br />

If sign = 1 then frac 0:63 ¬frac 0:63 + 1<br />

Do while frac 0 = 0 /* do the loop 0 times if (FRB) = maximum negative integer */<br />

frac 0:63 frac 1:63 || 0b0<br />

exp exp - 1<br />

End<br />

Round Float(sign,exp,frac 0:63 ,FPSCR RN )<br />

If sign = 0 then FPSCR FPRF “+normal number”<br />

If sign = 1 then FPSCR FPRF “-normal number”<br />

FRT 0 sign<br />

FRT 1:11 exp + 1023 /* exp + bias */<br />

FRT 12:63 frac 1:52<br />

Done<br />

Zero Operand:<br />

FPSCR FR FI 0b00<br />

FPSCR FPRF “+ zero”<br />

FRT 0x0000_0000_0000_0000<br />

Done<br />

Round Float(sign,exp,frac 0:63 ,round_mode):<br />

inc 0<br />

lsb frac 52<br />

gbit frac 53<br />

rbit frac 54<br />

xbit frac 55:63 > 0<br />

If round_mode = 0b00 then /* Round to Nearest */<br />

Do /* comparisons ignore u bits */<br />

If sign || lsb || gbit || rbit || xbit = 0bu11uu then inc 1<br />

If sign || lsb || gbit || rbit || xbit = 0bu011u then inc 1<br />

If sign || lsb || gbit || rbit || xbit = 0bu01u1 then inc 1<br />

End<br />

If round_mode = 0b10 then /* Round toward + Infinity */<br />

Do /* comparisons ignore u bits */<br />

If sign || lsb || gbit || rbit || xbit = 0b0u1uu then inc 1<br />

If sign || lsb || gbit || rbit || xbit = 0b0uu1u then inc 1<br />

If sign || lsb || gbit || rbit || xbit = 0b0uuu1 then inc 1<br />

End<br />

If round_mode = 0b11 then /* Round toward - Infinity */<br />

Do /* comparisons ignore u bits */<br />

If sign || lsb || gbit || rbit || xbit = 0b1u1uu then inc 1<br />

If sign || lsb || gbit || rbit || xbit = 0b1uu1u then inc 1<br />

If sign || lsb || gbit || rbit || xbit = 0b1uuu1 then inc 1<br />

End<br />

frac 0:52 frac 0:52 + inc<br />

If carry_out = 1 then exp exp + 1<br />

FPSCR FR inc<br />

FPSCR FI gbit | rbit | xbit<br />

FPSCR XX FPSCR XX | FPSCR FI<br />

Return<br />

302<br />

<strong>Power</strong> ISA -- Book I

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!