experimenting: something odd with dynamic ready/valid override
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 5 Apr 2019 18:22:37 +0000 (19:22 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 5 Apr 2019 18:22:37 +0000 (19:22 +0100)
src/add/singlepipe.py
src/add/test_buf_pipe.py

index 415f4b75df63570314867ee719218fd68e6b2de1..9f66de42d434f0af0492ac184c2c4d502572dae1 100644 (file)
@@ -514,7 +514,7 @@ class ControlBase:
             res += self.n.o_data
         return res
 
-    def elaborate(self, platform):
+    def _elaborate(self, platform):
         """ handles case where stage has dynamic ready/valid functions
         """
         m = Module()
@@ -523,6 +523,10 @@ class ControlBase:
 
         # when the pipeline (buffered or otherwise) says "ready",
         # test the *stage* "ready".
+        m.d.comb += self.p.s_o_ready.eq(self.p._o_ready)
+        m.d.comb += self.n.s_o_valid.eq(self.n._o_valid)
+        return m
+
         with m.If(self.p._o_ready):
             m.d.comb += self.p.s_o_ready.eq(self.stage.p_o_ready)
         with m.Else():
@@ -577,7 +581,7 @@ class BufferedPipeline(ControlBase):
 
     def elaborate(self, platform):
 
-        self.m = ControlBase.elaborate(self, platform)
+        self.m = ControlBase._elaborate(self, platform)
 
         result = self.stage.ospec()
         r_data = self.stage.ospec()
@@ -675,7 +679,7 @@ class UnbufferedPipeline(ControlBase):
         self.n.o_data = stage.ospec() # output type
 
     def elaborate(self, platform):
-        self.m = ControlBase.elaborate(self, platform)
+        self.m = ControlBase._elaborate(self, platform)
 
         data_valid = Signal() # is data valid or not
         r_data = self.stage.ispec() # input type
index 192cc32640f97b8350a29208c37d2a235a9a59d2..db0b364acfde276a23f409e7da6f2f781ca9316d 100644 (file)
@@ -608,13 +608,13 @@ class ExampleStageDelayCls(StageCls):
         return i + 1
 
 
-class ExampleBufDelayedPipe(BufferedPipeline):
+class ExampleBufDelayedPipe(UnbufferedPipeline):
     """ an example of how to use the buffered pipeline.
     """
 
     def __init__(self):
         stage = ExampleStageDelayCls()
-        BufferedPipeline.__init__(self, stage, stage_ctl=True)
+        UnbufferedPipeline.__init__(self, stage, stage_ctl=False)
 
 
 class ExampleBufPipe3(ControlBase):
@@ -623,7 +623,7 @@ class ExampleBufPipe3(ControlBase):
     """
 
     def elaborate(self, platform):
-        m = Module()
+        m = ControlBase._elaborate(self, platform)
 
         pipe1 = ExampleBufPipe()
         pipe2 = ExampleBufDelayedPipe()