From: Luke Kenneth Casson Leighton Date: Thu, 14 Feb 2019 14:26:11 +0000 (+0000) Subject: add and use is_overflowed function X-Git-Tag: ls180-24jan2020~1994 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5113de1faa5b5d80f321dea5736b9fcc5806b3be;p=ieee754fpu.git add and use is_overflowed function --- diff --git a/src/add/nmigen_add_experiment.py b/src/add/nmigen_add_experiment.py index 09f2725a..24e87428 100644 --- a/src/add/nmigen_add_experiment.py +++ b/src/add/nmigen_add_experiment.py @@ -77,6 +77,9 @@ class FPNum: def is_zero(self): return (self.e == -127) & (self.m == 0) + def is_overflowed(self): + return (self.e < 127) + class FPADD: def __init__(self, width): @@ -321,14 +324,8 @@ class FPADD: ] with m.If((z.e == -126) & (z.m[23] == 0)): m.d.sync += z.v[23:31].eq(0) - with m.If((z.e == -126) & (z.m[0:23] == 0)): - m.d.sync += z.v[23:31].eq(0) - with m.If(z.e > 127): - m.d.sync += [ - z.v[0:22].eq(0), - z.v[23:31].eq(255), - z.v[31].eq(z.s), - ] + with m.If(z.is_overflowed()): + m.d.sync += z.inf(0) # ****** # put_z stage