def __init__(self):
""" i_data can be a DIFFERENT type from everything else
o_data, r_data and result are best of the same type.
- however this is not strictly the case. an intermediate
+ however this is not strictly necessary. an intermediate
transformation process could hypothetically be applied, however
it is result and r_data that definitively need to be of the same
(intermediary) type, as it is both result and r_data that
return self.result.eq(self.i_data + 1)
def update_buffer(self):
- """ copies the result into the intermediate register r_data
+ """ copies the result into the intermediate register r_data,
+ which will need to be outputted on a subsequent cycle
+ prior to allowing "normal" operation.
"""
return self.r_data.eq(self.result)
class IOAckIn:
def __init__(self):
- self.p_valid = Signal() # >>in - comes in from PREVIOUS stage
+ self.p_valid = Signal() # >>in - comes in from PREVIOUS stage
self.n_ready = Signal() # in<< - comes in from the NEXT stage
class IOAckOut:
def __init__(self):
- self.n_valid = Signal() # out>> - goes out to the NEXT stage
+ self.n_valid = Signal() # out>> - goes out to the NEXT stage
self.p_ready = Signal() # <<out - goes out to the PREVIOUS stage
class BufferedPipeline:
""" buffered pipeline stage
- stage-1 i.p_valid >>in stage o.n_valid out>> stage+1
+ stage-1 i.p_valid >>in stage o.n_valid out>> stage+1
stage-1 o.p_ready <<out stage i.n_ready <<in stage+1
- stage-1 i_data >>in stage o_data out>> stage+1
+ stage-1 i_data >>in stage o_data out>> stage+1
| |
+-------> process
| |
m = Module()
# establish some combinatorial temporaries
- o_p_readyn = Signal(reset_less=True)
o_n_validn = Signal(reset_less=True)
- i_n_readyn = Signal(reset_less=True)
i_p_valid_o_p_ready = Signal(reset_less=True)
- m.d.comb += [i_n_readyn.eq(~self.i.n_ready),
- o_n_validn.eq(~self.o.n_valid),
- o_p_readyn.eq(~self.o.p_ready),
+ m.d.comb += [o_n_validn.eq(~self.o.n_valid),
i_p_valid_o_p_ready.eq(self.i.p_valid & self.o.p_ready),
]
]
-class BufPipe(BufferedPipeline):
+class ExampleBufPipe(BufferedPipeline):
def __init__(self):
BufferedPipeline.__init__(self)