diff --git a/applications/lofar2/libraries/sdp/src/vhdl/sdp_statistics_offload.vhd b/applications/lofar2/libraries/sdp/src/vhdl/sdp_statistics_offload.vhd index e794ec2b90f0d01d19139365c1c67f7b2100d8a5..d1d166a6652a87dea6e7ecaf8980432e3f11685f 100644 --- a/applications/lofar2/libraries/sdp/src/vhdl/sdp_statistics_offload.vhd +++ b/applications/lofar2/libraries/sdp/src/vhdl/sdp_statistics_offload.vhd @@ -99,12 +99,12 @@ ARCHITECTURE str OF sdp_statistics_offload IS CONSTANT c_nof_statistics_per_packet : NATURAL := func_sdp_get_stat_nof_statistics_per_packet(g_statistics_type); CONSTANT c_udp_total_length : NATURAL := func_sdp_get_stat_udp_total_length(g_statistics_type); CONSTANT c_ip_total_length : NATURAL := func_sdp_get_stat_ip_total_length(g_statistics_type); - CONSTANT c_nof_packets : NATURAL := func_sdp_get_stat_nof_packets(g_statistics_type, c_sdp_S_pn, g_P_sq); + CONSTANT c_nof_packets_max : NATURAL := func_sdp_get_stat_nof_packets(g_statistics_type, c_sdp_S_pn, g_P_sq, c_sdp_N_crosslets_max); CONSTANT c_beamlet_id : NATURAL := g_beamset_id * c_sdp_S_sub_bf; -- payload data - CONSTANT c_data_size : NATURAL := c_sdp_stat_data_sz; -- = 2 + CONSTANT c_data_size : NATURAL := c_sdp_W_statistic_sz; -- = 2 -- Note: -- . c_nof_data_per_step = 2 for all g_statistics_type, but for different -- reasons, because c_sdp_N_pol_bf = c_nof_complex = c_sdp_Q_fft = 2 @@ -139,6 +139,9 @@ ARCHITECTURE str OF sdp_statistics_offload IS SIGNAL r : t_reg; SIGNAL nxt_r : t_reg; + SIGNAL gn_index_reg : NATURAL; + SIGNAL rn_index_reg : NATURAL; + SIGNAL trigger : STD_LOGIC := '0'; SIGNAL done : STD_LOGIC := '0'; SIGNAL dp_block_from_mm_src_out : t_dp_sosi; @@ -220,12 +223,15 @@ BEGIN END IF; END PROCESS; - p_control_packet_offload : PROCESS(r, gn_index, in_sosi, trigger, done, dp_header_info, selected_crosslet_arr, nof_crosslets) + gn_index_reg <= gn_index WHEN rising_edge(dp_clk); + rn_index_reg <= gn_index - TO_UINT(sdp_info.O_rn) WHEN rising_edge(dp_clk); + + p_control_packet_offload : PROCESS(r, gn_index_reg, in_sosi, trigger, done, dp_header_info, selected_crosslet_arr, nof_crosslets) VARIABLE v: t_reg; BEGIN v := r; v.start_pulse := '0'; - v.nof_cycles_dly := gn_index * g_offload_time; + v.nof_cycles_dly := gn_index_reg * g_offload_time; -- Count number of sop's in a sync interval and get payload errors and keep them till next sync. IF in_sosi.sync = '1' THEN @@ -243,14 +249,15 @@ BEGIN END IF; -- assign sdp_data_id for different statistic types + v.data_id := x"00000000"; IF g_statistics_type = "SST" THEN - v.data_id := x"000000" & TO_UVEC(r.block_count + c_sdp_S_pn * gn_index, 8); + v.data_id(7 DOWNTO 0) := TO_UVEC(r.block_count + c_sdp_S_pn * gn_index_reg, 8); ELSIF g_statistics_type = "BST" THEN - v.data_id := x"0000" & TO_UVEC(c_beamlet_id, 16); + v.data_id(15 DOWNTO 0) := TO_UVEC(c_beamlet_id, 16); ELSIF g_statistics_type = "XST" THEN - v.data_id := x"0" & "000" & RESIZE_UVEC(selected_crosslet_arr(r.crosslet_count), 9) & TO_UVEC(r.block_count * c_sdp_S_pn, 8) & TO_UVEC(r.block_count * c_sdp_S_pn, 8); -- RW TODO: define for P_sq > 1 - ELSE - v.data_id := x"00000000"; + v.data_id(24 DOWNTO 16) := RESIZE_UVEC(selected_crosslet_arr(r.crosslet_count), 9); + v.data_id(15 DOWNTO 8) := TO_UVEC(r.block_count * c_sdp_S_pn, 8); + v.data_id(7 DOWNTO 0) := TO_UVEC(r.block_count * c_sdp_S_pn, 8); -- RW TODO: define for P_sq > 1 END IF; -- Issue start_pulse per packet offload @@ -263,7 +270,7 @@ BEGIN v.nof_crosslets := TO_UINT(nof_crosslets); -- register nof_crosslets to make sure it does not change during packet output. ELSIF done = '1' THEN -- Use done to start next packets - IF r.block_count < c_nof_packets-1 THEN + IF r.block_count < c_nof_packets_max-1 THEN IF g_statistics_type /= "XST" OR r.crosslet_count < r.nof_crosslets-1 THEN -- For SST, BST and for XST nof_crosslets do: IF r.block_count MOD c_nof_data_per_step = 0 THEN @@ -312,7 +319,7 @@ BEGIN trigger_dly => trigger ); - u_dp_block_from_mm : ENTITY dp_lib.dp_block_from_mm_dc + u_dp_block_from_mm_dc : ENTITY dp_lib.dp_block_from_mm_dc GENERIC MAP ( g_data_size => c_data_size, g_step_size => c_step_size,