[libre-riscv-dev] [Bug 74] preliminary exploratory software emulation of FP SQRT
bugzilla-daemon at libre-riscv.org
bugzilla-daemon at libre-riscv.org
Tue Apr 30 21:55:42 BST 2019
http://bugs.libre-riscv.org/show_bug.cgi?id=74
--- Comment #39 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
* moved normalise up to where it's used (above fsqrt_test)
* added lowbits arg (was missed out)
* called normalise
* seems to work on the 8-or-so examples so far.
+#normalization function
+def normalise(s, m, e, lowbits):
+ if (lowbits >= 2):
+ m += 1
+ if get_mantissa(m) == ((1<<24)-1):
+ e += 1
+ return s, m, e
+
+
def fsqrt_test(x):
xbits = x.bits
@@ -99,6 +108,9 @@ def fsqrt_test(x):
sm >>= 2
sm = get_mantissa(sm)
#sm += 2
+
+ s, sm, se = normalise(s, sm, se, lowbits)
+
print("our sqrt", s, se, sm, hex(sm), bin(sm), "lowbits", lowbits,
"rem", hex(sr))
if lowbits >= 2:
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-riscv-dev
mailing list