remove buffermode
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 7 Apr 2019 11:26:48 +0000 (12:26 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 7 Apr 2019 11:26:48 +0000 (12:26 +0100)
src/add/singlepipe.py
src/add/test_buf_pipe.py

index e83ba876128d7c7778f8fde7a43cf8edb887c8c0..d7f0972d7b1b6a37b3ba0842a5c118f8c99681ad 100644 (file)
@@ -576,10 +576,9 @@ class BufferedPipeline(ControlBase):
         input may begin to be processed and transferred directly to output.
 
     """
-    def __init__(self, stage, stage_ctl=False, buffermode=True):
+    def __init__(self, stage, stage_ctl=False):
         ControlBase.__init__(self, stage_ctl=stage_ctl)
         self.stage = stage
-        self.buffermode = buffermode
 
         # set up the input and output data
         self.p.i_data = stage.ispec() # input type
@@ -590,8 +589,7 @@ class BufferedPipeline(ControlBase):
         self.m = ControlBase._elaborate(self, platform)
 
         result = self.stage.ospec()
-        if self.buffermode:
-            r_data = self.stage.ospec()
+        r_data = self.stage.ospec()
         if hasattr(self.stage, "setup"):
             self.stage.setup(self.m, self.p.i_data)
 
@@ -609,10 +607,9 @@ class BufferedPipeline(ControlBase):
         # store result of processing in combinatorial temporary
         self.m.d.comb += eq(result, self.stage.process(self.p.i_data))
 
-        if self.buffermode:
-            # if not in stall condition, update the temporary register
-            with self.m.If(self.p.o_ready): # not stalled
-                self.m.d.sync += eq(r_data, result) # update buffer
+        # if not in stall condition, update the temporary register
+        with self.m.If(self.p.o_ready): # not stalled
+            self.m.d.sync += eq(r_data, result) # update buffer
 
         with self.m.If(n_i_ready): # next stage is ready
             with self.m.If(self.p._o_ready): # not stalled
@@ -620,13 +617,12 @@ class BufferedPipeline(ControlBase):
                 self.m.d.sync += [self.n.o_valid.eq(p_i_valid),
                                   eq(self.n.o_data, result), # update output
                             ]
-            if self.buffermode:
-                with self.m.Else(): # p.o_ready is false, and data in buffer
-                    # Flush the [already processed] buffer to the output port.
-                    self.m.d.sync += [self.n.o_valid.eq(1),  # reg empty
-                                  eq(self.n.o_data, r_data), # flush buffer
-                                  self.p._o_ready.eq(1),     # clear stall
-                            ]
+            with self.m.Else(): # p.o_ready is false, and data in buffer
+                # Flush the [already processed] buffer to the output port.
+                self.m.d.sync += [self.n.o_valid.eq(1),  # reg empty
+                              eq(self.n.o_data, r_data), # flush buffer
+                              self.p._o_ready.eq(1),     # clear stall
+                        ]
                 # ignore input, since p.o_ready is also false.
 
         # (n.i_ready) is false here: next stage is ready
index ce54eb4d5f4e6d505fe23c136887e60996bf9b84..bfcd1a407b25bbb4e85b45097ce345032d00ada1 100644 (file)
@@ -592,7 +592,7 @@ class ExampleStageDelayCls(StageCls):
         fashion
     """
 
-    def __init__(self, valid_trigger=3):
+    def __init__(self, valid_trigger=2):
         self.count = Signal(2)
         self.valid_trigger = valid_trigger
 
@@ -627,8 +627,7 @@ class ExampleBufDelayedPipe(BufferedPipeline):
 
     def __init__(self):
         stage = ExampleStageDelayCls(valid_trigger=2)
-        BufferedPipeline.__init__(self, stage, stage_ctl=True,
-                                    buffermode=True)
+        BufferedPipeline.__init__(self, stage, stage_ctl=True)
 
     def elaborate(self, platform):
         m = BufferedPipeline.elaborate(self, platform)