diff --git a/liteeth/core/ip.py b/liteeth/core/ip.py index 8a3f240..ce89729 100644 --- a/liteeth/core/ip.py +++ b/liteeth/core/ip.py @@ -186,7 +186,7 @@ class LiteEthIPV4Depacketizer(Depacketizer): class LiteEthIPRX(Module): - def __init__(self, mac_address, ip_address, dw=8): + def __init__(self, mac_address, ip_address, with_broadcast=True, dw=8): self.sink = sink = stream.Endpoint(eth_mac_description(dw)) self.source = source = stream.Endpoint(eth_ipv4_user_description(dw)) @@ -209,7 +209,7 @@ class LiteEthIPRX(Module): fsm.act("IDLE", If(depacketizer.source.valid & checksum.done, NextState("DROP"), - If((depacketizer.source.target_ip == ip_address) & + If(((depacketizer.source.target_ip == ip_address) | with_broadcast) & (depacketizer.source.version == 0x4) & (depacketizer.source.ihl == 0x5) & (checksum.value == 0), @@ -247,9 +247,9 @@ class LiteEthIPRX(Module): # IP ----------------------------------------------------------------------------------------------- class LiteEthIP(Module): - def __init__(self, mac, mac_address, ip_address, arp_table, dw=8): + def __init__(self, mac, mac_address, ip_address, arp_table, with_broadcast=True, dw=8): self.submodules.tx = tx = LiteEthIPTX(mac_address, ip_address, arp_table, dw=dw) - self.submodules.rx = rx = LiteEthIPRX(mac_address, ip_address, dw=dw) + self.submodules.rx = rx = LiteEthIPRX(mac_address, ip_address, with_broadcast, dw=dw) mac_port = mac.crossbar.get_port(ethernet_type_ip, dw) self.comb += [ tx.source.connect(mac_port.sink),