diff --git a/applications/lofar2/libraries/sdp/src/vhdl/sdp_bdo_multiple_destinations.vhd b/applications/lofar2/libraries/sdp/src/vhdl/sdp_bdo_multiple_destinations.vhd index bc9583249acf975ca73b519e3a8c0a4ef98fd76e..92652bd524c2fca17e33044049807dd98d1c99d2 100644 --- a/applications/lofar2/libraries/sdp/src/vhdl/sdp_bdo_multiple_destinations.vhd +++ b/applications/lofar2/libraries/sdp/src/vhdl/sdp_bdo_multiple_destinations.vhd @@ -68,41 +68,28 @@ entity sdp_bdo_multiple_destinations is end sdp_bdo_multiple_destinations; architecture str of sdp_bdo_multiple_destinations is - constant c_nof_blocks_per_packet : natural := c_sdp_cep_nof_blocks_per_packet; -- = 4 - constant c_nof_beamlets_per_block : natural := c_sdp_S_sub_bf; -- = 488 dual pol beamlets - constant c_nof_words_per_beamlet : natural := 1; -- 1 dual pol beamlet data per 32b word - -- Reorder c_nof_ch = c_nof_ch_sel = c_nof_ch_in constant c_reorder_nof_blocks_max : natural := c_sdp_bdo_reorder_nof_blocks_max; -- = 16 constant c_reorder_nof_blocks_w : natural := ceil_log2(c_reorder_nof_blocks_max + 1); constant c_reorder_nof_ch_max : natural := c_reorder_nof_blocks_max * - c_nof_beamlets_per_block * - c_nof_words_per_beamlet; -- = 7808 + c_sdp_nof_beamlets_per_block * + c_sdp_nof_words_per_beamlet; -- = 7808 -- Look up table constants as function of N_destinations - constant c_m : natural := c_sdp_bdo_nof_destinations_max; -- 16 - constant c_nof_blocks_per_packet_arr : t_natural_arr(1 to c_m) := func_sdp_bdo_nof_blocks_per_packet_look_up_table; - constant c_reorder_nof_blocks_arr : t_natural_arr(1 to c_m) := func_sdp_bdo_reorder_nof_blocks_look_up_table; - constant c_reorder_nof_ch_arr : t_natural_arr(1 to c_m) := func_sdp_bdo_reorder_nof_ch_look_up_table; - constant c_nof_beamlets_per_block_first_destination_arr : t_natural_arr(1 to c_m) := func_sdp_sdo_nof_beamlets_per_block_first_destination_look_up_table; - constant c_nof_beamlets_per_block_last_destination_arr : t_natural_arr(1 to c_m) := func_sdp_sdo_nof_beamlets_per_block_last_destination_look_up_table; - constant c_sdp_sdo_nof_ch_per_packet_first_destination_arr : t_natural_arr(1 to c_m) := func_sdp_sdo_nof_ch_per_packet_first_destination_look_up_table; - constant c_sdp_sdo_nof_ch_per_packet_last_destination_arr : t_natural_arr(1 to c_m) := func_sdp_sdo_nof_ch_per_packet_last_destination_look_up_table; + constant c_m : natural := c_sdp_bdo_nof_destinations_max; -- 16 + constant c_nof_blocks_per_packet_arr : t_natural_arr(1 to c_m) := func_sdp_bdo_nof_blocks_per_packet_look_up_table; + constant c_reorder_nof_blocks_arr : t_natural_arr(1 to c_m) := func_sdp_bdo_reorder_nof_blocks_look_up_table; + constant c_reorder_nof_ch_arr : t_natural_arr(1 to c_m) := func_sdp_bdo_reorder_nof_ch_look_up_table; + constant c_nof_beamlets_per_block_first_destination_arr : t_natural_arr(1 to c_m) := func_sdp_sdo_nof_beamlets_per_block_first_destination_look_up_table; + constant c_nof_beamlets_per_block_last_destination_arr : t_natural_arr(1 to c_m) := func_sdp_sdo_nof_beamlets_per_block_last_destination_look_up_table; + constant c_nof_ch_per_packet_first_destination_arr : t_natural_arr(1 to c_m) := func_sdp_sdo_nof_ch_per_packet_first_destination_look_up_table; + constant c_nof_ch_per_packet_last_destination_arr : t_natural_arr(1 to c_m) := func_sdp_sdo_nof_ch_per_packet_last_destination_look_up_table; constant c_beamlet_index_per_destination_mat : t_natural_matrix(1 to c_m, 0 to c_m - 1) := func_sdp_sdo_beamlet_index_per_destination_look_up_matrix; --- -- Use c_transpose_indices and c_transpose_indices_inv for debug view in Objects window. --- -- Use c_transpose_indices for func_reorder_transpose() in this sdp_bdo_multiple_destinations, --- -- a tb can then use c_transpose_indices_inv to undo the transpose. --- constant c_transpose_indices : t_natural_arr(0 to c_nof_ch - 1) := --- func_reorder_transpose_indices(c_nof_blocks_per_packet, --- c_nof_beamlets_per_block, --- c_nof_words_per_beamlet); --- constant c_transpose_indices_inv : t_natural_arr(0 to c_nof_ch - 1) := --- func_reorder_transpose_indices(c_nof_beamlets_per_block, --- c_nof_blocks_per_packet, --- c_nof_words_per_beamlet); + constant c_nof_ch_per_packet_max : natural := largest(c_nof_ch_per_packet_first_destination_arr); + constant c_nof_ch_per_packet_w : natural := ceil_log2(c_nof_ch_per_packet_max + 1); signal i_destinations_info : t_sdp_bdo_destinations_info; @@ -115,8 +102,11 @@ architecture str of sdp_bdo_multiple_destinations is signal nof_beamlets_per_block_first_destination : natural := c_nof_beamlets_per_block_first_destination_arr(1); signal nof_beamlets_per_block_last_destination : natural := c_nof_beamlets_per_block_last_destination_arr(1); signal nof_beamlets_per_block : natural; - signal nof_ch_per_packet_first_destination : natural := c_sdp_sdo_nof_ch_per_packet_first_destination_arr(1); - signal nof_ch_per_packet_last_destination : natural := c_sdp_sdo_nof_ch_per_packet_last_destination_arr(1); + signal nof_ch_per_packet_first_destination : natural := c_nof_ch_per_packet_first_destination_arr(1); + signal nof_ch_per_packet_last_destination : natural := c_nof_ch_per_packet_last_destination_arr(1); + signal nof_ch_per_packet : natural; + signal nof_ch_per_packet_slv : std_logic_vector(c_nof_ch_per_packet_w - 1 downto 0); + -- . default use values for N_destinations = 1 and destination index = 0 signal beamlet_index_per_destination : natural := c_beamlet_index_per_destination_mat(1, 0); @@ -179,6 +169,7 @@ begin end process; nof_beamlets_per_block <= nof_beamlets_per_block_first_destination; + nof_ch_per_packet <= nof_ch_per_packet_first_destination; ----------------------------------------------------------------------------- -- dp_packet_merge @@ -294,25 +285,26 @@ begin ----------------------------------------------------------------------------- -- dp_packet_unmerge for N_destinations ----------------------------------------------------------------------------- + nof_ch_per_packet_slv <= to_uvec(nof_ch_per_packet, c_nof_ch_per_packet_w); + u_dp_packet_unmerge : entity dp_lib.dp_packet_unmerge generic map ( g_use_ready => false, -- no flow control g_nof_pkt => c_reorder_nof_blocks_max, - g_pkt_len => 99, -- Length of the unmerged packets + g_pkt_len => c_nof_ch_per_packet_max, g_bsn_increment => 1 ) port map ( rst => dp_rst, clk => dp_clk, + pkt_len => nof_ch_per_packet_slv, + pkt_len_out => open, -- Valid at src_out.sop + snk_in => reorder_src_out, src_out => unmerge_src_out ); - -- TODO: - -- . add dynamic pkt_len input port - -- . support unmerge of pkt_len and remaining last packet shorter than pkt_len. - -- Debug signals for view in Wave window unmerge_word <= unpack_data(unmerge_src_out.data(c_sdp_W_dual_pol_beamlet - 1 downto 0)); end str;