Add in FPPipeContext to the cordic pipeline
authorMichael Nolan <mtnolan2640@gmail.com>
Tue, 5 May 2020 18:08:58 +0000 (14:08 -0400)
committerMichael Nolan <mtnolan2640@gmail.com>
Tue, 5 May 2020 18:08:58 +0000 (14:08 -0400)
src/ieee754/cordic/fp_pipe_init_stages.py
src/ieee754/cordic/pipe_data.py
src/ieee754/cordic/renormalize.py
src/ieee754/cordic/sin_cos_pipe_stage.py

index 2d5387131de5455f4813712ab1270216e880eaf5..f03e3731bd62a518bf3bdb40f2df4d20186847fe 100644 (file)
@@ -65,5 +65,5 @@ class FPCordicConvertFixed(PipeModBase):
                                  ~z_shifted + 1,
                                  z_shifted))
 
+        comb += self.o.ctx.eq(self.i.ctx)
         return m
-
index d83dbe7b9d41a6cccbb0359bcbb126f4dfa7eebb..c9b24bcd4a110c3fa3d38158de141d9c6944575a 100644 (file)
@@ -10,12 +10,15 @@ class CordicInitialData:
     def __init__(self, pspec):
         ZMAX = pspec.ZMAX
         self.z0 = Signal(range(-ZMAX, ZMAX), name="z")     # denormed result
+        self.ctx = FPPipeContext(pspec)
+        self.muxid = self.ctx.muxid
 
     def __iter__(self):
         yield self.z0
+        yield from self.ctx
 
     def eq(self, i):
-        return [self.z0.eq(i.z0)]
+        return [self.z0.eq(i.z0), self.ctx.eq(i.ctx)]
 
 
 class CordicOutputData:
@@ -46,14 +49,18 @@ class CordicData:
         self.x = Signal(range(-M, M+1), name="x")   # operand a
         self.y = Signal(range(-M, M+1), name="y")   # operand b
         self.z = Signal(range(-ZMAX, ZMAX), name="z")     # denormed result
+        self.ctx = FPPipeContext(pspec)
+        self.muxid = self.ctx.muxid
 
     def __iter__(self):
         yield self.x
         yield self.y
         yield self.z
+        yield from self.ctx
 
     def eq(self, i):
-        ret = [self.z.eq(i.z), self.x.eq(i.x), self.y.eq(i.y)]
+        ret = [self.z.eq(i.z), self.x.eq(i.x), self.y.eq(i.y),
+               self.ctx.eq(i.ctx)]
         return ret
 
 
index e799d234a83b0962134bc0f3f3dccf4cafec4c0d..0a784074bfe7aab9fbee614f2f6a5d4f3ce30cba 100644 (file)
@@ -38,7 +38,7 @@ class Norm(Elaboratable):
         comb += numrec.m.eq(normalized[-(numrec.m_width+1):-1])
         comb += numrec.s.eq(sign)
         comb += numrec.e.eq(-count+1)
-        
+
         comb += self.sig_out.eq(numrec.create2(numrec.s, numrec.e, numrec.m))
         return m
 
@@ -67,4 +67,5 @@ class CordicRenormalize(PipeModBase):
         comb += self.o.x.eq(normx.sig_out)
         comb += self.o.y.eq(normy.sig_out)
 
+        comb += self.o.ctx.eq(self.i.ctx)
         return m
index 94916abfbd5d49f9f988bac0e39c7725a816d1c6..35af6e288465bf10dbac8e65c35971f009fd310f 100644 (file)
@@ -28,6 +28,8 @@ class CordicInitialStage(PipeModBase):
         comb += self.o.x.eq(X0)
         comb += self.o.y.eq(0)
         comb += self.o.z.eq(self.i.z0)
+
+        comb += self.o.ctx.eq(self.i.ctx)
         return m
 
 
@@ -68,4 +70,6 @@ class CordicStage(PipeModBase):
             comb += self.o.y.eq(self.i.y - dy)
             comb += self.o.z.eq(self.i.z + dz)
 
+
+        comb += self.o.ctx.eq(self.i.ctx)
         return m