From: Luke Kenneth Casson Leighton Date: Sat, 6 Jul 2019 09:51:46 +0000 (+0100) Subject: pass through exponent extra bits so that normalisation works on 32-to-16 cvt X-Git-Tag: ls180-24jan2020~908 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4b48990266d7f00daeb32bd4f833cf99a2862a0e;p=ieee754fpu.git pass through exponent extra bits so that normalisation works on 32-to-16 cvt --- diff --git a/src/ieee754/fcvt/pipeline.py b/src/ieee754/fcvt/pipeline.py index 734f92c8..b72c2551 100644 --- a/src/ieee754/fcvt/pipeline.py +++ b/src/ieee754/fcvt/pipeline.py @@ -167,7 +167,7 @@ class FPCVTBasePipe(ControlBase): def __init__(self, in_pspec, out_pspec): ControlBase.__init__(self) self.pipe1 = FPCVTSpecialCasesDeNorm(in_pspec, out_pspec) - self.pipe2 = FPNormToPack(out_pspec) + self.pipe2 = FPNormToPack(out_pspec, e_extra=True) self._eqs = self.connect([self.pipe1, self.pipe2]) diff --git a/src/ieee754/fpcommon/normtopack.py b/src/ieee754/fpcommon/normtopack.py index cb4a8bcd..c78c1e95 100644 --- a/src/ieee754/fpcommon/normtopack.py +++ b/src/ieee754/fpcommon/normtopack.py @@ -16,14 +16,15 @@ from .pack import FPPackData, FPPackMod class FPNormToPack(FPState, SimpleHandshake): - def __init__(self, pspec): + def __init__(self, pspec, e_extra=False): FPState.__init__(self, "normalise_1") print ("normtopack", pspec) self.pspec = pspec + self.e_extra = e_extra SimpleHandshake.__init__(self, self) # pipeline is its own stage def ispec(self): - return FPAddStage1Data(self.pspec) + return FPAddStage1Data(self.pspec, e_extra=self.e_extra) def ospec(self): return FPPackData(self.pspec) # FPPackMod @@ -33,7 +34,7 @@ class FPNormToPack(FPState, SimpleHandshake): """ # Normalisation, Rounding Corrections, Pack - in a chain - nmod = FPNorm1ModSingle(self.pspec) + nmod = FPNorm1ModSingle(self.pspec, e_extra=self.e_extra) rmod = FPRoundMod(self.pspec) cmod = FPCorrectionsMod(self.pspec) pmod = FPPackMod(self.pspec) diff --git a/src/ieee754/fpcommon/postnormalise.py b/src/ieee754/fpcommon/postnormalise.py index 58ce1e66..2bf57278 100644 --- a/src/ieee754/fpcommon/postnormalise.py +++ b/src/ieee754/fpcommon/postnormalise.py @@ -33,13 +33,14 @@ class FPNorm1Data: class FPNorm1ModSingle(Elaboratable): - def __init__(self, pspec): + def __init__(self, pspec, e_extra=False): self.pspec = pspec + self.e_extra = e_extra self.i = self.ispec() self.o = self.ospec() def ispec(self): - return FPAddStage1Data(self.pspec) + return FPAddStage1Data(self.pspec, e_extra=self.e_extra) def ospec(self): return FPNorm1Data(self.pspec)