move FPPackData to separate module
[ieee754fpu.git] / src / ieee754 / fpcommon / pack.py
index 4f906bd332fbab3ba97746cdbfb01bfca0bdafe0..d53533b1ef3d747c8d63d33d5943669cadf0acb6 100644 (file)
@@ -9,33 +9,7 @@ from nmutil.pipemodbase import PipeModBase
 from ieee754.fpcommon.fpbase import FPNumBaseRecord, FPNumBase
 from ieee754.fpcommon.roundz import FPRoundData
 from ieee754.fpcommon.getop import FPPipeContext
-
-
-class FPPackData:
-
-    def __init__(self, pspec):
-        width = pspec.width
-        self.z = Signal(width, reset_less=True)    # result
-        self.ctx = FPPipeContext(pspec)
-
-        # this is complicated: it's a workaround, due to the
-        # array-indexing not working properly in nmigen.
-        # self.ports() is used to access the ArrayProxy objects by name,
-        # however it doesn't work recursively.  the workaround:
-        # drop the sub-objects into *this* scope and they can be
-        # accessed / set.  it's horrible.
-        self.muxid = self.ctx.muxid
-        self.op = self.ctx.op
-
-    def eq(self, i):
-        return [self.z.eq(i.z), self.ctx.eq(i.ctx)]
-
-    def __iter__(self):
-        yield self.z
-        yield from self.ctx
-
-    def ports(self):
-        return list(self)
+from ieee754.fpcommon.packdata import FPPackData
 
 
 class FPPackMod(PipeModBase):