From 3d530f6625bfa57085390862275304b4d3fe6298 Mon Sep 17 00:00:00 2001 From: Markus Koch Date: Sun, 15 Jan 2023 10:43:00 +0100 Subject: [PATCH] eth+ipv4prot: Fix protocol arbitration Fixes #13. --- trashernet/trashernet_eth.vhd | 5 ++++- trashernet/trashernet_ipv4prot.vhd | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/trashernet/trashernet_eth.vhd b/trashernet/trashernet_eth.vhd index 3195958..ca4f5b6 100644 --- a/trashernet/trashernet_eth.vhd +++ b/trashernet/trashernet_eth.vhd @@ -141,7 +141,10 @@ begin end if; when TXD => - state <= IDLE when (not mac_in.tx_mac_data_en or not mac_out.tx_active); + if (not mac_in.tx_mac_data_en or not mac_out.tx_active) then + state <= IDLE; + sel <= SEL_ETH_I; -- To avoid arbitration errors, always select the highest priority one by default + end if; end case; end if; end process arb; diff --git a/trashernet/trashernet_ipv4prot.vhd b/trashernet/trashernet_ipv4prot.vhd index e150199..e9715d1 100644 --- a/trashernet/trashernet_ipv4prot.vhd +++ b/trashernet/trashernet_ipv4prot.vhd @@ -105,7 +105,10 @@ begin end loop; when TXD => - state <= IDLE when (not ipv4_in.tx_en); + if not ipv4_in.tx_en then + state <= IDLE; + tx_sel <= ipv4_protocol_in'left; -- To avoid arbitration errors, always select the highest priority one by default + end if; end case; end if; end process arb;