From 8aba99eb2d231c2cb4d4c2d9aa1eec5e17442fe6 Mon Sep 17 00:00:00 2001 From: Eric Kooistra <kooistra@astron.nl> Date: Tue, 25 Oct 2022 17:27:28 +0200 Subject: [PATCH] Need sync_reg2 to align latency monitor when ref_sync = in_sosi.sync. --- libraries/base/dp/src/vhdl/dp_bsn_monitor_v2.vhd | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libraries/base/dp/src/vhdl/dp_bsn_monitor_v2.vhd b/libraries/base/dp/src/vhdl/dp_bsn_monitor_v2.vhd index 78249aab75..fd3981df8e 100644 --- a/libraries/base/dp/src/vhdl/dp_bsn_monitor_v2.vhd +++ b/libraries/base/dp/src/vhdl/dp_bsn_monitor_v2.vhd @@ -104,6 +104,7 @@ ARCHITECTURE rtl OF dp_bsn_monitor_v2 IS SIGNAL nxt_valid : STD_LOGIC; SIGNAL sop : STD_LOGIC; SIGNAL nxt_sop : STD_LOGIC; + SIGNAL sync_reg2 : STD_LOGIC; SIGNAL sync_reg : STD_LOGIC; SIGNAL sync : STD_LOGIC; SIGNAL nxt_sync : STD_LOGIC; @@ -163,7 +164,7 @@ BEGIN nxt_mon_nof_sop <= nof_sop WHEN sync='1' ELSE i_mon_nof_sop; nxt_mon_nof_err <= nof_err WHEN sync='1' ELSE i_mon_nof_err; nxt_mon_nof_valid <= nof_valid WHEN sync='1' ELSE i_mon_nof_valid; - nxt_mon_latency <= latency WHEN sync_reg='1' ELSE i_mon_latency; -- use sync_reg due to ref_sync_reg + nxt_mon_latency <= latency WHEN sync_reg2='1' ELSE i_mon_latency; -- use sync_reg2 due to ref_sync_reg nof_sop <= cnt_sop; nof_err <= cnt_err; @@ -171,9 +172,9 @@ BEGIN latency <= cnt_latency; -- Register ref_sync to ease timing closure for ref_sync fanout to (many) dp_bsn_monitor_v2 - -- instances. The ref_sync_reg is used to restart cnt_latency. Therefore the sync_reg - -- (instead of sync) is needed to capture latency (= cnt_latency) not too early, so capture - -- cnt_latency at or after the cnt_latency has restarted. + -- instances. The ref_sync_reg is used to restart cnt_latency. Therefore the sync_reg2 + -- (instead of sync) is needed to capture latency (= cnt_latency) not too early, in case + -- ref_sync = in_sosi.sync, so capture cnt_latency at or after the cnt_latency has restarted. ref_sync_reg <= ref_sync WHEN rising_edge(clk); u_sync_timeout_cnt : ENTITY common_lib.common_counter @@ -216,6 +217,7 @@ BEGIN err <= '0'; sync <= '0'; sync_reg <= '0'; + sync_reg2 <= '0'; bsn <= (OTHERS=>'0'); -- output mon_evt <= '0'; @@ -237,6 +239,7 @@ BEGIN err <= nxt_err; sync <= nxt_sync; sync_reg <= sync; + sync_reg2 <= sync_reg; bsn <= nxt_bsn; -- output mon_evt <= nxt_mon_evt; -- GitLab