From c98a9a9dcbfc94c6fe6262580432f74d89dd1ad2 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 14 Feb 2019 10:53:14 +0000 Subject: [PATCH] move +127 for exponent bias into FPNum.create --- src/add/nmigen_add_experiment.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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(): -- 2.30.2