From ae612c792655d30708d21007ce1b68a2f42c7c35 Mon Sep 17 00:00:00 2001 From: Reinier van der Walle <walle@astron.nl> Date: Fri, 17 Dec 2021 14:27:41 +0100 Subject: [PATCH] processed review comments --- .../vhdl/dp_block_validate_bsn_at_sync.vhd | 22 +++++++++---------- .../vhdl/tb_dp_block_validate_bsn_at_sync.vhd | 6 ++++- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/libraries/base/dp/src/vhdl/dp_block_validate_bsn_at_sync.vhd b/libraries/base/dp/src/vhdl/dp_block_validate_bsn_at_sync.vhd index 47cb45bade..7f11d113cf 100644 --- a/libraries/base/dp/src/vhdl/dp_block_validate_bsn_at_sync.vhd +++ b/libraries/base/dp/src/vhdl/dp_block_validate_bsn_at_sync.vhd @@ -199,37 +199,37 @@ BEGIN -- Using v_bsn_at_sync to ensure correct behavior when in_sosi has no latency compared to bs_sosi. VARIABLE v_bsn_at_sync : STD_LOGIC_VECTOR(g_bsn_w-1 DOWNTO 0); BEGIN - v_bsn_at_sync := bsn_at_sync_reg; - v_bsn_ok := bsn_ok_reg; - out_valid <= out_valid_reg; - + v_bsn_at_sync := bsn_at_sync_reg; + v_bsn_ok := bsn_ok_reg; + out_valid <= out_valid_reg; + cnt_discarded_en <= '0'; + IF bs_sosi.sync = '1' THEN - v_bsn_at_sync := bs_sosi.bsn; + v_bsn_at_sync := bs_sosi.bsn(g_bsn_w-1 DOWNTO 0); END IF; IF TO_UINT(in_sosi.channel) = g_check_channel THEN - -- Compare bsn at sync of in_sosi to bsn at sync of bs_sosi. IF in_sosi.sync = '1' THEN - IF in_sosi.bsn = v_bsn_at_sync THEN + -- Compare bsn at sync of in_sosi to bsn at sync of bs_sosi. + IF UNSIGNED(in_sosi.bsn(g_bsn_w-1 DOWNTO 0)) = UNSIGNED(v_bsn_at_sync) THEN v_bsn_ok := '1'; ELSE v_bsn_ok := '0'; END IF; + + -- set cnt_discarded_en to control u_discarded_counter. + cnt_discarded_en <= NOT v_bsn_ok; END IF; -- Setting out_valid to control the discarding at packet level. IF in_sosi.sop = '1' THEN out_valid <= v_bsn_ok; END IF; - - -- set cnt_discarded_en to control u_discarded_counter. - cnt_discarded_en <= in_sosi.sync AND NOT v_bsn_ok; ELSE IF in_sosi.sop = '1' THEN out_valid <= '1'; -- Packets with channel unequal to g_check_channel are always valid END IF; - cnt_discarded_en <= '0'; -- Packets with channel unequal to g_check_channel cannot be discarded. END IF; bsn_ok <= v_bsn_ok; -- bsn_ok is used to indicate if the bsn is correct for the entire sync period of g_check_channel. bsn_at_sync <= v_bsn_at_sync; -- register to store the bsn at sync of bs_sosi. diff --git a/libraries/base/dp/tb/vhdl/tb_dp_block_validate_bsn_at_sync.vhd b/libraries/base/dp/tb/vhdl/tb_dp_block_validate_bsn_at_sync.vhd index 66b17b21e6..74423a7316 100644 --- a/libraries/base/dp/tb/vhdl/tb_dp_block_validate_bsn_at_sync.vhd +++ b/libraries/base/dp/tb/vhdl/tb_dp_block_validate_bsn_at_sync.vhd @@ -63,7 +63,11 @@ ARCHITECTURE tb OF tb_dp_block_validate_bsn_at_sync IS CONSTANT c_gap_size : NATURAL := 4; CONSTANT c_nof_sync : NATURAL := 5; CONSTANT c_nof_blk : NATURAL := g_nof_blocks_per_sync * c_nof_sync; - -- choosing c_check_channel such that it corresponds with a channel from stimuli on a sync because the channel field is generated by a counter. + -- The u_stimuli_in creates counter data in stimuli_sosi.channel. Therefore + -- choose some c_check_channel value (> 0, < c_nof_blk) that will occur in + -- the future. Hence this c_check_channel value will occur once in the tb, + -- because stimuli_sosi.channel keeps incrementing. Choosing c_check_channel + -- such that it corresponds with a channel from stimuli on a sync pulse. CONSTANT c_check_channel : NATURAL := g_nof_blocks_per_sync; -- can be c_check_channel MOD g_nof_blocks_per_sync = 0 but not larger than c_nof_blk. SIGNAL dp_clk : STD_LOGIC := '1'; -- GitLab