diff --git a/applications/disturb2/designs/disturb2_unb2b_station/src/vhdl/disturb2_unb2b_station.vhd b/applications/disturb2/designs/disturb2_unb2b_station/src/vhdl/disturb2_unb2b_station.vhd index 5196dec8760d16e753405a7fcd2b0e70add4cb61..03625482a6a03f36a216b5df8a359b15d453b7f5 100644 --- a/applications/disturb2/designs/disturb2_unb2b_station/src/vhdl/disturb2_unb2b_station.vhd +++ b/applications/disturb2/designs/disturb2_unb2b_station/src/vhdl/disturb2_unb2b_station.vhd @@ -48,7 +48,6 @@ ENTITY disturb2_unb2b_station IS GENERIC ( g_design_name : STRING := "disturb2_unb2b_station"; g_design_note : STRING := "UNUSED"; - g_technology : NATURAL := c_tech_arria10_e1sg; g_sim : BOOLEAN := FALSE; --Overridden by TB g_sim_unb_nr : NATURAL := 0; g_sim_node_nr : NATURAL := 0; @@ -492,7 +491,6 @@ BEGIN u_ctrl : ENTITY unb2b_board_lib.ctrl_unb2b_board GENERIC MAP ( g_sim => g_sim, - g_technology => g_technology, g_design_name => g_design_name, g_design_note => g_design_note, g_stamp_date => g_stamp_date, @@ -806,7 +804,6 @@ BEGIN ----------------------------------------------------------------------------- u_disturb_station : ENTITY disturb_lib.disturb_station GENERIC MAP ( - g_technology => c_tech_arria10_e1sg, g_sim => g_sim, g_wpfb => g_wpfb, g_bsn_nof_clk_per_sync => g_bsn_nof_clk_per_sync, diff --git a/applications/disturb2/libraries/disturb/src/vhdl/disturb_crosslets_subband_select.vhd b/applications/disturb2/libraries/disturb/src/vhdl/disturb_crosslets_subband_select.vhd index 3875533995451430a2a61970ae8c48b16e659e29..973d573af2835657364bdf570a63d356df7eefab 100644 --- a/applications/disturb2/libraries/disturb/src/vhdl/disturb_crosslets_subband_select.vhd +++ b/applications/disturb2/libraries/disturb/src/vhdl/disturb_crosslets_subband_select.vhd @@ -344,7 +344,7 @@ BEGIN clk => dp_clk, in_en => row_sosi.sync, in_dat => active_crosslets_info, - out_dat => i_out_crosslets_info + out_dat => cur_crosslets_info ); u_common_pipeline_prev : ENTITY common_lib.common_pipeline diff --git a/applications/disturb2/libraries/disturb/src/vhdl/disturb_pkg.vhd b/applications/disturb2/libraries/disturb/src/vhdl/disturb_pkg.vhd index ca9e7bc573a8384f04fdf7a4aa06d2aa5d5cb87c..2350b25a56aa602a08c12078e835404c5b577b15 100644 --- a/applications/disturb2/libraries/disturb/src/vhdl/disturb_pkg.vhd +++ b/applications/disturb2/libraries/disturb/src/vhdl/disturb_pkg.vhd @@ -123,7 +123,7 @@ PACKAGE disturb_pkg is CONSTANT c_disturb_N_clk_sync_timeout : NATURAL := c_disturb_f_adc_MHz*10**6 + c_disturb_f_adc_MHz*10**5; -- 10% margin. CONSTANT c_disturb_N_clk_sync_timeout_xsub : NATURAL := 2147483647; -- = 2**31 - 1 = largest value for NATURAL for 10.7 seconds. Do not use 2*31 to avoid Modelsim NATURAL overflow warning. CONSTANT c_disturb_N_sync_jesd : NATURAL := c_disturb_S_pn * c_disturb_N_sync_rcu / c_disturb_S_rcu; -- = 4, nof JESD IP sync outputs per PN - CONSTANT c_disturb_f_sub_Hz : REAL := REAL(c_disturb_f_adc_MHz * 10**6) / REAL(c_sdp_N_fft); -- = 195312.5 + CONSTANT c_disturb_f_sub_Hz : REAL := REAL(c_disturb_f_adc_MHz * 10**6) / REAL(c_disturb_N_fft); -- = 195312.5 CONSTANT c_disturb_N_int : NATURAL := c_disturb_f_adc_MHz * 10**6; -- nof ADC sample periods per 1 s integration interval CONSTANT c_disturb_N_int_sub : REAL := c_disturb_f_sub_Hz; -- nof subband sample periods per 1 s integration interval CONSTANT c_disturb_N_int_sub_lo : NATURAL := NATURAL(FLOOR(c_disturb_N_int_sub)); -- = 195312 @@ -513,7 +513,7 @@ PACKAGE disturb_pkg is step : NATURAL; END RECORD; - CONSTANT c_disturb_crosslets_info_rst : t_sdp_crosslets_info := (offset_arr => (OTHERS => 0), step => 0); + CONSTANT c_disturb_crosslets_info_rst : t_disturb_crosslets_info := (offset_arr => (OTHERS => 0), step => 0); CONSTANT c_disturb_mm_reg_nof_crosslets : t_c_mem := (latency => 1, adr_w => 1, diff --git a/applications/disturb2/libraries/disturb/src/vhdl/disturb_station.vhd b/applications/disturb2/libraries/disturb/src/vhdl/disturb_station.vhd index 69654503bccfb9181fc0f192532b071153a86fd7..6edc080c1883c354ea5dd80a5b1bf66b6a6cd1a8 100644 --- a/applications/disturb2/libraries/disturb/src/vhdl/disturb_station.vhd +++ b/applications/disturb2/libraries/disturb/src/vhdl/disturb_station.vhd @@ -1038,8 +1038,8 @@ BEGIN snk_in_arr => bf_udp_sosi_arr, snk_out_arr => bf_udp_siso_arr, - src_out => nw_10gbe_snk_in_arr(0), - src_in => nw_10gbe_snk_out_arr(0) + src_out => nw_10gbe_beamlet_output_snk_in_arr(0), + src_in => nw_10gbe_beamlet_output_snk_out_arr(0) ); --------------- diff --git a/applications/disturb2/libraries/disturb/src/vhdl/disturb_statistics_offload.vhd b/applications/disturb2/libraries/disturb/src/vhdl/disturb_statistics_offload.vhd index 9975c01c1890a32c4c50a72906364c259d0cdbd9..33e57beb33e5d3434c3075776103c2102fd24774 100644 --- a/applications/disturb2/libraries/disturb/src/vhdl/disturb_statistics_offload.vhd +++ b/applications/disturb2/libraries/disturb/src/vhdl/disturb_statistics_offload.vhd @@ -357,7 +357,7 @@ BEGIN data_id_slv <= func_disturb_map_stat_data_id(g_statistics_type, data_id_rec); - p_control_packet_offload : PROCESS(r, in_sosi, local_si_offset, trigger_offload, nof_crosslets, crosslets_info, nof_packets, dp_sop, dp_header_info) + p_control_packet_offload : PROCESS(r, in_sosi, local_si_offset, trigger_offload, nof_crosslets, crosslets_info_rec, nof_packets, dp_sop, dp_header_info) VARIABLE v : t_reg; VARIABLE v_index : NATURAL; BEGIN @@ -584,7 +584,7 @@ BEGIN -- Debug signal, r_dp_header_rec must be available at the r_dp_header_sop r_dp_header_sop <= dp_offload_snk_in.sop; - r_dp_header_rec <= func_sdp_map_stat_header(r.dp_header_info); + r_dp_header_rec <= func_disturb_map_stat_header(r.dp_header_info); out_sosi <= udp_sosi; diff --git a/applications/disturb2/libraries/disturb/src/vhdl/node_disturb_adc_input_and_timing.vhd b/applications/disturb2/libraries/disturb/src/vhdl/node_disturb_adc_input_and_timing.vhd index 0178f116ae486dccf3f00aa0eee9d09b32b2e7a1..bbeabb00c4c1bd0c35f1e9b52c1a46c71e713200 100644 --- a/applications/disturb2/libraries/disturb/src/vhdl/node_disturb_adc_input_and_timing.vhd +++ b/applications/disturb2/libraries/disturb/src/vhdl/node_disturb_adc_input_and_timing.vhd @@ -143,7 +143,7 @@ ARCHITECTURE str OF node_disturb_adc_input_and_timing IS SIGNAL mm_rst_jesd : STD_LOGIC; SIGNAL mm_jesd_ctrl_reg_wr : STD_LOGIC_VECTOR(c_word_w-1 DOWNTO 0); SIGNAL mm_jesd_ctrl_reg_rd : STD_LOGIC_VECTOR(c_word_w-1 DOWNTO 0); - SIGNAL jesd204b_disable_arr : STD_LOGIC_VECTOR(c_sdp_S_pn-1 DOWNTO 0); + SIGNAL jesd204b_disable_arr : STD_LOGIC_VECTOR(c_disturb_S_pn-1 DOWNTO 0); SIGNAL jesd204b_reset_request : STD_LOGIC := '0'; BEGIN @@ -168,15 +168,15 @@ BEGIN -- JESD204B IP reset causes that the rx_clk stops. mm_rst_jesd <= mm_rst OR jesd204b_reset_request; - jesd204b_disable_arr <= mm_jesd_ctrl_reg_wr(c_sdp_S_pn-1 DOWNTO 0); - jesd204b_reset_request <= mm_jesd_ctrl_reg_wr(c_sdp_jesd_ctrl_reset_bi) AND NOT bs_sosi.valid; + jesd204b_disable_arr <= mm_jesd_ctrl_reg_wr(c_disturb_S_pn-1 DOWNTO 0); + jesd204b_reset_request <= mm_jesd_ctrl_reg_wr(c_disturb_jesd_ctrl_reset_bi) AND NOT bs_sosi.valid; p_mm_jesd_ctrl_reg_rd : PROCESS(mm_jesd_ctrl_reg_wr, jesd204b_reset_request) BEGIN -- default readback what was written mm_jesd_ctrl_reg_rd <= mm_jesd_ctrl_reg_wr; -- report actual JESD204B reset status - mm_jesd_ctrl_reg_rd(c_sdp_jesd_ctrl_reset_bi) <= jesd204b_reset_request; + mm_jesd_ctrl_reg_rd(c_disturb_jesd_ctrl_reset_bi) <= jesd204b_reset_request; END PROCESS; gen_jesd : IF g_no_jesd = FALSE GENERATE diff --git a/applications/disturb2/libraries/disturb/tb/vhdl/tb_disturb_crosslets_subband_select.vhd b/applications/disturb2/libraries/disturb/tb/vhdl/tb_disturb_crosslets_subband_select.vhd index b38b1ed12f472fce3f7b51be4d4ea8b56f82bcd3..fcc19902b7c75d8d3c41fa5f6fa23d214c7f267f 100644 --- a/applications/disturb2/libraries/disturb/tb/vhdl/tb_disturb_crosslets_subband_select.vhd +++ b/applications/disturb2/libraries/disturb/tb/vhdl/tb_disturb_crosslets_subband_select.vhd @@ -30,7 +30,7 @@ -- Description: The tb starts the dut by writing a scheduled bsn to the bsn_scheduler -- via MM. The offsets and step are configured using MM. The dut makes the subband -- selection based on the MM configuration and N_crosslets. The TB then verifies out_sosi --- and out_crosslets_info of the dut by comparing it to the expected output. +-- and cur_crosslets_info of the dut by comparing it to the expected output. LIBRARY IEEE, common_lib, dp_lib; USE IEEE.std_logic_1164.ALL; @@ -84,20 +84,19 @@ ARCHITECTURE tb OF tb_disturb_crosslets_subband_select IS SIGNAL mm_trigger_miso : t_mem_miso; SIGNAL st_en : STD_LOGIC := '1'; + SIGNAL st_bsn : NATURAL := c_scheduled_bsn - c_nof_block_dly; SIGNAL st_siso_arr : t_dp_siso_arr(c_disturb_P_pfb-1 DOWNTO 0) := (OTHERS => c_dp_siso_rdy); SIGNAL st_sosi_arr : t_dp_sosi_arr(c_disturb_P_pfb-1 DOWNTO 0) := (OTHERS => c_dp_sosi_rst); SIGNAL exp_sosi : t_dp_sosi := c_dp_sosi_rst; - SIGNAL bsn : NATURAL := c_scheduled_bsn - c_nof_block_dly; - SIGNAL in_sosi_arr : t_dp_sosi_arr(c_disturb_P_pfb-1 DOWNTO 0) := (OTHERS => c_dp_sosi_rst); SIGNAL out_sosi : t_dp_sosi; - SIGNAL exp_crosslets_info_slv : STD_LOGIC_VECTOR(c_disturb_crosslets_info_reg_w-1 DOWNTO 0) := (OTHERS => '0'); - SIGNAL out_crosslets_info_slv : STD_LOGIC_VECTOR(c_disturb_crosslets_info_reg_w-1 DOWNTO 0) := (OTHERS => '0'); - SIGNAL exp_crosslets_info_rec : t_disturb_crosslets_info; - SIGNAL out_crosslets_info_rec : t_disturb_crosslets_info; + SIGNAL exp_cur_crosslets_info_rec : t_disturb_crosslets_info; + SIGNAL cur_crosslets_info_rec : t_disturb_crosslets_info; + SIGNAL exp_prev_crosslets_info_rec : t_disturb_crosslets_info; + SIGNAL prev_crosslets_info_rec : t_disturb_crosslets_info; BEGIN @@ -106,7 +105,7 @@ BEGIN rst <= '1', '0' AFTER c_clk_period*7; p_mm_stimuli : PROCESS - VARIABLE k : NATURAL; + VARIABLE k : NATURAL; BEGIN proc_common_wait_until_low(mm_clk, rst); proc_common_wait_some_cycles(mm_clk, 50); -- Give dut some time to start @@ -141,7 +140,7 @@ BEGIN END LOOP; ASSERT rd_crosslet_step = 0 REPORT "Wrong crosslet step after rst." SEVERITY ERROR; - -- b) Read crosslet_info in every sync interval + -- b) Read crosslets_info in every sync interval WHILE TRUE LOOP proc_common_wait_until_hi_lo(clk, out_sosi.sync); proc_common_wait_cross_clock_domain_latency(c_clk_period, c_mm_clk_period); @@ -157,9 +156,9 @@ BEGIN proc_common_wait_some_cycles(mm_clk, 1); -- Verify that readback crosslet info is active crosslets_info FOR I IN 0 TO c_N_crosslets-1 LOOP - ASSERT rd_crosslet_offsets(I) = exp_crosslets_info_rec.offset_arr(I) REPORT "Wrong active crosslet offset in output sync interval." SEVERITY ERROR; + ASSERT rd_crosslet_offsets(I) = exp_cur_crosslets_info_rec.offset_arr(I) REPORT "Wrong active crosslet offset in output sync interval." SEVERITY ERROR; END LOOP; - ASSERT rd_crosslet_step = exp_crosslets_info_rec.step REPORT "Wrong active crosslet step in output sync interval." SEVERITY ERROR; + ASSERT rd_crosslet_step = exp_cur_crosslets_info_rec.step REPORT "Wrong active crosslet step in output sync interval." SEVERITY ERROR; END LOOP; WAIT; @@ -198,14 +197,14 @@ BEGIN END GENERATE; -- Time stimuli - bsn <= bsn + 1 WHEN rising_edge(clk) AND (st_sosi_arr(0).eop='1'); + st_bsn <= st_bsn + 1 WHEN rising_edge(clk) AND (st_sosi_arr(0).eop='1'); -- Add BSN to the ST data - p_in_sosi : PROCESS(st_sosi_arr, bsn) + p_in_sosi : PROCESS(st_sosi_arr, st_bsn) BEGIN + in_sosi_arr <= st_sosi_arr; FOR I IN 0 TO c_disturb_P_pfb-1 LOOP - in_sosi_arr(I) <= st_sosi_arr(I); - in_sosi_arr(I).bsn <= TO_DP_BSN(bsn); + in_sosi_arr(I).bsn <= TO_DP_BSN(st_bsn); END LOOP; END PROCESS; @@ -216,19 +215,28 @@ BEGIN VARIABLE v_col : NATURAL := 0; VARIABLE v_row : NATURAL := 0; VARIABLE v_offset : NATURAL := 0; - VARIABLE v_sync_ix : NATURAL := 0; + VARIABLE v_sync_ix : NATURAL := 0; -- ix = index VARIABLE v_k : NATURAL := 0; BEGIN FOR I IN 0 TO c_nof_sync*c_nof_block_per_sync-1 LOOP v_sync_ix := I / c_nof_block_per_sync; exp_sosi <= c_dp_sosi_rst; + + -- In a tb it is ok and it can be handy to use rising_edge() on a combinatorial signal WAIT UNTIL rising_edge(out_sosi.sop); - exp_crosslets_info_slv(c_disturb_crosslets_info_reg_w-1 DOWNTO c_disturb_crosslets_info_reg_w - c_disturb_crosslets_index_w) <= TO_UVEC(c_crosslet_step, c_disturb_crosslets_index_w); + -- Current sync interval crosslets_info + exp_cur_crosslets_info_rec.step <= c_crosslet_step; FOR C IN 0 TO c_nof_ch_sel_col-1 LOOP - exp_crosslets_info_slv((C+1)*c_disturb_crosslets_index_w-1 DOWNTO C*c_disturb_crosslets_index_w) <= TO_UVEC(c_crosslet_offsets(C) + v_sync_ix * c_crosslet_step, c_disturb_crosslets_index_w); + exp_cur_crosslets_info_rec.offset_arr(C) <= c_crosslet_offsets(C) + v_sync_ix * c_crosslet_step; END LOOP; + -- Previous sync interval crosslets_info + IF out_sosi.sync = '1' THEN + exp_prev_crosslets_info_rec <= exp_cur_crosslets_info_rec; + END IF; + + -- Crosslet data FOR J IN 0 TO c_nof_ch_sel-1 LOOP v_offset := J / (c_nof_ch_sel_col*c_nof_ch_sel_row); v_col := J MOD c_nof_ch_sel_col; @@ -241,7 +249,6 @@ BEGIN exp_sosi.sop <= '1'; IF I MOD c_nof_block_per_sync = 0 THEN exp_sosi.sync <= '1'; - END IF; ELSIF j = c_nof_ch_sel-1 THEN exp_sosi.eop <= '1'; @@ -250,8 +257,8 @@ BEGIN exp_sosi.re <= RESIZE_DP_DSP_DATA(TO_DP_DSP_DATA( (I + c_nof_block_dly) * c_nof_ch_in + v_k + c_nof_ch_sel_col*c_crosslet_offsets(v_offset) + v_col + v_row*2**5)(c_disturb_W_crosslet-1 DOWNTO 0)); exp_sosi.im <= RESIZE_DP_DSP_DATA(TO_DP_DSP_DATA(1+ (I + c_nof_block_dly) * c_nof_ch_in + v_k + c_nof_ch_sel_col*c_crosslet_offsets(v_offset) + v_col + v_row*2**5)(c_disturb_W_crosslet-1 DOWNTO 0)); proc_common_wait_some_cycles(clk, 1); - END LOOP; + exp_sosi <= c_dp_sosi_rst; END LOOP; WAIT; @@ -260,14 +267,17 @@ BEGIN p_verify_out_data : PROCESS(clk) BEGIN IF rising_edge(clk) THEN - ASSERT out_sosi.valid = exp_sosi.valid REPORT "Wrong out_sosi.valid" SEVERITY ERROR; - ASSERT out_sosi.sop = exp_sosi.sop REPORT "Wrong out_sosi.sop" SEVERITY ERROR; - ASSERT out_sosi.eop = exp_sosi.eop REPORT "Wrong out_sosi.eop" SEVERITY ERROR; - ASSERT out_sosi.sync = exp_sosi.sync REPORT "Wrong out_sosi.sync" SEVERITY ERROR; - ASSERT out_crosslets_info_slv = exp_crosslets_info_slv REPORT "Wrong out_crosslets_info_slv" SEVERITY ERROR; + ASSERT out_sosi.valid = exp_sosi.valid REPORT "Wrong out_sosi.valid" SEVERITY ERROR; + ASSERT out_sosi.sop = exp_sosi.sop REPORT "Wrong out_sosi.sop" SEVERITY ERROR; + ASSERT out_sosi.eop = exp_sosi.eop REPORT "Wrong out_sosi.eop" SEVERITY ERROR; + ASSERT out_sosi.sync = exp_sosi.sync REPORT "Wrong out_sosi.sync" SEVERITY ERROR; + + ASSERT cur_crosslets_info_rec = exp_cur_crosslets_info_rec REPORT "Wrong cur_crosslets_info" SEVERITY ERROR; + ASSERT prev_crosslets_info_rec = exp_prev_crosslets_info_rec REPORT "Wrong prev_crosslets_info" SEVERITY ERROR; + IF exp_sosi.valid = '1' THEN - ASSERT out_sosi.re = exp_sosi.re REPORT "Wrong out_sosi.re" SEVERITY ERROR; - ASSERT out_sosi.im = exp_sosi.im REPORT "Wrong out_sosi.im" SEVERITY ERROR; + ASSERT out_sosi.re = exp_sosi.re REPORT "Wrong out_sosi.re" SEVERITY ERROR; + ASSERT out_sosi.im = exp_sosi.im REPORT "Wrong out_sosi.im" SEVERITY ERROR; END IF; END IF; END PROCESS; @@ -294,11 +304,8 @@ BEGIN in_sosi_arr => in_sosi_arr, out_sosi => out_sosi, - out_crosslets_info => out_crosslets_info_slv + cur_crosslets_info_rec => cur_crosslets_info_rec, + prev_crosslets_info_rec => prev_crosslets_info_rec ); - -- Map crosslets_info slv to record for easier view in Wave window - exp_crosslets_info_rec <= func_disturb_map_crosslets_info(exp_crosslets_info_slv); - out_crosslets_info_rec <= func_disturb_map_crosslets_info(out_crosslets_info_slv); - END tb; diff --git a/applications/disturb2/libraries/disturb/tb/vhdl/tb_disturb_pkg.vhd b/applications/disturb2/libraries/disturb/tb/vhdl/tb_disturb_pkg.vhd index 21369e25f3028df1df1881a588ad3898da4b3c57..ff130189f91f5c03f1ffe410d0842fad584c5897 100644 --- a/applications/disturb2/libraries/disturb/tb/vhdl/tb_disturb_pkg.vhd +++ b/applications/disturb2/libraries/disturb/tb/vhdl/tb_disturb_pkg.vhd @@ -28,17 +28,45 @@ LIBRARY IEEE, common_lib; USE IEEE.std_logic_1164.ALL; USE common_lib.common_pkg.ALL; +USE common_lib.common_network_layers_pkg.ALL; USE work.disturb_pkg.ALL; PACKAGE tb_disturb_pkg is ----------------------------------------------------------------------------- -- Statistics offload ----------------------------------------------------------------------------- + FUNCTION func_disturb_compose_stat_header(eth_dst_mac : STD_LOGIC_VECTOR(47 DOWNTO 0); -- eth header + eth_src_mac : STD_LOGIC_VECTOR(47 DOWNTO 0); + ip_src_addr : STD_LOGIC_VECTOR(31 DOWNTO 0); -- ip header + ip_dst_addr : STD_LOGIC_VECTOR(31 DOWNTO 0); + disturb_info : t_disturb_info; -- app header + g_statistics_type : STRING; + weighted_subbands_flag : STD_LOGIC; + gn_index : NATURAL; + nof_block_per_sync : NATURAL; + sst_signal_input : NATURAL; + beamlet_index : NATURAL; + subband_index : NATURAL; + xst_signal_input_A : NATURAL; + xst_signal_input_B : NATURAL; + dp_bsn : NATURAL) RETURN t_disturb_stat_header; + FUNCTION func_disturb_verify_stat_header(g_statistics_type : STRING; in_hdr, exp_hdr : t_disturb_stat_header) RETURN BOOLEAN; ----------------------------------------------------------------------------- -- Beamlet output via 10GbE to CEP (= central processor) ----------------------------------------------------------------------------- + FUNCTION func_disturb_compose_cep_header(eth_dst_mac : STD_LOGIC_VECTOR(47 DOWNTO 0); -- eth header + eth_src_mac : STD_LOGIC_VECTOR(47 DOWNTO 0); + ip_src_addr : STD_LOGIC_VECTOR(31 DOWNTO 0); -- ip header + ip_dst_addr : STD_LOGIC_VECTOR(31 DOWNTO 0); + ip_header_checksum : NATURAL; + disturb_info : t_disturb_info; -- app header + gn_index : NATURAL; + beamlet_scale : NATURAL; + beamlet_index : NATURAL; + dp_bsn : NATURAL) RETURN t_disturb_cep_header; + FUNCTION func_disturb_verify_cep_header(in_hdr, exp_hdr : t_disturb_cep_header) RETURN BOOLEAN; @@ -46,6 +74,99 @@ END PACKAGE tb_disturb_pkg; PACKAGE BODY tb_disturb_pkg IS + FUNCTION func_disturb_compose_stat_header(eth_dst_mac : STD_LOGIC_VECTOR(47 DOWNTO 0); -- eth header + eth_src_mac : STD_LOGIC_VECTOR(47 DOWNTO 0); + ip_src_addr : STD_LOGIC_VECTOR(31 DOWNTO 0); -- ip header + ip_dst_addr : STD_LOGIC_VECTOR(31 DOWNTO 0); + disturb_info : t_disturb_info; -- app header + g_statistics_type : STRING; + weighted_subbands_flag : STD_LOGIC; + gn_index : NATURAL; + nof_block_per_sync : NATURAL; + sst_signal_input : NATURAL; + beamlet_index : NATURAL; + subband_index : NATURAL; + xst_signal_input_A : NATURAL; + xst_signal_input_B : NATURAL; + dp_bsn : NATURAL) RETURN t_disturb_stat_header IS + CONSTANT c_nof_statistics_per_packet : NATURAL := func_disturb_get_stat_nof_statistics_per_packet(g_statistics_type); + CONSTANT c_udp_total_length : NATURAL := func_disturb_get_stat_udp_total_length(g_statistics_type); + CONSTANT c_ip_total_length : NATURAL := func_disturb_get_stat_ip_total_length(g_statistics_type); + CONSTANT c_marker : NATURAL := func_disturb_get_stat_marker(g_statistics_type); + CONSTANT c_nof_signal_inputs : NATURAL := func_disturb_get_stat_nof_signal_inputs(g_statistics_type); + + VARIABLE v_hdr : t_disturb_stat_header; + BEGIN + -- eth header + v_hdr.eth.dst_mac := eth_dst_mac; + v_hdr.eth.src_mac := eth_src_mac; + v_hdr.eth.eth_type := x"0800"; + + -- ip header + v_hdr.ip.version := TO_UVEC( 4, c_network_ip_version_w); + v_hdr.ip.header_length := TO_UVEC( 5, c_network_ip_header_length_w); + v_hdr.ip.services := TO_UVEC( 0, c_network_ip_services_w); + v_hdr.ip.total_length := TO_UVEC(c_ip_total_length, c_network_ip_total_length_w); + v_hdr.ip.identification := TO_UVEC( 0, c_network_ip_identification_w); + v_hdr.ip.flags := TO_UVEC( 2, c_network_ip_flags_w); + v_hdr.ip.fragment_offset := TO_UVEC( 0, c_network_ip_fragment_offset_w); + v_hdr.ip.time_to_live := TO_UVEC( 127, c_network_ip_time_to_live_w); + v_hdr.ip.protocol := TO_UVEC( 17, c_network_ip_protocol_w); + v_hdr.ip.header_checksum := TO_UVEC( 0, c_network_ip_header_checksum_w); + v_hdr.ip.src_ip_addr := ip_src_addr; -- c_network_ip_addr_w + v_hdr.ip.dst_ip_addr := ip_dst_addr; -- c_network_ip_addr_w + + -- udp header + IF g_statistics_type = "SST" THEN + v_hdr.udp.src_port := c_disturb_sst_udp_src_port_15_8 & TO_UVEC(gn_index, 8); + ELSIF g_statistics_type = "BST" THEN + v_hdr.udp.src_port := c_disturb_bst_udp_src_port_15_8 & TO_UVEC(gn_index, 8); + ELSIF g_statistics_type = "XST" THEN + v_hdr.udp.src_port := c_disturb_xst_udp_src_port_15_8 & TO_UVEC(gn_index, 8); + END IF; + v_hdr.udp.dst_port := c_disturb_stat_udp_dst_port; + v_hdr.udp.total_length := TO_UVEC(c_udp_total_length, c_network_udp_port_w); + v_hdr.udp.checksum := TO_UVEC( 0, c_network_udp_checksum_w); + + -- app header + v_hdr.app.disturb_marker := TO_UVEC(c_marker, 8); + v_hdr.app.disturb_version_id := TO_UVEC(c_disturb_stat_version_id, 8); + v_hdr.app.disturb_observation_id := disturb_info.observation_id; + v_hdr.app.disturb_station_id := disturb_info.station_id; + + v_hdr.app.disturb_source_info_antenna_band_id := slv(disturb_info.antenna_band_index); + v_hdr.app.disturb_source_info_nyquist_zone_id := disturb_info.nyquist_zone_index; + v_hdr.app.disturb_source_info_f_adc := slv(disturb_info.f_adc); + v_hdr.app.disturb_source_info_fsub_type := slv(disturb_info.fsub_type); + v_hdr.app.disturb_source_info_payload_error := TO_UVEC(0, 1); + v_hdr.app.disturb_source_info_beam_repositioning_flag := slv(disturb_info.beam_repositioning_flag); + v_hdr.app.disturb_source_info_weighted_subbands_flag := slv(weighted_subbands_flag); + v_hdr.app.disturb_source_info_reserved := TO_UVEC(0, 3); + v_hdr.app.disturb_source_info_gn_id := TO_UVEC(gn_index, 5); + + v_hdr.app.disturb_reserved := TO_UVEC( 0, 8); + v_hdr.app.disturb_integration_interval := TO_UVEC(nof_block_per_sync, 24); + IF g_statistics_type = "SST" THEN + v_hdr.app.disturb_data_id := TO_UVEC(sst_signal_input, 32); + v_hdr.app.disturb_data_id_sst_signal_input_index := TO_UVEC(sst_signal_input, 8); + ELSIF g_statistics_type = "BST" THEN + v_hdr.app.disturb_data_id := TO_UVEC(beamlet_index, 32); + v_hdr.app.disturb_data_id_bst_beamlet_index := TO_UVEC(beamlet_index, 16); + ELSIF g_statistics_type = "XST" THEN + v_hdr.app.disturb_data_id := TO_UVEC(0, 7) & TO_UVEC(subband_index, 9) & TO_UVEC(xst_signal_input_A, 8) & TO_UVEC(xst_signal_input_B, 8); + v_hdr.app.disturb_data_id_xst_subband_index := TO_UVEC(subband_index, 9); + v_hdr.app.disturb_data_id_xst_signal_input_A_index := TO_UVEC(xst_signal_input_A, 8); + v_hdr.app.disturb_data_id_xst_signal_input_B_index := TO_UVEC(xst_signal_input_B, 8); + END IF; + v_hdr.app.disturb_nof_signal_inputs := TO_UVEC( c_nof_signal_inputs, 8); + v_hdr.app.disturb_nof_bytes_per_statistic := TO_UVEC(c_disturb_nof_bytes_per_statistic, 8); + v_hdr.app.disturb_nof_statistics_per_packet := TO_UVEC( c_nof_statistics_per_packet, 16); + v_hdr.app.disturb_block_period := disturb_info.block_period; + + v_hdr.app.dp_bsn := TO_UVEC(dp_bsn, 64); + RETURN v_hdr; + END func_disturb_compose_stat_header; + FUNCTION func_disturb_verify_stat_header(g_statistics_type : STRING; in_hdr, exp_hdr : t_disturb_stat_header) RETURN BOOLEAN IS BEGIN -- eth header @@ -116,6 +237,69 @@ PACKAGE BODY tb_disturb_pkg IS END func_disturb_verify_stat_header; + FUNCTION func_disturb_compose_cep_header(eth_dst_mac : STD_LOGIC_VECTOR(47 DOWNTO 0); -- eth header + eth_src_mac : STD_LOGIC_VECTOR(47 DOWNTO 0); + ip_src_addr : STD_LOGIC_VECTOR(31 DOWNTO 0); -- ip header + ip_dst_addr : STD_LOGIC_VECTOR(31 DOWNTO 0); + ip_header_checksum : NATURAL; + disturb_info : t_disturb_info; -- app header + gn_index : NATURAL; + beamlet_scale : NATURAL; + beamlet_index : NATURAL; + dp_bsn : NATURAL) RETURN t_disturb_cep_header IS + VARIABLE v_hdr : t_disturb_cep_header; + BEGIN + -- eth header + v_hdr.eth.dst_mac := eth_dst_mac; + v_hdr.eth.src_mac := eth_src_mac; + v_hdr.eth.eth_type := x"0800"; + + -- ip header + v_hdr.ip.version := TO_UVEC( 4, c_network_ip_version_w); + v_hdr.ip.header_length := TO_UVEC( 5, c_network_ip_header_length_w); + v_hdr.ip.services := TO_UVEC( 0, c_network_ip_services_w); + v_hdr.ip.total_length := c_disturb_cep_ip_total_length; + v_hdr.ip.identification := TO_UVEC( 0, c_network_ip_identification_w); + v_hdr.ip.flags := TO_UVEC( 2, c_network_ip_flags_w); + v_hdr.ip.fragment_offset := TO_UVEC( 0, c_network_ip_fragment_offset_w); + v_hdr.ip.time_to_live := TO_UVEC( 127, c_network_ip_time_to_live_w); + v_hdr.ip.protocol := TO_UVEC( 17, c_network_ip_protocol_w); + v_hdr.ip.header_checksum := TO_UVEC( ip_header_checksum, c_network_ip_header_checksum_w); + v_hdr.ip.src_ip_addr := ip_src_addr; -- c_network_ip_addr_w + v_hdr.ip.dst_ip_addr := ip_dst_addr; -- c_network_ip_addr_w + + -- udp header + v_hdr.udp.src_port := c_disturb_cep_udp_src_port_15_8 & TO_UVEC(gn_index, 8); + v_hdr.udp.dst_port := c_disturb_cep_udp_dst_port; + v_hdr.udp.total_length := c_disturb_cep_udp_total_length; + v_hdr.udp.checksum := TO_UVEC(0, c_network_udp_checksum_w); + + -- app header + v_hdr.app.disturb_marker := TO_UVEC(c_disturb_marker_beamlets, 8); + v_hdr.app.disturb_version_id := TO_UVEC(c_disturb_cep_version_id, 8); + v_hdr.app.disturb_observation_id := disturb_info.observation_id; + v_hdr.app.disturb_station_id := disturb_info.station_id; + + v_hdr.app.disturb_source_info_antenna_band_id := slv(disturb_info.antenna_band_index); + v_hdr.app.disturb_source_info_nyquist_zone_id := disturb_info.nyquist_zone_index; + v_hdr.app.disturb_source_info_f_adc := slv(disturb_info.f_adc); + v_hdr.app.disturb_source_info_fsub_type := slv(disturb_info.fsub_type); + v_hdr.app.disturb_source_info_payload_error := TO_UVEC(0, 1); + v_hdr.app.disturb_source_info_repositioning_flag := slv(disturb_info.beam_repositioning_flag); + v_hdr.app.disturb_source_info_beamlet_width := TO_UVEC(c_disturb_W_beamlet, 4); + v_hdr.app.disturb_source_info_gn_id := TO_UVEC(gn_index, 5); + + v_hdr.app.disturb_reserved := TO_UVEC(0, 40); + v_hdr.app.disturb_beamlet_scale := TO_UVEC(beamlet_scale, 16); + v_hdr.app.disturb_beamlet_index := TO_UVEC(beamlet_index, 16); + v_hdr.app.disturb_nof_blocks_per_packet := TO_UVEC(c_disturb_cep_nof_blocks_per_packet, 8); + v_hdr.app.disturb_nof_beamlets_per_block := TO_UVEC(c_disturb_cep_nof_beamlets_per_block, 16); + v_hdr.app.disturb_block_period := disturb_info.block_period; + + v_hdr.app.dp_bsn := TO_UVEC(dp_bsn, 64); + RETURN v_hdr; + END func_disturb_compose_cep_header; + FUNCTION func_disturb_verify_cep_header(in_hdr, exp_hdr : t_disturb_cep_header) RETURN BOOLEAN IS VARIABLE v_beamlet_index : NATURAL; BEGIN diff --git a/applications/disturb2/libraries/disturb/tb/vhdl/tb_disturb_statistics_offload.vhd b/applications/disturb2/libraries/disturb/tb/vhdl/tb_disturb_statistics_offload.vhd index aed4b0132d835bcb773cd0a5938571bf77a8da00..56e1e124c1f75e6212f3cf1d18afe97e5427c481 100644 --- a/applications/disturb2/libraries/disturb/tb/vhdl/tb_disturb_statistics_offload.vhd +++ b/applications/disturb2/libraries/disturb/tb/vhdl/tb_disturb_statistics_offload.vhd @@ -85,7 +85,7 @@ ARCHITECTURE tb OF tb_disturb_statistics_offload IS -- In this tb simply use fixed network src addresses CONSTANT c_eth_src_mac : STD_LOGIC_VECTOR(c_network_eth_mac_addr_w-1 DOWNTO 0) := x"123456789ABC"; CONSTANT c_ip_src_addr : STD_LOGIC_VECTOR(c_network_ip_addr_w-1 DOWNTO 0) := x"0A090807"; - CONSTANT c_udp_src_port : STD_LOGIC_VECTOR(c_network_udp_port_w-1 DOWNTO 0) := x"D001"; + CONSTANT c_udp_src_port : STD_LOGIC_VECTOR(c_network_udp_port_w-1 DOWNTO 0) := func_disturb_get_stat_udp_src_port(g_statistics_type, g_gn_index); -- Used mm_adresses on mm bus "enable_mosi/miso". CONSTANT c_reg_enable_mm_addr_enable : NATURAL := 0; @@ -172,9 +172,9 @@ ARCHITECTURE tb OF tb_disturb_statistics_offload IS SIGNAL offload_rx_hdr_dat_mosi : t_mem_mosi := c_mem_mosi_rst; SIGNAL offload_rx_hdr_dat_miso : t_mem_miso; + SIGNAL new_interval : STD_LOGIC := '0'; SIGNAL in_sosi : t_dp_sosi := c_dp_sosi_rst; SIGNAL in_crosslets_info_rec : t_disturb_crosslets_info; - SIGNAL in_crosslets_info_slv : STD_LOGIC_VECTOR(c_disturb_crosslets_info_reg_w-1 DOWNTO 0); SIGNAL disturb_offload_data : STD_LOGIC_VECTOR(c_word_w-1 DOWNTO 0); -- 32 bit SIGNAL disturb_offload_sosi : t_dp_sosi; @@ -191,7 +191,7 @@ ARCHITECTURE tb OF tb_disturb_statistics_offload IS SIGNAL rx_disturb_stat_header : t_disturb_stat_header; SIGNAL exp_disturb_stat_header : t_disturb_stat_header; - SIGNAL exp_dp_bsn : STD_LOGIC_VECTOR(63 DOWNTO 0); + SIGNAL exp_dp_bsn : NATURAL; SIGNAL exp_sst_signal_input : NATURAL; SIGNAL exp_bst_beamlet_index : NATURAL; SIGNAL cur_X_sq_cell : NATURAL; @@ -242,6 +242,9 @@ ARCHITECTURE tb OF tb_disturb_statistics_offload IS SIGNAL dbg_c_ram_size : NATURAL := c_ram_size; SIGNAL dbg_c_crosslets_info_rec : t_disturb_crosslets_info := c_crosslets_info_rec; SIGNAL dbg_c_crosslets_info_slv : STD_LOGIC_VECTOR(c_disturb_crosslets_info_reg_w-1 DOWNTO 0) := c_crosslets_info_slv; + SIGNAL dbg_c_nof_block_per_sync : NATURAL := c_nof_block_per_sync; + SIGNAL dbg_c_nof_clk_per_block : NATURAL := c_nof_clk_per_block; + SIGNAL dbg_c_nof_clk_per_sync : NATURAL := c_nof_clk_per_sync ; BEGIN @@ -282,7 +285,9 @@ BEGIN in_sosi.bsn <= TO_DP_BSN(c_bsn_init); in_sosi.valid <= '1'; in_crosslets_info_rec <= c_crosslets_info_rec; + new_interval <= '1'; -- mark first in_sosi.sync interval WHILE TRUE LOOP + -- One in_sosi.sync interval FOR i IN 0 TO c_nof_block_per_sync-1 LOOP FOR j IN 0 TO c_nof_clk_per_block-1 LOOP in_sosi.sync <= '0'; @@ -305,17 +310,15 @@ BEGIN proc_common_wait_some_cycles(dp_clk, 1); END LOOP; END LOOP; + new_interval <= '0'; END LOOP; WAIT; END PROCESS; - in_crosslets_info_slv <= func_disturb_map_crosslets_info(in_crosslets_info_rec); - -- Enable the statistics offload when input is running p_enable_trigger : PROCESS BEGIN - -- Wait at least one sync interval, so that DUT can have measured the integration_interval - proc_common_wait_until_hi_lo(dp_clk, in_sosi.sync); + proc_common_wait_until_low(dp_clk, mm_rst); proc_common_wait_some_cycles(mm_clk, 10); -- Enable common variable delay. proc_mem_mm_bus_wr(c_reg_enable_mm_addr_enable, 1, mm_clk, enable_miso, enable_mosi); @@ -354,7 +357,7 @@ BEGIN -- verify it at rx_offload_sosi.eop. -- For all statistics - exp_dp_bsn <= TO_SVEC(c_bsn_init + 1 + rx_sync_cnt * c_nof_block_per_sync, 64); + exp_dp_bsn <= c_bsn_init + 1 + rx_sync_cnt * c_nof_block_per_sync; -- SST exp_sst_signal_input <= rx_packet_cnt + c_disturb_S_pn * gn_index; -- BST @@ -369,70 +372,21 @@ BEGIN -- . prepare expected XST signal_input_B index, assume crosslet transport in positive direction exp_xst_signal_input_B <= (source_gn MOD c_disturb_N_pn_max) * c_disturb_S_pn; - p_exp_disturb_stat_header : PROCESS(weighted_subbands_flag, gn_index, exp_dp_bsn, exp_sst_signal_input, exp_subband_index, exp_xst_signal_input_A, exp_xst_signal_input_B) - BEGIN - -- eth header - exp_disturb_stat_header.eth.dst_mac <= c_disturb_stat_eth_dst_mac; - exp_disturb_stat_header.eth.src_mac <= c_eth_src_mac; - exp_disturb_stat_header.eth.eth_type <= x"0800"; - - -- ip header - exp_disturb_stat_header.ip.version <= TO_UVEC( 4, c_network_ip_version_w); - exp_disturb_stat_header.ip.header_length <= TO_UVEC( 5, c_network_ip_header_length_w); - exp_disturb_stat_header.ip.services <= TO_UVEC( 0, c_network_ip_services_w); - exp_disturb_stat_header.ip.total_length <= TO_UVEC(c_ip_total_length, c_network_ip_total_length_w); - exp_disturb_stat_header.ip.identification <= TO_UVEC( 0, c_network_ip_identification_w); - exp_disturb_stat_header.ip.flags <= TO_UVEC( 2, c_network_ip_flags_w); - exp_disturb_stat_header.ip.fragment_offset <= TO_UVEC( 0, c_network_ip_fragment_offset_w); - exp_disturb_stat_header.ip.time_to_live <= TO_UVEC( 127, c_network_ip_time_to_live_w); - exp_disturb_stat_header.ip.protocol <= TO_UVEC( 17, c_network_ip_protocol_w); - exp_disturb_stat_header.ip.header_checksum <= TO_UVEC( 0, c_network_ip_header_checksum_w); - exp_disturb_stat_header.ip.src_ip_addr <= c_ip_src_addr; -- c_network_ip_addr_w - exp_disturb_stat_header.ip.dst_ip_addr <= c_disturb_stat_ip_dst_addr; -- c_network_ip_addr_w - - -- udp header - exp_disturb_stat_header.udp.src_port <= c_udp_src_port; - exp_disturb_stat_header.udp.dst_port <= TO_UVEC( 5001, c_network_udp_port_w); - exp_disturb_stat_header.udp.total_length <= TO_UVEC(c_udp_total_length, c_network_udp_port_w); - exp_disturb_stat_header.udp.checksum <= TO_UVEC( 0, c_network_udp_checksum_w); - - -- app header - exp_disturb_stat_header.app.disturb_marker <= TO_UVEC(c_marker, 8); - exp_disturb_stat_header.app.disturb_version_id <= TO_UVEC(c_disturb_stat_version_id, 8); - exp_disturb_stat_header.app.disturb_observation_id <= c_exp_disturb_info.observation_id; - exp_disturb_stat_header.app.disturb_station_id <= c_exp_disturb_info.station_id; - - exp_disturb_stat_header.app.disturb_source_info_antenna_band_id <= slv(c_exp_disturb_info.antenna_band_index); - exp_disturb_stat_header.app.disturb_source_info_nyquist_zone_id <= c_exp_disturb_info.nyquist_zone_index; - exp_disturb_stat_header.app.disturb_source_info_f_adc <= slv(c_exp_disturb_info.f_adc); - exp_disturb_stat_header.app.disturb_source_info_fsub_type <= slv(c_exp_disturb_info.fsub_type); - exp_disturb_stat_header.app.disturb_source_info_payload_error <= TO_UVEC(0, 1); - exp_disturb_stat_header.app.disturb_source_info_beam_repositioning_flag <= slv(c_exp_disturb_info.beam_repositioning_flag); - exp_disturb_stat_header.app.disturb_source_info_weighted_subbands_flag <= slv(weighted_subbands_flag); - exp_disturb_stat_header.app.disturb_source_info_reserved <= TO_UVEC(0, 3); - exp_disturb_stat_header.app.disturb_source_info_gn_id <= TO_UVEC(gn_index, 5); - - exp_disturb_stat_header.app.disturb_reserved <= TO_UVEC( 0, 8); - exp_disturb_stat_header.app.disturb_integration_interval <= TO_UVEC(c_nof_block_per_sync, 24); - IF g_statistics_type = "SST" THEN - exp_disturb_stat_header.app.disturb_data_id <= TO_UVEC(exp_sst_signal_input, 32); - exp_disturb_stat_header.app.disturb_data_id_sst_signal_input_index <= TO_UVEC(exp_sst_signal_input, 8); - ELSIF g_statistics_type = "BST" THEN - exp_disturb_stat_header.app.disturb_data_id <= TO_UVEC(c_beamlet_index, 32); - exp_disturb_stat_header.app.disturb_data_id_bst_beamlet_index <= TO_UVEC(c_beamlet_index, 16); - ELSIF g_statistics_type = "XST" THEN - exp_disturb_stat_header.app.disturb_data_id <= TO_UVEC(0, 7) & TO_UVEC(exp_subband_index, 9) & TO_UVEC(exp_xst_signal_input_A, 8) & TO_UVEC(exp_xst_signal_input_B, 8); - exp_disturb_stat_header.app.disturb_data_id_xst_subband_index <= TO_UVEC(exp_subband_index, 9); - exp_disturb_stat_header.app.disturb_data_id_xst_signal_input_A_index <= TO_UVEC(exp_xst_signal_input_A, 8); - exp_disturb_stat_header.app.disturb_data_id_xst_signal_input_B_index <= TO_UVEC(exp_xst_signal_input_B, 8); - END IF; - exp_disturb_stat_header.app.disturb_nof_signal_inputs <= TO_UVEC( c_nof_signal_inputs, 8); - exp_disturb_stat_header.app.disturb_nof_bytes_per_statistic <= TO_UVEC(c_disturb_nof_bytes_per_statistic, 8); - exp_disturb_stat_header.app.disturb_nof_statistics_per_packet <= TO_UVEC( c_nof_statistics_per_packet, 16); - exp_disturb_stat_header.app.disturb_block_period <= c_exp_disturb_info.block_period; - - exp_disturb_stat_header.app.dp_bsn <= exp_dp_bsn; - END PROCESS; + exp_disturb_stat_header <= func_disturb_compose_stat_header(c_disturb_stat_eth_dst_mac, + c_eth_src_mac, + c_ip_src_addr, + c_disturb_stat_ip_dst_addr, + c_exp_disturb_info, + g_statistics_type, + weighted_subbands_flag, + gn_index, + c_nof_block_per_sync, + exp_sst_signal_input, + c_beamlet_index, + exp_subband_index, + exp_xst_signal_input_A, + exp_xst_signal_input_B, + exp_dp_bsn); rx_disturb_stat_header <= func_disturb_map_stat_header(rx_hdr_fields_raw); @@ -697,6 +651,8 @@ BEGIN -- ST in_sosi => in_sosi, + new_interval => new_interval, + out_sosi => disturb_offload_sosi, out_siso => disturb_offload_siso, @@ -709,8 +665,9 @@ BEGIN ring_info => c_exp_ring_info, disturb_info => c_exp_disturb_info, weighted_subbands_flag => weighted_subbands_flag, + nof_crosslets => c_mm_nof_crosslets, - crosslets_info => in_crosslets_info_slv + crosslets_info_rec => in_crosslets_info_rec ); -- Check crosslet_info functions