move FPID to fpbase
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 29 Mar 2019 11:43:19 +0000 (11:43 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 29 Mar 2019 11:43:19 +0000 (11:43 +0000)
src/add/fpbase.py
src/add/nmigen_add_experiment.py

index 3886332aeb528606a828c544d7fc6a91e28cf9cc..30c3a5c47e288c8224f3dc0acd8da7fd8a765fd1 100644 (file)
@@ -614,4 +614,18 @@ class FPState(FPBase):
             setattr(self, k, v)
 
 
+class FPID:
+    def __init__(self, id_wid):
+        self.id_wid = id_wid
+        if self.id_wid:
+            self.in_mid = Signal(id_wid, reset_less=True)
+            self.out_mid = Signal(id_wid, reset_less=True)
+        else:
+            self.in_mid = None
+            self.out_mid = None
+
+    def idsync(self, m):
+        if self.id_wid is not None:
+            m.d.sync += self.out_mid.eq(self.in_mid)
+
 
index 112e7cf291636297f5c2d3bbf354b143949a4462..a86828db4cd3e100efaff8a05e22d8f5e77d0b49 100644 (file)
@@ -14,7 +14,7 @@ from singlepipe import (ControlBase, StageChain, UnbufferedPipeline,
 from multipipe import CombMuxOutPipe
 from multipipe import PriorityCombMuxInPipe
 
-from fpbase import FPState
+from fpbase import FPState, FPID
 from fpcommon.getop import (FPGetOpMod, FPGetOp, FPNumBase2Ops, FPADDBaseData,                              FPGet2OpMod, FPGet2Op)
 from fpcommon.denorm import (FPSCData, FPAddDeNormMod, FPAddDeNorm)
 from fpcommon.postcalc import FPAddStage1Data
@@ -142,21 +142,6 @@ class FPAddSpecialCasesMod:
         return m
 
 
-class FPID:
-    def __init__(self, id_wid):
-        self.id_wid = id_wid
-        if self.id_wid:
-            self.in_mid = Signal(id_wid, reset_less=True)
-            self.out_mid = Signal(id_wid, reset_less=True)
-        else:
-            self.in_mid = None
-            self.out_mid = None
-
-    def idsync(self, m):
-        if self.id_wid is not None:
-            m.d.sync += self.out_mid.eq(self.in_mid)
-
-
 class FPAddSpecialCases(FPState):
     """ special cases: NaNs, infs, zeros, denormalised
         NOTE: some of these are unique to add.  see "Special Operations"