From 37e0981eac7440c640a16a38daf550f74f1948f8 Mon Sep 17 00:00:00 2001 From: Eric Kooistra <kooistra@astron.nl> Date: Wed, 6 Mar 2024 07:21:40 +0100 Subject: [PATCH] Make code for v.rd_blk_pointer more clear. --- libraries/base/dp/src/vhdl/dp_bsn_align_v2.vhd | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/libraries/base/dp/src/vhdl/dp_bsn_align_v2.vhd b/libraries/base/dp/src/vhdl/dp_bsn_align_v2.vhd index 9042f050f7..eae4c4d60f 100644 --- a/libraries/base/dp/src/vhdl/dp_bsn_align_v2.vhd +++ b/libraries/base/dp/src/vhdl/dp_bsn_align_v2.vhd @@ -275,12 +275,16 @@ begin v.bsn_arr(v.wr_blk_pointer) := w.ref_sosi.bsn(g_bsn_w - 1 downto 0); -- . update read block pointer at g_bsn_latency_max blocks behind the - -- reference write pointer, dependent on the node_index. For - -- g_bsn_latency_max = 1 the node_index = 0 fixed. For - -- g_bsn_latency_max > 1, node_index is the first BSN aligner in a - -- chain. Each subsequent node in the chain then has to account for - -- g_bsn_latency_max additional block latency. - v.rd_blk_pointer := v.wr_blk_pointer - g_bsn_latency_max * (1 + node_index); + -- reference write pointer, dependent on the node_index: + -- - for g_nof_aligners_max = 1 the node_index = 0 fixed + -- - for g_nof_aligners_max > 1, node_index is the first BSN aligner in + -- a chain. Each subsequent node in the chain then has to account + -- for g_bsn_latency_max additional block latency. + if g_nof_aligners_max = 1 then + v.rd_blk_pointer := v.wr_blk_pointer - g_bsn_latency_max; + else + v.rd_blk_pointer := v.wr_blk_pointer - g_bsn_latency_max * (1 + node_index); + end if; if v.rd_blk_pointer < 0 then v.rd_blk_pointer := v.rd_blk_pointer + c_buffer_nof_blocks; end if; -- GitLab