From: Luke Kenneth Casson Leighton Date: Thu, 14 Feb 2019 10:53:14 +0000 (+0000) Subject: move +127 for exponent bias into FPNum.create X-Git-Tag: ls180-24jan2020~2007 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c98a9a9dcbfc94c6fe6262580432f74d89dd1ad2;p=ieee754fpu.git move +127 for exponent bias into FPNum.create --- diff --git a/src/add/nmigen_add_experiment.py b/src/add/nmigen_add_experiment.py index ec604d16..936b4367 100644 --- a/src/add/nmigen_add_experiment.py +++ b/src/add/nmigen_add_experiment.py @@ -25,9 +25,9 @@ class FPNum: def create(self, s, e, m): return [ - self.v[31].eq(s), # sign - self.v[23:31].eq(e), # exp - self.v[0:23].eq(m) # mantissa + self.v[31].eq(s), # sign + self.v[23:31].eq(e + 127), # exp + self.v[0:23].eq(m) # mantissa ] def nan(self, s): @@ -143,17 +143,17 @@ class FPADD: # if a is zero and b zero return signed-a/b with m.Elif(a.is_zero() & b.is_zero()): m.next = "put_z" - m.d.sync += z.create(a.s & b.s, b.e[0:8] + 127, b.m[3:26]) + m.d.sync += z.create(a.s & b.s, b.e[0:8], b.m[3:26]) # if a is zero return b with m.Elif((a.is_zero()): m.next = "put_z" - m.d.sync += z.create(b.s, b.e[0:8] + 127, b.m[3:26]) + m.d.sync += z.create(b.s, b.e[0:8], b.m[3:26]) # if b is zero return a with m.Elif((b.is_zero()): m.next = "put_z" - m.d.sync += z.create(a.s, a.e[0:8] + 127, a.m[3:26]) + m.d.sync += z.create(a.s, a.e[0:8], a.m[3:26]) # Denormalised Number checks with m.Else():