frontend/stream: Add with_broadcast parameter to allow broadcast reception (Enabled by default).

This commit is contained in:
Florent Kermarrec 2022-02-16 14:13:54 +01:00
parent dc96269c8f
commit d1d2ad4584
1 changed files with 4 additions and 4 deletions

View File

@ -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),