core/ip: Add optional input buffer on LiteEthIPTX to improve timings.

This commit is contained in:
Florent Kermarrec 2024-04-04 17:26:54 +02:00
parent 30e66a7e21
commit 211cdc26f3
1 changed files with 7 additions and 1 deletions

View File

@ -94,13 +94,19 @@ class LiteEthIPV4Packetizer(Packetizer):
class LiteEthIPTX(LiteXModule):
def __init__(self, mac_address, ip_address, arp_table, dw=8):
def __init__(self, mac_address, ip_address, arp_table, dw=8, with_buffer=False):
self.sink = sink = stream.Endpoint(eth_ipv4_user_description(dw))
self.source = source = stream.Endpoint(eth_mac_description(dw))
self.target_unreachable = Signal()
# # #
# Buffer.
if with_buffer:
self.buffer = buffer = stream.Buffer(eth_ipv4_user_description(dw))
self.comb += sink.connect(buffer.sink)
sink = buffer.source
# Checksum.
self.checksum = checksum = LiteEthIPV4Checksum(skip_checksum=True)
self.comb += checksum.ce.eq(sink.valid)