From d1d2ad4584cd216f0468f18caac07b2f61767dc4 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Wed, 16 Feb 2022 14:13:54 +0100 Subject: [PATCH] frontend/stream: Add with_broadcast parameter to allow broadcast reception (Enabled by default). --- liteeth/frontend/stream.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/liteeth/frontend/stream.py b/liteeth/frontend/stream.py index 74d5665..fb188eb 100644 --- a/liteeth/frontend/stream.py +++ b/liteeth/frontend/stream.py @@ -62,7 +62,7 @@ class LiteEthStream2UDPTX(Module): # UDP to Stream RX --------------------------------------------------------------------------------- class LiteEthUDP2StreamRX(Module): - def __init__(self, ip_address=None, udp_port=None, data_width=8, fifo_depth=None): + def __init__(self, ip_address=None, udp_port=None, data_width=8, fifo_depth=None, with_broadcast=True): self.sink = sink = stream.Endpoint(eth_udp_user_description(data_width)) self.source = source = stream.Endpoint(eth_tty_description(data_width)) @@ -75,7 +75,7 @@ class LiteEthUDP2StreamRX(Module): self.comb += If(sink.dst_port != udp_port, valid.eq(0)) # Check IP Address (Optional). - if ip_address is not None: + if (ip_address is not None) and (not with_broadcast): ip_address = convert_ip(ip_address) self.comb += If(sink.ip_address != ip_address, valid.eq(0)) @@ -98,9 +98,9 @@ class LiteEthUDP2StreamRX(Module): # UDP Streamer ------------------------------------------------------------------------------------- class LiteEthUDPStreamer(Module): - def __init__(self, udp, ip_address, udp_port, data_width=8, rx_fifo_depth=64, tx_fifo_depth=64, cd="sys"): + def __init__(self, udp, ip_address, udp_port, data_width=8, rx_fifo_depth=64, tx_fifo_depth=64, with_broadcast=True, cd="sys"): self.submodules.tx = tx = LiteEthStream2UDPTX(ip_address, udp_port, data_width, tx_fifo_depth) - self.submodules.rx = rx = LiteEthUDP2StreamRX(ip_address, udp_port, data_width, rx_fifo_depth) + self.submodules.rx = rx = LiteEthUDP2StreamRX(ip_address, udp_port, data_width, rx_fifo_depth, with_broadcast) udp_port = udp.crossbar.get_port(udp_port, dw=data_width, cd=cd) self.comb += [ tx.source.connect(udp_port.sink),