From dd0ba0b8588aabb5d487c63b196e5084d311fa5b Mon Sep 17 00:00:00 2001 From: Benjamin Reese Date: Tue, 7 Jul 2026 12:56:08 -0700 Subject: [PATCH] fix(rssi): correct monitor busy and liveness timing --- protocols/rssi/v1/rtl/RssiMonitor.vhd | 21 +++++++++++++++------ tests/protocols/rssi/test_RssiMonitor.py | 5 +---- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/protocols/rssi/v1/rtl/RssiMonitor.vhd b/protocols/rssi/v1/rtl/RssiMonitor.vhd index 5a4ffe6167..6aba795975 100644 --- a/protocols/rssi/v1/rtl/RssiMonitor.vhd +++ b/protocols/rssi/v1/rtl/RssiMonitor.vhd @@ -52,8 +52,8 @@ entity RssiMonitor is STATUS_WIDTH_G : positive := 8; CNT_WIDTH_G : positive := 32; RETRANSMIT_ENABLE_G : boolean := true - -- - ); + -- + ); port ( clk_i : in sl; rst_i : in sl; @@ -185,7 +185,9 @@ architecture rtl of RssiMonitor is signal rin : RegType; signal s_status : slv(STATUS_WIDTH_G - 1 downto 0); -- + begin + -- Status assignment s_status(0) <= r.retransMax and r.sndResend and not r.sndResendD1; s_status(1) <= r.nullTout; @@ -312,8 +314,6 @@ begin if (connActive_i = '0' or (rxValid_i = '1' and rxFlags_i.data = '1') or (rxValid_i = '1' and rxFlags_i.nul = '1') or - (rxValid_i = '1' and rxFlags_i.ack = '1') or - (rxValid_i = '1' and rxFlags_i.busy = '1') or RETRANSMIT_ENABLE_G = false -- Disable null timeout ) then v.nullToutCnt := (others => '0'); @@ -356,7 +356,7 @@ begin dataHeadSt_i = '1' or rstHeadSt_i = '1' or nullHeadSt_i = '1' or - (rxLastSeqN_i - r.lastAckSeqN) = 0 + ((rxLastSeqN_i - r.lastAckSeqN) = 0 and localBusy_i = '0') ) then v.ackToutCnt := (others => '0'); elsif ((rxLastSeqN_i - r.lastAckSeqN) > 0 and (rxLastSeqN_i - r.lastAckSeqN) <= rxWindowSize_i) or (localBusy_i = '1') then @@ -374,8 +374,16 @@ begin ) then v.sndAck := '0'; + -- Periodic BUSY acknowledgment request. The RSSI page recommends + -- Retransmission Timeout/2 so the peer keeps its retransmission timer + -- reset while this receiver remains busy. + elsif (localBusy_i = '1' and (rxLastSeqN_i - r.lastAckSeqN) = 0 and + r.ackToutCnt >= ((conv_integer(rssiParam_i.retransTout)*SAMPLES_PER_TIME_C)/2)) then + v.sndAck := '1'; + -- Timeout acknowledgment request - elsif (r.ackToutCnt >= (conv_integer(rssiParam_i.cumulAckTout)* SAMPLES_PER_TIME_C)) then + elsif ((rxLastSeqN_i - r.lastAckSeqN) > 0 and + r.ackToutCnt >= (conv_integer(rssiParam_i.cumulAckTout)* SAMPLES_PER_TIME_C)) then v.sndAck := '1'; -- Cumulative acknowledgment request @@ -460,4 +468,5 @@ begin resendCnt_o <= r.resendCnt; reconCnt_o <= r.reconCnt; --------------------------------------------------------------------- + end architecture rtl; diff --git a/tests/protocols/rssi/test_RssiMonitor.py b/tests/protocols/rssi/test_RssiMonitor.py index 8103ff2e61..3ca7b1721d 100644 --- a/tests/protocols/rssi/test_RssiMonitor.py +++ b/tests/protocols/rssi/test_RssiMonitor.py @@ -34,7 +34,7 @@ from cocotb.clock import Clock from cocotb.triggers import RisingEdge, Timer -from tests.common.regression_utils import env_flag, run_surf_vhdl_test +from tests.common.regression_utils import run_surf_vhdl_test class TB: @@ -222,10 +222,7 @@ async def local_busy_generates_periodic_ack_after_cumulative_timeout_test(dut): PARAMETER_SWEEP = [pytest.param({}, id="server_monitor")] -KNOWN_ISSUE_REASON = "set RUN_RSSI_KNOWN_ISSUE_TESTS=1 to run RSSI cases that require follow-up RTL fixes" - -@pytest.mark.skipif(not env_flag("RUN_RSSI_KNOWN_ISSUE_TESTS", default=False), reason=KNOWN_ISSUE_REASON) @pytest.mark.parametrize("parameters", PARAMETER_SWEEP) def test_RssiMonitor(parameters): run_surf_vhdl_test(