mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
soc/interconnect/stream: expose Endpoint
This commit is contained in:
parent
6a4e3bb5c0
commit
6ea65f957c
1 changed files with 6 additions and 6 deletions
|
@ -43,7 +43,7 @@ class EndpointDescription:
|
||||||
return full_layout
|
return full_layout
|
||||||
|
|
||||||
|
|
||||||
class _Endpoint(Record):
|
class Endpoint(Record):
|
||||||
def __init__(self, description_or_layout):
|
def __init__(self, description_or_layout):
|
||||||
if isinstance(description_or_layout, EndpointDescription):
|
if isinstance(description_or_layout, EndpointDescription):
|
||||||
self.description = description_or_layout
|
self.description = description_or_layout
|
||||||
|
@ -58,12 +58,12 @@ class _Endpoint(Record):
|
||||||
return getattr(object.__getattribute__(self, "param"), name)
|
return getattr(object.__getattribute__(self, "param"), name)
|
||||||
|
|
||||||
|
|
||||||
class Source(_Endpoint):
|
class Source(Endpoint):
|
||||||
def connect(self, sink):
|
def connect(self, sink):
|
||||||
return Record.connect(self, sink)
|
return Record.connect(self, sink)
|
||||||
|
|
||||||
|
|
||||||
class Sink(_Endpoint):
|
class Sink(Endpoint):
|
||||||
def connect(self, source):
|
def connect(self, source):
|
||||||
return source.connect(self)
|
return source.connect(self)
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ def _rawbits_layout(l):
|
||||||
def pack_layout(l, n):
|
def pack_layout(l, n):
|
||||||
return [("chunk"+str(i), l) for i in range(n)]
|
return [("chunk"+str(i), l) for i in range(n)]
|
||||||
|
|
||||||
def get_endpoints(obj, filt=_Endpoint):
|
def get_endpoints(obj, filt=Endpoint):
|
||||||
if hasattr(obj, "get_endpoints") and callable(obj.get_endpoints):
|
if hasattr(obj, "get_endpoints") and callable(obj.get_endpoints):
|
||||||
return obj.get_endpoints(filt)
|
return obj.get_endpoints(filt)
|
||||||
r = dict()
|
r = dict()
|
||||||
|
@ -478,11 +478,11 @@ class Pipeline(Module):
|
||||||
self.sink = m.sink
|
self.sink = m.sink
|
||||||
for i in range(1, n):
|
for i in range(1, n):
|
||||||
m_n = modules[i]
|
m_n = modules[i]
|
||||||
if isinstance(m, _Endpoint):
|
if isinstance(m, Endpoint):
|
||||||
source = m
|
source = m
|
||||||
else:
|
else:
|
||||||
source = m.source
|
source = m.source
|
||||||
if isinstance(m_n, _Endpoint):
|
if isinstance(m_n, Endpoint):
|
||||||
sink = m_n
|
sink = m_n
|
||||||
else:
|
else:
|
||||||
sink = m_n.sink
|
sink = m_n.sink
|
||||||
|
|
Loading…
Reference in a new issue