From 1b09112237b9dece9c68ca9fe34b138c79a1095e Mon Sep 17 00:00:00 2001 From: Rowan Goemans Date: Sun, 12 Nov 2023 18:42:36 +0100 Subject: [PATCH] core: Add buffers to IP and ICMP --- liteeth/core/icmp.py | 4 ++++ liteeth/core/ip.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/liteeth/core/icmp.py b/liteeth/core/icmp.py index 294e0dd..346a3f5 100644 --- a/liteeth/core/icmp.py +++ b/liteeth/core/icmp.py @@ -10,6 +10,7 @@ from litex.soc.interconnect.packet import PacketFIFO from liteeth.common import * from liteeth.packet import Depacketizer, Packetizer +from litex.soc.interconnect.stream import BufferizeEndpoints, DIR_SOURCE, DIR_SINK # ICMP TX ------------------------------------------------------------------------------------------ @@ -160,6 +161,9 @@ class LiteEthICMP(LiteXModule): def __init__(self, ip, ip_address, dw=8, fifo_depth=128): self.tx = tx = LiteEthICMPTX(ip_address, dw) self.rx = rx = LiteEthICMPRX(ip_address, dw) + + rx = BufferizeEndpoints({"source": DIR_SOURCE}, pipe_valid=True, pipe_ready=False)(rx) + self.echo = echo = LiteEthICMPEcho(dw, fifo_depth=fifo_depth) self.comb += [ rx.source.connect(echo.sink), diff --git a/liteeth/core/ip.py b/liteeth/core/ip.py index 84e8e28..4049ee1 100644 --- a/liteeth/core/ip.py +++ b/liteeth/core/ip.py @@ -6,6 +6,7 @@ from litex.gen import * +from litex.soc.interconnect.stream import BufferizeEndpoints, DIR_SOURCE, DIR_SINK from liteeth.common import * from liteeth.crossbar import LiteEthCrossbar @@ -261,6 +262,9 @@ class LiteEthIP(LiteXModule): def __init__(self, mac, mac_address, ip_address, arp_table, with_broadcast=True, dw=8): self.tx = tx = LiteEthIPTX(mac_address, ip_address, arp_table, dw=dw) self.rx = rx = LiteEthIPRX(mac_address, ip_address, with_broadcast, dw=dw) + + rx = BufferizeEndpoints({"source": DIR_SOURCE}, pipe_valid=True, pipe_ready=False)(rx) + mac_port = mac.crossbar.get_port(ethernet_type_ip, dw) self.comb += [ tx.source.connect(mac_port.sink),