From 7ba5a59e1252597196d61b246ef943a2f28ad159 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 15 Jul 2021 18:21:41 +0200 Subject: [PATCH] core/arp/LiteEthARPTX: Move datapath outside of FSM (minor logic optimization). --- liteeth/core/arp.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/liteeth/core/arp.py b/liteeth/core/arp.py index c272718..e284811 100644 --- a/liteeth/core/arp.py +++ b/liteeth/core/arp.py @@ -60,22 +60,24 @@ class LiteEthARPTX(Module): packetizer.sink.protosize.eq(4), packetizer.sink.sender_mac.eq(mac_address), packetizer.sink.sender_ip.eq(ip_address), + packetizer.sink.target_ip.eq(sink.ip_address), If(sink.reply, packetizer.sink.opcode.eq(arp_opcode_reply), packetizer.sink.target_mac.eq(sink.mac_address), - packetizer.sink.target_ip.eq(sink.ip_address) ).Elif(sink.request, packetizer.sink.opcode.eq(arp_opcode_request), packetizer.sink.target_mac.eq(0xffffffffffff), - packetizer.sink.target_ip.eq(sink.ip_address) ) ] - fsm.act("SEND", - packetizer.sink.valid.eq(1), - packetizer.source.connect(source), + self.comb += [ + packetizer.source.connect(source, omit={"valid", "ready"}), source.target_mac.eq(packetizer.sink.target_mac), source.sender_mac.eq(mac_address), source.ethernet_type.eq(ethernet_type_arp), + ] + fsm.act("SEND", + packetizer.sink.valid.eq(1), + packetizer.source.connect(source, keep={"valid", "ready"}), If(source.valid & source.ready, NextValue(counter, counter + 1), If(source.last,