From: Luke Kenneth Casson Leighton Date: Wed, 27 Feb 2019 12:20:51 +0000 (+0000) Subject: put exponent > 126 logic in FPNumBase, use it in norm module X-Git-Tag: ls180-24jan2020~1817 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5dc0c2c2366eb9c51d25cf75fb9d6f6184bd7673;p=ieee754fpu.git put exponent > 126 logic in FPNumBase, use it in norm module --- diff --git a/src/add/fpbase.py b/src/add/fpbase.py index 242f41d8..c15112a9 100644 --- a/src/add/fpbase.py +++ b/src/add/fpbase.py @@ -96,6 +96,7 @@ class FPNumBase: self.is_overflowed = Signal(reset_less=True) self.is_denormalised = Signal(reset_less=True) self.exp_128 = Signal(reset_less=True) + self.exp_gt_n126 = Signal(reset_less=True) self.exp_gt127 = Signal(reset_less=True) self.exp_n127 = Signal(reset_less=True) self.exp_n126 = Signal(reset_less=True) @@ -110,6 +111,7 @@ class FPNumBase: m.d.comb += self.is_overflowed.eq(self._is_overflowed()) m.d.comb += self.is_denormalised.eq(self._is_denormalised()) m.d.comb += self.exp_128.eq(self.e == self.P128) + m.d.comb += self.exp_gt_n126.eq(self.e > self.N126) m.d.comb += self.exp_gt127.eq(self.e > self.P127) m.d.comb += self.exp_n127.eq(self.e == self.N127) m.d.comb += self.exp_n126.eq(self.e == self.N126) diff --git a/src/add/nmigen_add_experiment.py b/src/add/nmigen_add_experiment.py index 360e2939..ac201515 100644 --- a/src/add/nmigen_add_experiment.py +++ b/src/add/nmigen_add_experiment.py @@ -300,8 +300,8 @@ class FPNorm1Mod: m.submodules.norm1_out_z = self.out_z m.d.comb += self.out_z.copy(self.in_z) m.d.comb += self.out_of.copy(self.in_of) - m.d.comb += self.out_norm.eq((self.in_z.m[-1] == 0) & \ - (self.in_z.e > self.in_z.N126)) + m.d.comb += self.out_norm.eq((self.in_z.m_msbzero) & \ + (self.in_z.exp_gt_n126)) with m.If(self.out_norm): m.d.comb += [ self.out_z.e.eq(self.in_z.e - 1), # DECREASE exponent