From e7dbad53c6ff7ef14a5f9886e4963733022d9457 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 5 Apr 2019 19:41:33 +0100 Subject: [PATCH] try single pipe for now, not chain --- src/add/singlepipe.py | 3 --- src/add/test_buf_pipe.py | 24 +++++++++++++++++++----- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/add/singlepipe.py b/src/add/singlepipe.py index 9f66de42..5c19fd66 100644 --- a/src/add/singlepipe.py +++ b/src/add/singlepipe.py @@ -523,9 +523,6 @@ 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) diff --git a/src/add/test_buf_pipe.py b/src/add/test_buf_pipe.py index db0b364a..31555635 100644 --- a/src/add/test_buf_pipe.py +++ b/src/add/test_buf_pipe.py @@ -608,13 +608,13 @@ class ExampleStageDelayCls(StageCls): return i + 1 -class ExampleBufDelayedPipe(UnbufferedPipeline): +class ExampleBufDelayedPipe(BufferedPipeline): """ an example of how to use the buffered pipeline. """ def __init__(self): stage = ExampleStageDelayCls() - UnbufferedPipeline.__init__(self, stage, stage_ctl=False) + BufferedPipeline.__init__(self, stage, stage_ctl=True) class ExampleBufPipe3(ControlBase): @@ -635,6 +635,19 @@ class ExampleBufPipe3(ControlBase): return m +def data_chain1(): + data = [] + for i in range(num_tests): + data.append(randint(0, 1<<16-2)) + return data + + +def test12_resultfn(o_data, expected, i, o): + res = expected + 1 + assert o_data == res, \ + "%d-%d data %x not match %s\n" \ + % (i, o, o_data, repr(expected)) + num_tests = 100 @@ -736,9 +749,10 @@ if __name__ == '__main__': print ("test 12") - dut = ExampleBufPipe3() - data = data_chain2() - test = Test5(dut, test9_resultfn, data=data) + #dut = ExampleBufPipe3() + dut = ExampleBufDelayedPipe() + data = data_chain1() + test = Test5(dut, test12_resultfn, data=data) run_simulation(dut, [test.send, test.rcv], vcd_name="test_bufpipe12.vcd") ports = [dut.p.i_valid, dut.n.i_ready, dut.n.o_valid, dut.p.o_ready] + \ -- 2.30.2