-# This file is Copyright (c) 2019 Florent Kermarrec <florent@enjoy-digital.fr>
+# This file is Copyright (c) 2019-2020 Florent Kermarrec <florent@enjoy-digital.fr>
# License: BSD
"""Avalon support for LiteX"""
class Native2AvalonST(Module):
"""Native LiteX's stream to Avalon-ST stream"""
def __init__(self, layout, latency=2):
- self.sink = sink = stream.Endpoint(layout)
+ self.sink = sink = stream.Endpoint(layout)
self.source = source = stream.Endpoint(layout)
# # #
class AvalonST2Native(Module):
"""Avalon-ST Stream to native LiteX's stream"""
def __init__(self, layout, latency=2):
- self.sink = sink = stream.Endpoint(layout)
+ self.sink = sink = stream.Endpoint(layout)
self.source = source = stream.Endpoint(layout)
# # #
- buf = stream.SyncFIFO(layout, max(latency, 4))
+ buf = stream.SyncFIFO(layout, latency)
self.submodules += buf
- self.comb += [
- sink.connect(buf.sink, omit={"ready"}),
- sink.ready.eq(source.ready),
- buf.source.connect(source)
- ]
+ self.comb += sink.connect(buf.sink, omit={"ready"})
+ self.comb += sink.ready.eq(source.ready)
+ self.comb += buf.source.connect(source)