X-Git-Url: https://git.libre-soc.org/?p=ieee754fpu.git;a=blobdiff_plain;f=src%2Fadd%2Fexample_buf_pipe.py;h=b83d5035cc01c7ec338c1589359323b213e3099f;hp=ce4781b1ffae7285bd0721672236861e3cee13e6;hb=f3945d1317aa236b752c1e286801caa2c3a07703;hpb=00c8ebabaeacdb7d44c804c893954e371c0f4641 diff --git a/src/add/example_buf_pipe.py b/src/add/example_buf_pipe.py index ce4781b1..b83d5035 100644 --- a/src/add/example_buf_pipe.py +++ b/src/add/example_buf_pipe.py @@ -171,8 +171,10 @@ class StageChain: o = self.chain[idx].ospec() # only the last assignment survives m.d.comb += eq(o, c.process(i)) # process input into "o" if idx != len(self.chain)-1: - i = self.chain[idx+1] # becomes new input on next loop - self.o = o # last loop is the output + ni = self.chain[idx+1].ispec() # becomes new input on next loop + m.d.comb += eq(ni, o) # assign output to next input + i = ni + self.o = o # last loop is the output def process(self, i): return self.o @@ -366,6 +368,23 @@ class ExampleStage: return i + 1 +class ExampleStageCls: + """ an example of how to use the buffered pipeline, in a static class + fashion + """ + + def ispec(self): + return Signal(16, name="example_input_signal") + + def ospec(self): + return Signal(16, name="example_output_signal") + + def process(self, i): + """ process the input data and returns it (adds 1) + """ + return i + 1 + + class ExampleBufPipe(BufferedPipeline): """ an example of how to use the buffered pipeline. """