From 4327adcab4112c434f37cf53c13a4868c0795862 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 31 Jul 2023 12:04:34 +0200 Subject: [PATCH] core/arp: Simplify FSM CHECK_TABLE state. --- liteeth/core/arp.py | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/liteeth/core/arp.py b/liteeth/core/arp.py index e4f2b93..0dc37a2 100644 --- a/liteeth/core/arp.py +++ b/liteeth/core/arp.py @@ -204,7 +204,9 @@ class LiteEthARPTable(LiteXModule): NextState("SEND_REPLY") ).Elif(sink.valid & sink.reply & request_pending, NextState("UPDATE_TABLE"), - ).Elif(request.valid | self.request_timer.done, + ).Elif(request.valid, + NextState("CHECK_TABLE") + ).Elif(self.request_timer.done, NextState("CHECK_REQUEST") ) ) @@ -220,7 +222,7 @@ class LiteEthARPTable(LiteXModule): fsm.act("UPDATE_TABLE", NextValue(request_pending, 0), cached_update.eq(1), - NextState("CHECK_REQUEST") + NextState("CHECK_TABLE") ) fsm.act("CHECK_REQUEST", If(request_counter == (max_requests - 1), @@ -233,19 +235,12 @@ class LiteEthARPTable(LiteXModule): ) ) fsm.act("CHECK_TABLE", - If(cached_valid, - If(request_ip_address == cached_ip_address, - NextValue(request_ip_address, 0), - NextState("PRESENT_RESPONSE"), - ).Elif(request.ip_address == cached_ip_address, - request.ready.eq(request.valid), - NextState("PRESENT_RESPONSE"), - ).Else( - If(request.valid, - NextValue(request_ip_address, request.ip_address), - ), - NextState("SEND_REQUEST") - ) + If(cached_valid & (request_ip_address == cached_ip_address), + NextValue(request_ip_address, 0), + NextState("PRESENT_RESPONSE"), + ).Elif(cached_valid & (request.ip_address == cached_ip_address), + request.ready.eq(request.valid), + NextState("PRESENT_RESPONSE"), ).Else( If(request.valid, NextValue(request_ip_address, request.ip_address),