Skip to content

Commit

Permalink
core: Add buffers to IP and ICMP
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanG077 committed Nov 12, 2023
1 parent 4eec841 commit 845f4ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions liteeth/core/icmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from liteeth.common import *
from liteeth.packet import Depacketizer, Packetizer
from litex.soc.interconnect.stream import Buffer, BufferizeEndpoints, DIR_SOURCE, DIR_SINK

# ICMP TX ------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -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),
Expand Down
4 changes: 4 additions & 0 deletions liteeth/core/ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 845f4ff

Please sign in to comment.