diff --git a/applications/lofar2/libraries/sdp/src/vhdl/sdp_beamformer_output.vhd b/applications/lofar2/libraries/sdp/src/vhdl/sdp_beamformer_output.vhd index ecf7c188d520a23fcb59490729641fc08fbee70b..f730e3020f1946aa6448e27340443a8283a005d9 100644 --- a/applications/lofar2/libraries/sdp/src/vhdl/sdp_beamformer_output.vhd +++ b/applications/lofar2/libraries/sdp/src/vhdl/sdp_beamformer_output.vhd @@ -319,34 +319,36 @@ begin ----------------------------------------------------------------------------- -- Register output info dependent on DN and DI to ease timing closure p_reg : process(dp_clk) - variable v_DN : natural; -- number of destinations variable v_DI : natural; -- destination index begin if rising_edge(dp_clk) then - v_DN := multi_destinations_info.nof_destinations_act; - v_DI := to_uint(dp_fifo_data_src_out.channel); - - s_DN <= v_DN; - s_DI <= v_DI; - - -- Variable values that depend on DN set via MM and/or on current DI - -- from dp_packet_unmerged that is passed on via - -- dp_fifo_data_src_out.channel. - -- . Use s_DN to ease timing closure. Use v_DI to ensure that the mdi - -- values are valid at dp_pipeline_data_src_out.sop - mdi_eth_dst_mac <= multi_destinations_info.eth_destination_mac_arr(v_DI); - mdi_ip_dst_addr <= multi_destinations_info.ip_destination_address_arr(v_DI); - mdi_udp_dst_port <= multi_destinations_info.udp_destination_port_arr(v_DI); - - -- . Account for beamset offset in beamlet index - mdi_beamlet_index_per_destination <= c_beamset_beamlet_index + c_beamlet_index_per_destination_mat(s_DN, v_DI); - -- . In total there are S_sub_bf = 488 beamlets for nof_destinations. - -- The packet for last destination contains the same number of - -- beamlets as the first destinations, or less beamlets. - if v_DI < s_DN - 1 then - mdi_nof_beamlets_per_block_per_destination <= mdi_nof_beamlets_per_block_first_destinations; - else - mdi_nof_beamlets_per_block_per_destination <= mdi_nof_beamlets_per_block_last_destination; + -- Register number of destinations (DN) + s_DN <= multi_destinations_info.nof_destinations_act; + + -- Capture destination index (DI) from channel field, valid at sop + if dp_fifo_data_src_out.sop = '1' then + v_DI := to_uint(dp_fifo_data_src_out.channel); + s_DI <= v_DI; -- for view in Wave window + + -- Variable values that depend on DN set via MM and/or on current DI + -- from dp_packet_unmerged that is passed on via + -- dp_fifo_data_src_out.channel. + -- . Use s_DN to ease timing closure. Use v_DI to ensure that the mdi + -- values are valid at dp_pipeline_data_src_out.sop + mdi_eth_dst_mac <= multi_destinations_info.eth_destination_mac_arr(v_DI); + mdi_ip_dst_addr <= multi_destinations_info.ip_destination_address_arr(v_DI); + mdi_udp_dst_port <= multi_destinations_info.udp_destination_port_arr(v_DI); + + -- . Account for beamset offset in beamlet index + mdi_beamlet_index_per_destination <= c_beamset_beamlet_index + c_beamlet_index_per_destination_mat(s_DN, v_DI); + -- . In total there are S_sub_bf = 488 beamlets for nof_destinations. + -- The packet for last destination contains the same number of + -- beamlets as the first destinations, or less beamlets. + if v_DI < s_DN - 1 then + mdi_nof_beamlets_per_block_per_destination <= mdi_nof_beamlets_per_block_first_destinations; + else + mdi_nof_beamlets_per_block_per_destination <= mdi_nof_beamlets_per_block_last_destination; + end if; end if; end if; end process; @@ -408,15 +410,25 @@ begin ); -- FIFO: to store and align payload error bit from eop to sop - -- Simple fifo to store the payload error bit at eop of FIFO input to be used - -- at sop of FIFO output, so that payload_err can then be used in the packet - -- header. Typically the u_dp_fifo_data will store between 0 and - -- c_sdp_N_beamsets = 2 packets. Choose g_nof_words > c_sdp_N_beamsets to - -- have some margin compared to c_fifo_size of the data FIFO. + -- . The payload error bit is set when dp_packet_merge detects an BSN + -- increment error. The dual page mechanism in reorder_col_select makes + -- that the sosi.err bit will be valid during the entire output packet, + -- so that it can be passed on at the sop via the application header. + -- For g_nof_destinations > 1 each destination packet will have its + -- payload error bit set as well, because dp_packet_unmerge applies the + -- input sosi.err at the sop to all unmerged output packets. + -- . Simple fifo to store the payload error bit at eop of FIFO input to be + -- used at sop of FIFO output, so that payload_err can then be used in + -- the packet header. Typically the u_dp_fifo_data will store between 0 + -- and c_sdp_N_beamsets = 2 packets. Choose g_nof_words > c_sdp_N_beamsets + -- to have some margin compared to c_fifo_size of the data FIFO. + -- . No need to account for g_nof_destinations_max > 1 in FIFO g_nof_words, + -- because the BDO packets are multiplexed round-robin with fair chance + -- per beamset by the dp_mux in sdp_station.vhd u_common_fifo_err : entity common_lib.common_fifo_sc generic map ( g_dat_w => 1, - g_nof_words => g_nof_destinations_max * c_sdp_N_beamsets + 2 + g_nof_words => c_sdp_N_beamsets + 2 ) port map ( rst => dp_rst,