From 285f7b26a11e34b2b0e6988a1112b1281193b8f9 Mon Sep 17 00:00:00 2001 From: Wade Fife Date: Fri, 31 Jan 2025 12:57:34 -0600 Subject: [PATCH] fpga: rfnoc: radio: Improve underflow handling The TX radio will normally transmit a late not-timed packet when an underflow occurs between packets within a burst. However, if it was only one cycle late, then the packet would be dropped. This change rearms the state machine more quickly in this corner case to allow this late packet to be accepted. The underflow error will still be reported. Original-commit: 9faac6597cf21ca11e40d4e98797cea2848c40b0 --- lib/rfnoc/blocks/rfnoc_block_radio/radio_tx_core.v | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/rfnoc/blocks/rfnoc_block_radio/radio_tx_core.v b/lib/rfnoc/blocks/rfnoc_block_radio/radio_tx_core.v index 075c4e9..33f1d7e 100644 --- a/lib/rfnoc/blocks/rfnoc_block_radio/radio_tx_core.v +++ b/lib/rfnoc/blocks/rfnoc_block_radio/radio_tx_core.v @@ -355,7 +355,9 @@ module radio_tx_core #( new_error_code <= ERR_TX_UNDERRUN; new_error_time <= radio_time; new_error_valid <= 1'b1; - state <= ST_POLICY_WAIT; + // If we're between packets, go straight to IDLE. Otherwise, drop + // the rest of the packet before returning to IDLE. + state <= sop ? ST_IDLE : ST_POLICY_WAIT; end else if (s_axis_tlast && s_axis_teob) begin // We're done with this burst of packets, so acknowledge EOB and // go back to idle. @@ -395,11 +397,6 @@ module radio_tx_core #( (reg_policy == TX_ERR_POLICY_BURST && s_axis_teob)) begin state <= ST_IDLE; end - - // If we came from ST_TRANSMIT and we happen to already be between - // packets (i.e., we underflowed while waiting for the next packet). - end else if (!s_axis_tvalid && sop) begin - if (reg_policy == TX_ERR_POLICY_PACKET) state <= ST_IDLE; end end @@ -448,7 +445,7 @@ module radio_tx_core #( .reset (radio_rst), .clear (1'b0), .i_tdata ({new_error_time, new_error_code}), - .i_tvalid (new_error_valid & new_error_ready), // Mask with ready to prevent FIFO corruption + .i_tvalid (new_error_valid), .i_tready (new_error_ready), .o_tdata ({next_error_time, next_error_code}), .o_tvalid (next_error_valid),