From d42c8912fa9d68cdc21cf1262e867b2e1eda02dd Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 5 Apr 2019 19:56:48 +0100 Subject: [PATCH] tracking down sync failure when stage not dynamically ready --- src/add/singlepipe.py | 2 +- src/add/test_buf_pipe.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/add/singlepipe.py b/src/add/singlepipe.py index 5c19fd66..e32a0c67 100644 --- a/src/add/singlepipe.py +++ b/src/add/singlepipe.py @@ -602,7 +602,7 @@ class BufferedPipeline(ControlBase): self.m.d.sync += eq(r_data, result) # update buffer with self.m.If(self.n.i_ready): # next stage is ready - with self.m.If(self.p.o_ready): # not stalled + with self.m.If(self.p._o_ready): # not stalled # nothing in buffer: send (processed) input direct to output self.m.d.sync += [self.n._o_valid.eq(p_i_valid), eq(self.n.o_data, result), # update output diff --git a/src/add/test_buf_pipe.py b/src/add/test_buf_pipe.py index 31555635..7cdb7ebd 100644 --- a/src/add/test_buf_pipe.py +++ b/src/add/test_buf_pipe.py @@ -205,6 +205,7 @@ class Test5: send = True else: send = randint(0, send_range) != 0 + send = True o_p_ready = yield self.dut.p.o_ready if not o_p_ready: yield @@ -597,6 +598,7 @@ class ExampleStageDelayCls(StageCls): @property def p_o_ready(self): return Const(1) + return self.count == 0 @property def n_o_valid(self): @@ -607,6 +609,11 @@ class ExampleStageDelayCls(StageCls): """ return i + 1 + def elaborate(self, platform): + m = Module() + m.d.sync += self.count.eq(~self.count) + return m + class ExampleBufDelayedPipe(BufferedPipeline): """ an example of how to use the buffered pipeline. @@ -616,6 +623,11 @@ class ExampleBufDelayedPipe(BufferedPipeline): stage = ExampleStageDelayCls() BufferedPipeline.__init__(self, stage, stage_ctl=True) + def elaborate(self, platform): + m = BufferedPipeline.elaborate(self, platform) + m.submodules.stage = self.stage + return m + class ExampleBufPipe3(ControlBase): """ Example of how to do delayed pipeline, where the stage signals -- 2.30.2