From be25e4da1b755590822d7feeb94f5a1cb92b558a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20K=C3=B6hler?= Date: Tue, 22 Oct 2024 09:28:57 +0200 Subject: [PATCH] fpga: rfnoc: radio: move arithmetic away from timestamp for timing Original-commit: 7a3fc743375f065c38f9d6aa3fff43d67cc6b0e0 --- lib/rfnoc/blocks/rfnoc_block_radio/radio_rx_core.v | 8 ++++---- lib/rfnoc/blocks/rfnoc_block_radio/radio_tx_core.v | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/rfnoc/blocks/rfnoc_block_radio/radio_rx_core.v b/lib/rfnoc/blocks/rfnoc_block_radio/radio_rx_core.v index 9a7b4a1..72197f8 100644 --- a/lib/rfnoc/blocks/rfnoc_block_radio/radio_rx_core.v +++ b/lib/rfnoc/blocks/rfnoc_block_radio/radio_rx_core.v @@ -421,12 +421,12 @@ module radio_rx_core #( if (radio_rx_stb) begin // Register time comparisons so they don't become the critical path. - // Add two to compensate for the pipeline delays of this comparison and - // its propagation through the state machine. This ensures that the + // Subtract two to compensate for the pipeline delays of this comparison + // and its propagation through the state machine. This ensures that the // timestamp in the packet matches the requested timestamp. - time_now <= (radio_time[63:SHIFT_W]+2 == cmd_time[63:SHIFT_W]); + time_now <= (radio_time[63:SHIFT_W] == cmd_time[63:SHIFT_W]-2); time_now_p1 <= time_now; - time_past <= (radio_time[63:SHIFT_W] >= cmd_time[63:SHIFT_W]); + time_past <= (radio_time[63:SHIFT_W] >= cmd_time[63:SHIFT_W]); end case (state) 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 33f1d7e..5771602 100644 --- a/lib/rfnoc/blocks/rfnoc_block_radio/radio_tx_core.v +++ b/lib/rfnoc/blocks/rfnoc_block_radio/radio_tx_core.v @@ -277,9 +277,9 @@ module radio_tx_core #( if (radio_tx_stb) begin // Register time comparisons so they don't become the critical path - time_now_m1 <= (radio_time[63:SHIFT_W]+1 == s_axis_ttimestamp[63:SHIFT_W]); + time_now_m1 <= (radio_time[63:SHIFT_W] == s_axis_ttimestamp[63:SHIFT_W]-1); time_now <= time_now_m1; - time_past <= (radio_time[63:SHIFT_W] > s_axis_ttimestamp[63:SHIFT_W]); + time_past <= (radio_time[63:SHIFT_W] > s_axis_ttimestamp[63:SHIFT_W]); end if (NSPC > 1) begin