core/arp: Add enable signals for Cache/Clear for optional external control.

This commit is contained in:
Florent Kermarrec 2023-07-31 17:26:58 +02:00
parent c5b53326bb
commit ea45c8704f
1 changed files with 7 additions and 3 deletions

View File

@ -165,6 +165,10 @@ class LiteEthARPCache(LiteXModule):
self.request = stream.Endpoint([("ip_address", 32)]) self.request = stream.Endpoint([("ip_address", 32)])
self.response = stream.Endpoint([("mac_address", 48), ("error", 1)]) self.response = stream.Endpoint([("mac_address", 48), ("error", 1)])
# Enable.
self.enable = Signal(reset=1)
self.clear_enable = Signal(reset=1)
# # # # # #
# Parameters. # Parameters.
@ -208,14 +212,14 @@ class LiteEthARPCache(LiteXModule):
) )
) )
fsm.act("IDLE", fsm.act("IDLE",
If(self.update.valid, If(self.enable & self.update.valid,
NextState("MEM_UPDATE") NextState("MEM_UPDATE")
), ),
If(self.request.valid, If(self.enable & self.request.valid,
NextValue(search_count, 0), NextValue(search_count, 0),
NextState("MEM_SEARCH") NextState("MEM_SEARCH")
), ),
If(self.clear_timer.done, If(self.clear_enable & self.clear_timer.done,
NextValue(update_count, 0), NextValue(update_count, 0),
NextState("CLEAR") NextState("CLEAR")
) )