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 8e15f495d080bb8494b4d3b8fbe39604d861de94..879bc4cfe166f7920a74ea04833ea2cf9a8b4005 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;