Sorta working FP renormalization in cordic
[ieee754fpu.git] / src / ieee754 / cordic / pipe_data.py
index 493331b0977977f856a692561e2296c868edecf8..83690e8d7656f480a36188211ca3cb40e6979078 100644 (file)
@@ -1,5 +1,7 @@
 from nmigen import Signal, Const
 from nmutil.dynamicpipe import SimpleHandshakeRedir
+from ieee754.fpcommon.fpbase import Overflow, FPNumBaseRecord
+from ieee754.fpcommon.getop import FPPipeContext
 import math
 
 
@@ -16,6 +18,25 @@ class CordicInitialData:
         return [self.z0.eq(i.z0)]
 
 
+class CordicOutputData:
+
+    def __init__(self, pspec, e_extra=False):
+        width = pspec.width
+        self.x = FPNumBaseRecord(width, False, e_extra, name="x")
+        self.y = FPNumBaseRecord(width, False, e_extra, name="y")
+        self.ctx = FPPipeContext(pspec)
+        self.muxid = self.ctx.muxid
+
+    def __iter__(self):
+        yield from self.x
+        yield from self.y
+        yield from self.ctx
+
+    def eq(self, i):
+        return [self.x.eq(i.x), self.y.eq(i.y),
+                self.ctx.eq(i.ctx)]
+
+
 class CordicData:
 
     def __init__(self, pspec):