move connect_in function to PrevControl
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 19 Mar 2019 04:15:33 +0000 (04:15 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 19 Mar 2019 04:15:33 +0000 (04:15 +0000)
src/add/example_buf_pipe.py

index 6d42c1cc6411d7440922bd5f6a6d19c12dff9f41..411380016839dadf96ec9e5b390419236d7130df 100644 (file)
@@ -59,6 +59,15 @@ class PrevControl:
         self.i_valid = Signal(name="p_i_valid") # >>in
         self.o_ready = Signal(name="p_o_ready") # <<out
 
+    def connect_in(self, prev):
+        """ helper function to connect stage to an input source.  do not
+            use to connect stage-to-stage!
+        """
+        return [self.i_valid.eq(prev.i_valid),
+                prev.o_ready.eq(self.o_ready),
+                eq(self.data, prev.data),
+               ]
+
 
 class NextControl:
     """ contains the signals that go *to* the next stage (both in and out)
@@ -150,10 +159,7 @@ class BufferedPipeline:
         """ helper function to connect stage to an input source.  do not
             use to connect stage-to-stage!
         """
-        return [self.p.i_valid.eq(prev.p.i_valid),
-                prev.p.o_ready.eq(self.p.o_ready),
-                eq(self.p.data, prev.p.data),
-               ]
+        return self.p.connect_in(prev.p)
 
     def connect_out(self, nxt):
         """ helper function to connect stage to an output source.  do not