From 1716d488260723ffcbcfd112629fba2ffad3fcd8 Mon Sep 17 00:00:00 2001 From: Eric Kooistra <kooistra@astron.nl> Date: Wed, 9 Aug 2023 13:08:35 +0200 Subject: [PATCH] Add merged payload error bit support in design and in tb. --- .../tb_lofar2_unb2c_sdp_station_bf_ring.vhd | 35 ++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf_ring/tb_lofar2_unb2c_sdp_station_bf_ring.vhd b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf_ring/tb_lofar2_unb2c_sdp_station_bf_ring.vhd index 8e15f495d0..879bc4cfe1 100644 --- a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf_ring/tb_lofar2_unb2c_sdp_station_bf_ring.vhd +++ b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf_ring/tb_lofar2_unb2c_sdp_station_bf_ring.vhd @@ -105,6 +105,9 @@ -- * The c_wg_phase_offset and c_subband_phase_offset are used to tune the WG -- phase reference to 0.0 degrees at the start (sop) -- * Use g_beamlet_scale = 2**10, for full scale WG and N_ant = 1, see [1] +-- * A simulation only section in sdp_beamformer_output.vhd disturbs the BSN, +-- to cause a merged payload error, so that sdp_source_info_payload_error +-- can be verified here. -- -- Usage: -- > as 7 # default @@ -1372,15 +1375,39 @@ begin rx_sdp_cep_header <= func_sdp_map_cep_header(rx_hdr_fields_raw); p_verify_cep_header : process - variable v_bool : boolean; + variable v_pkt_cnt : natural; + variable v_new_pkt : boolean; + variable v_error : std_logic := '0'; + variable v_bsn : natural := 0; + variable v_bool : boolean; begin wait until rising_edge(ext_clk); + -- Count packets per beamset + v_pkt_cnt := rx_beamlet_sop_cnt / c_sdp_N_beamsets; + v_new_pkt := rx_beamlet_sop_cnt mod c_sdp_N_beamsets = 0; -- Prepare exp_sdp_cep_header at sop, so that it can be verified at eop if rx_beamlet_sosi.sop = '1' then - -- Expected BSN increments by c_sdp_cep_nof_blocks_per_packet = 4 blocks per packet - if rx_beamlet_sop_cnt mod c_sdp_N_beamsets = 0 then - exp_dp_bsn <= c_init_bsn + (rx_beamlet_sop_cnt / c_sdp_N_beamsets) * c_sdp_cep_nof_blocks_per_packet; + -- Expected BSN increments by c_sdp_cep_nof_blocks_per_packet = 4 blocks per packet, + -- both beamsets are outputting packets. + if v_new_pkt then + -- Default expected + v_error := '0'; + v_bsn := c_init_bsn + v_pkt_cnt * c_sdp_cep_nof_blocks_per_packet; + + -- Expected due to bsn and payload_error stimuli in sdp_beamformer_output.vhd. + if v_pkt_cnt = 1 then + v_error := '1'; + elsif v_pkt_cnt = 2 or v_pkt_cnt = 3 then + v_bsn := v_bsn + 1; + elsif v_pkt_cnt = 4 then + v_bsn := v_bsn + 1; + v_error := '1'; + end if; + + -- Apply expected values + exp_payload_error <= v_error; + exp_dp_bsn <= v_bsn; end if; end if; -- GitLab