From a35df4f7d1ebba3786d4f11302e9c4b77391d054 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 6 Apr 2020 11:33:49 +0200 Subject: [PATCH] stream: set reset_less to True on datapath signals. Reset is only required on control signals. --- litex/soc/interconnect/stream.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/litex/soc/interconnect/stream.py b/litex/soc/interconnect/stream.py index 1f5e1b312..4558ac8c9 100644 --- a/litex/soc/interconnect/stream.py +++ b/litex/soc/interconnect/stream.py @@ -25,6 +25,12 @@ def _make_m2s(layout): r.append((f[0], _make_m2s(f[1]))) return r +def set_reset_less(field): + if isinstance(field, Signal): + field.reset_less = True + elif isinstance(field, Record): + for s, _ in field.iter_flat(): + s.reset_less = True class EndpointDescription: def __init__(self, payload_layout, param_layout=[]): @@ -59,6 +65,10 @@ class Endpoint(Record): else: self.description = EndpointDescription(description_or_layout) Record.__init__(self, self.description.get_full_layout(), name, **kwargs) + set_reset_less(self.first) + set_reset_less(self.last) + set_reset_less(self.payload) + set_reset_less(self.param) def __getattr__(self, name): try: @@ -136,8 +146,8 @@ class PipelinedActor(BinaryActor): first = sink.valid & sink.first last = sink.valid & sink.last for i in range(latency): - first_n = Signal() - last_n = Signal() + first_n = Signal(reset_less=True) + last_n = Signal(reset_less=True) self.sync += \ If(self.pipe_ce, first_n.eq(first), @@ -482,7 +492,7 @@ def inc_mod(s, m): class Gearbox(Module): def __init__(self, i_dw, o_dw, msb_first=True): - self.sink = sink = Endpoint([("data", i_dw)]) + self.sink = sink = Endpoint([("data", i_dw)]) self.source = source = Endpoint([("data", o_dw)]) # # # @@ -515,7 +525,7 @@ class Gearbox(Module): # Data path - shift_register = Signal(io_lcm) + shift_register = Signal(io_lcm, reset_less=True) i_cases = {} i_data = Signal(i_dw)