soc/interconnect/stream/Pipeline: Improve comments.

This commit is contained in:
Florent Kermarrec 2021-05-26 18:34:22 +02:00
parent b1d8fe61f8
commit 5fd215fe3a

View file

@ -844,25 +844,22 @@ class Pipeline(Module):
def __init__(self, *modules):
n = len(modules)
m = modules[0]
# expose sink of first module
# if available
# Expose sink of first module if available.
if hasattr(m, "sink"):
self.sink = m.sink
# Iterate on Modules/Endpoints.
for i in range(1, n):
m_n = modules[i]
if isinstance(m, Endpoint):
source = m
else:
source = m.source
if isinstance(m_n, Endpoint):
sink = m_n
else:
sink = m_n.sink
# If m is an Endpoint, use it as Source, else use Module.source.
source = m if isinstance(m, Endpoint) else m.source
# If m_n is an Endpoint, use it as Sink, else use Module.sink.
sink = m_n if isinstance(m_n, Endpoint) else m_n.sink
# Connect Source to Sink (when m is not m_n).
if m is not m_n:
self.comb += source.connect(sink)
# Update m.
m = m_n
# expose source of last module
# if available
# Expose source of last module if available.
if hasattr(m, "source"):
self.source = m.source