From e40efdd880deb086646c4f89372092b09b093e88 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sun, 28 Apr 2019 22:38:34 +0100 Subject: [PATCH] use property decorator to process input data from stage --- src/add/iocontrol.py | 4 ++++ src/add/singlepipe.py | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/add/iocontrol.py b/src/add/iocontrol.py index 0554b71d..3afd9847 100644 --- a/src/add/iocontrol.py +++ b/src/add/iocontrol.py @@ -540,6 +540,10 @@ class ControlBase(Elaboratable): return eqs + @property + def data(self): + return self.stage.process(self.p.data_i) + def _postprocess(self, i): # XXX DISABLED return i # RETURNS INPUT if hasattr(self.stage, "postprocess"): diff --git a/src/add/singlepipe.py b/src/add/singlepipe.py index 5a8f6c27..220dbefc 100644 --- a/src/add/singlepipe.py +++ b/src/add/singlepipe.py @@ -209,7 +209,7 @@ class BufferedHandshake(ControlBase): ] # store result of processing in combinatorial temporary - self.m.d.comb += nmoperator.eq(result, self.stage.process(self.p.data_i)) + self.m.d.comb += nmoperator.eq(result, self.data) # if not in stall condition, update the temporary register with self.m.If(self.p.ready_o): # not stalled @@ -292,7 +292,7 @@ class SimpleHandshake(ControlBase): ] # store result of processing in combinatorial temporary - m.d.comb += nmoperator.eq(result, self.stage.process(self.p.data_i)) + m.d.comb += nmoperator.eq(result, self.data) # previous valid and ready with m.If(p_valid_i_p_ready_o): @@ -403,7 +403,7 @@ class UnbufferedPipeline(ControlBase): m.d.sync += data_valid.eq(p_valid_i | buf_full) with m.If(pv): - m.d.sync += nmoperator.eq(r_data, self.stage.process(self.p.data_i)) + m.d.sync += nmoperator.eq(r_data, self.data) data_o = self._postprocess(r_data) # XXX TBD, does nothing right now m.d.comb += nmoperator.eq(self.n.data_o, data_o) @@ -484,7 +484,7 @@ class UnbufferedPipeline2(ControlBase): m.d.comb += self.p._ready_o.eq(~buf_full) m.d.sync += buf_full.eq(~self.n.ready_i_test & self.n.valid_o) - data_o = Mux(buf_full, buf, self.stage.process(self.p.data_i)) + data_o = Mux(buf_full, buf, self.data) data_o = self._postprocess(data_o) # XXX TBD, does nothing right now m.d.comb += nmoperator.eq(self.n.data_o, data_o) m.d.sync += nmoperator.eq(buf, self.n.data_o) @@ -554,7 +554,7 @@ class PassThroughHandshake(ControlBase): m.d.comb += self.p.ready_o.eq(~self.n.valid_o | self.n.ready_i_test) m.d.sync += self.n.valid_o.eq(p_valid_i | ~self.p.ready_o) - odata = Mux(pvr, self.stage.process(self.p.data_i), r_data) + odata = Mux(pvr, self.data, r_data) m.d.sync += nmoperator.eq(r_data, odata) r_data = self._postprocess(r_data) # XXX TBD, does nothing right now m.d.comb += nmoperator.eq(self.n.data_o, r_data) @@ -622,7 +622,7 @@ class FIFOControl(ControlBase): # store result of processing in combinatorial temporary result = _spec(self.stage.ospec, "r_temp") - m.d.comb += nmoperator.eq(result, self.stage.process(self.p.data_i)) + m.d.comb += nmoperator.eq(result, self.data) # connect previous rdy/valid/data - do cat on data_i # NOTE: cannot do the PrevControl-looking trick because -- 2.30.2