derive ExampleBufPipe2 from PipelineBase
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 26 Mar 2019 12:47:35 +0000 (12:47 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 26 Mar 2019 12:47:35 +0000 (12:47 +0000)
src/add/test_buf_pipe.py

index 91359f65300d55ba057bf9f32859376414b530d5..a31fbf132fc0541417981d53ec9e79e640afa6bc 100644 (file)
@@ -7,7 +7,7 @@ from example_buf_pipe import ExampleBufPipe, ExampleBufPipeAdd
 from example_buf_pipe import ExamplePipeline, UnbufferedPipeline
 from example_buf_pipe import ExampleStageCls
 from example_buf_pipe import PrevControl, NextControl, BufferedPipeline
-from example_buf_pipe import StageChain
+from example_buf_pipe import StageChain, PipelineBase
 
 from random import randint
 
@@ -262,7 +262,7 @@ def testbench4(dut):
                 break
 
 
-class ExampleBufPipe2:
+class ExampleBufPipe2(PipelineBase):
     """
         connect these:  ------|---------------|
                               v               v
@@ -271,17 +271,15 @@ class ExampleBufPipe2:
         p_i_data  >>in  pipe1 p_i_data  out>> n_o_data  >>in  pipe2
     """
     def __init__(self):
-        self.pipe1 = ExampleBufPipe()
-        self.pipe2 = ExampleBufPipe()
+        PipelineBase.__init__(self)
 
-        # input
-        self.p = PrevControl()
+        # input / output
         self.p.i_data = Signal(32) # >>in - comes in from the PREVIOUS stage
-
-        # output
-        self.n = NextControl()
         self.n.o_data = Signal(32) # out>> - goes out to the NEXT stage
 
+        self.pipe1 = ExampleBufPipe()
+        self.pipe2 = ExampleBufPipe()
+
     def elaborate(self, platform):
         m = Module()
         m.submodules.pipe1 = self.pipe1