pass through exponent extra bits so that normalisation works on 32-to-16 cvt
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 6 Jul 2019 09:51:46 +0000 (10:51 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 6 Jul 2019 09:51:46 +0000 (10:51 +0100)
src/ieee754/fcvt/pipeline.py
src/ieee754/fpcommon/normtopack.py
src/ieee754/fpcommon/postnormalise.py

index 734f92c8ae081fcee5b74489d5f8a997c54bd5c9..b72c25517da95702f26b1cc27736fc8a62046a4a 100644 (file)
@@ -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])
 
index cb4a8bcd6187920e4f74ce7c9a815b5caea0d266..c78c1e95ed52a1b805a7dd7180a8b39b500ce207 100644 (file)
@@ -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)
index 58ce1e669f3e94eb679a2d6ada8be9c52fcba74f..2bf5727880dd23dfba7701c8a201ee44ecd0065b 100644 (file)
@@ -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)