From 1ce0996c90fe2c2134c97e5cae44c89c66ecd6c5 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sun, 16 Jun 2019 12:51:48 +0100 Subject: [PATCH] make overflow roundz a property (Overflow no longer a module) --- src/ieee754/fpadd/add1.py | 2 +- src/ieee754/fpcommon/fpbase.py | 10 ++++------ src/ieee754/fpcommon/postnormalise.py | 6 +++--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/ieee754/fpadd/add1.py b/src/ieee754/fpadd/add1.py index 12054312..408b6075 100644 --- a/src/ieee754/fpadd/add1.py +++ b/src/ieee754/fpadd/add1.py @@ -35,7 +35,7 @@ class FPAddStage1Mod(FPState, Elaboratable): """ links module to inputs and outputs """ m.submodules.add1 = self - m.submodules.add1_out_overflow = self.o.of + #m.submodules.add1_out_overflow = self.o.of m.d.comb += self.i.eq(i) diff --git a/src/ieee754/fpcommon/fpbase.py b/src/ieee754/fpcommon/fpbase.py index b62a1153..6f14f5b1 100644 --- a/src/ieee754/fpcommon/fpbase.py +++ b/src/ieee754/fpcommon/fpbase.py @@ -569,7 +569,7 @@ class Overflow: #(Elaboratable): self.sticky = Signal(reset_less=True) # tot[0] self.m0 = Signal(reset_less=True) # mantissa zero bit - self.roundz = Signal(reset_less=True) + #self.roundz = Signal(reset_less=True) def __iter__(self): yield self.guard @@ -583,11 +583,9 @@ class Overflow: #(Elaboratable): self.sticky.eq(inp.sticky), self.m0.eq(inp.m0)] - def elaborate(self, platform): - m = Module() - m.d.comb += self.roundz.eq(self.guard & \ - (self.round_bit | self.sticky | self.m0)) - return m + @property + def roundz(self): + return self.guard & (self.round_bit | self.sticky | self.m0) class FPBase: diff --git a/src/ieee754/fpcommon/postnormalise.py b/src/ieee754/fpcommon/postnormalise.py index c45bf1e9..1d9ee94f 100644 --- a/src/ieee754/fpcommon/postnormalise.py +++ b/src/ieee754/fpcommon/postnormalise.py @@ -61,13 +61,13 @@ class FPNorm1ModSingle(Elaboratable): m.d.comb += self.o.roundz.eq(of.roundz) #m.submodules.norm1_out_z = self.o.z - m.submodules.norm1_out_overflow = of + #m.submodules.norm1_out_overflow = of #m.submodules.norm1_in_z = self.i.z - m.submodules.norm1_in_overflow = self.i.of + #m.submodules.norm1_in_overflow = self.i.of i = self.ispec() m.submodules.norm1_insel_z = insel_z = FPNumBase(i.z) - m.submodules.norm1_insel_overflow = i.of + #m.submodules.norm1_insel_overflow = i.of espec = (len(insel_z.e), True) ediff_n126 = Signal(espec, reset_less=True) -- 2.30.2