From df279e1bf5d22f3c385edcbacea62d5960e1ec16 Mon Sep 17 00:00:00 2001 From: Alex Forencich Date: Mon, 6 Jul 2026 23:36:58 -0700 Subject: [PATCH] eth: Move SGMII auto-switching later in AN process Signed-off-by: Alex Forencich --- src/eth/rtl/taxi_eth_phy_1g_basex_an.sv | 36 ++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/eth/rtl/taxi_eth_phy_1g_basex_an.sv b/src/eth/rtl/taxi_eth_phy_1g_basex_an.sv index bc05c06..792d872 100644 --- a/src/eth/rtl/taxi_eth_phy_1g_basex_an.sv +++ b/src/eth/rtl/taxi_eth_phy_1g_basex_an.sv @@ -222,22 +222,7 @@ always_comb begin if (rx_an_ability_match && rx_an_cfg != 0) begin // got ability advertisement from link partner an_lp_adv_ability_next = rx_an_cfg; - if (rx_an_cfg[0] == an_sgmii_mode_reg) begin - // mode matches - state_next = STATE_ACK_DET; - end else begin - // mode mismatch, restart - if (an_sgmii_auto) begin - // in SGMII auto mode, switch modes after a few mismatches - if (&mode_mismatch_cnt_reg) begin - mode_mismatch_cnt_next = '0; - an_sgmii_mode_next = rx_an_cfg[0]; - end else begin - mode_mismatch_cnt_next = mode_mismatch_cnt_reg + 1; - end - end - state_next = STATE_START; - end + state_next = STATE_ACK_DET; end else if (!timeout_run_reg && an_timeout_en) begin // timed out, no AN response from link partner an_timeout_next = 1'b1; @@ -283,8 +268,23 @@ always_comb begin state_next = STATE_START; end else if (!delay_run_reg) begin // link timer expired - delay_run_next = 1'b1; - state_next = STATE_IDLE_DET; + if (an_lp_adv_ability_reg[0] == an_sgmii_mode_reg) begin + // mode matches + delay_run_next = 1'b1; + state_next = STATE_IDLE_DET; + end else begin + // mode mismatch, restart + if (an_sgmii_auto) begin + // in SGMII auto mode, switch modes after a few mismatches + if (&mode_mismatch_cnt_reg) begin + mode_mismatch_cnt_next = '0; + an_sgmii_mode_next = rx_an_cfg[0]; + end else begin + mode_mismatch_cnt_next = mode_mismatch_cnt_reg + 1; + end + end + state_next = STATE_START; + end end else begin state_next = STATE_ACK_CPL; end