From f3416de75fc85edb397a399a49dc093df0cf40a1 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 5 Apr 2019 06:02:48 +0100 Subject: [PATCH] add stage_ctl argument to PrevControl / NextControl on pipeline --- src/add/singlepipe.py | 16 +++++++++++----- src/add/test_buf_pipe.py | 7 +++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/add/singlepipe.py b/src/add/singlepipe.py index 9459eb09..50eba9dc 100644 --- a/src/add/singlepipe.py +++ b/src/add/singlepipe.py @@ -168,10 +168,13 @@ class PrevControl: * i_data : an input - added by the user of this class """ - def __init__(self, i_width=1): + def __init__(self, i_width=1, stage_ctl=False): + self.stage_ctl = stage_ctl self.i_valid = Signal(i_width, name="p_i_valid") # prev >>in self self.o_ready = Signal(name="p_o_ready") # prev <> next self.i_ready = Signal(name="n_i_ready") # self <> next def connect_to_next(self, nxt): """ helper function to connect to the next stage data/valid/ready. @@ -392,7 +398,7 @@ class StageChain(StageCls): class ControlBase: """ Common functions for Pipeline API """ - def __init__(self, in_multi=None): + def __init__(self, in_multi=None, stage_ctl=False): """ Base class containing ready/valid/data to previous and next stages * p: contains ready/valid to the previous stage @@ -403,8 +409,8 @@ class ControlBase: * add o_data member to NextControl (n) """ # set up input and output IO ACK (prev/next ready/valid) - self.p = PrevControl(in_multi) - self.n = NextControl() + self.p = PrevControl(in_multi, stage_ctl) + self.n = NextControl(stage_ctl) def connect_to_next(self, nxt): """ helper function to connect to the next stage data/valid/ready. diff --git a/src/add/test_buf_pipe.py b/src/add/test_buf_pipe.py index 3f3cce21..2376f337 100644 --- a/src/add/test_buf_pipe.py +++ b/src/add/test_buf_pipe.py @@ -594,8 +594,11 @@ class ExampleStageDelayCls(StageCls): def ospec(self): return Signal(16, name="example_output_signal") - def data_ready(self, i): - pass + def p_o_ready(self, m, p_in, p_out): + m.d.comb += p_out.eq(p_in) + + def n_o_valid(self, m, n_in, n_out): + m.d.comb += n_out.eq(n_in) def process(self, i): """ process the input data and returns it (adds 1) -- 2.30.2