From: Luke Kenneth Casson Leighton Date: Sat, 13 Jul 2019 08:45:25 +0000 (+0100) Subject: add name to Overflow class, also recreate OverflowMod X-Git-Tag: ls180-24jan2020~853 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fced120d60faa951a2392d640c5052e17934ff4b;p=ieee754fpu.git add name to Overflow class, also recreate OverflowMod --- diff --git a/src/ieee754/fpcommon/fpbase.py b/src/ieee754/fpcommon/fpbase.py index 5e086fe1..02a85424 100644 --- a/src/ieee754/fpcommon/fpbase.py +++ b/src/ieee754/fpcommon/fpbase.py @@ -588,11 +588,13 @@ class FPOpOut(NextControl): class Overflow: # (Elaboratable): - def __init__(self): - self.guard = Signal(reset_less=True) # tot[2] - self.round_bit = Signal(reset_less=True) # tot[1] - self.sticky = Signal(reset_less=True) # tot[0] - self.m0 = Signal(reset_less=True) # mantissa zero bit + def __init__(self, name=None): + if name is None: + name = "" + self.guard = Signal(reset_less=True, name=name+"guard") # tot[2] + self.round_bit = Signal(reset_less=True, name=name+"round") # tot[1] + self.sticky = Signal(reset_less=True, name=name+"sticky") # tot[0] + self.m0 = Signal(reset_less=True, name=name+"m0") # mantissa bit 0 #self.roundz = Signal(reset_less=True) @@ -613,6 +615,26 @@ class Overflow: # (Elaboratable): return self.guard & (self.round_bit | self.sticky | self.m0) +class OverflowMod(Elaboratable, Overflow): + def __init__(self, name=None): + Overflow.__init__(self, name) + if name is None: + name = "" + self.roundz_out = Signal(reset_less=True, name=name+"roundz_out") + + def __iter__(self): + yield from Overflow.__iter__(self) + yield self.roundz_out + + def eq(self, inp): + return [self.roundz_out.eq(inp.roundz_out)] + Overflow.eq(self) + + def elaborate(self, platform): + m = Module() + m.d.comb += self.roundz_out.eq(self.roundz) + return m + + class FPBase: """ IEEE754 Floating Point Base Class