From 8013c6f7d56a7721be0cf85a79e93b4b623fdb7e Mon Sep 17 00:00:00 2001 From: Eric Kooistra <kooistra@astron.nl> Date: Tue, 17 Oct 2023 13:52:47 +0200 Subject: [PATCH] Use reg_bdo_destinations for unb2c bf revision tb. --- .../tb_lofar2_unb2c_sdp_station_bf.vhd | 80 ++++++++++++++++--- .../src/vhdl/lofar2_unb2c_sdp_station_pkg.vhd | 2 +- 2 files changed, 68 insertions(+), 14 deletions(-) diff --git a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf/tb_lofar2_unb2c_sdp_station_bf.vhd b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf/tb_lofar2_unb2c_sdp_station_bf.vhd index 6d12a8748c..2c31ec4b0a 100644 --- a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf/tb_lofar2_unb2c_sdp_station_bf.vhd +++ b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf/tb_lofar2_unb2c_sdp_station_bf.vhd @@ -160,6 +160,7 @@ use wpfb_lib.wpfb_pkg.all; use unb2c_board_lib.unb2c_board_pkg.all; use lofar2_sdp_lib.sdp_pkg.all; use lofar2_sdp_lib.tb_sdp_pkg.all; +use lofar2_sdp_lib.sdp_bdo_pkg.all; use tech_pll_lib.tech_pll_component_pkg.all; use lofar2_unb2c_sdp_station_lib.lofar2_unb2c_sdp_station_pkg.all; @@ -193,12 +194,14 @@ architecture tb of tb_lofar2_unb2c_sdp_station_bf is constant c_revision_select : t_lofar2_unb2c_sdp_station_config := func_sel_revision_rec(c_design_name); constant c_sim : boolean := true; - constant c_unb_nr : natural := 0; -- UniBoard 0 - constant c_node_nr : natural := 0; + constant c_unb_nr : natural := 1; + constant c_node_nr : natural := 2; constant c_gn_index : natural := c_unb_nr * 4 + c_node_nr; -- this node GN constant c_init_bsn : natural := 17; -- some recognizable value >= 0 constant c_bsn_latency : natural := 5; -- used to time stimuli_done constant c_use_bdo_transpose : boolean := c_revision_select.use_bdo_transpose; + constant c_nof_bdo_destinations_max : natural := c_revision_select.nof_bdo_destinations_max; + constant c_nof_bdo_destinations : natural := 1; constant c_id : std_logic_vector(7 downto 0) := TO_UVEC(c_gn_index, 8); constant c_version : std_logic_vector(1 downto 0) := "00"; @@ -352,6 +355,7 @@ architecture tb of tb_lofar2_unb2c_sdp_station_bf is constant c_addr_w_ram_bf_weights : natural := ceil_log2(c_sdp_N_pol_bf * c_sdp_P_pfb * c_sdp_S_sub_bf * c_sdp_Q_fft); constant c_addr_w_reg_bf_scale : natural := 1; constant c_addr_w_reg_hdr_dat : natural := ceil_log2(field_nof_words(c_sdp_cep_hdr_field_arr, c_word_w)); + constant c_addr_w_reg_bdo_destinations : natural := c_sdp_reg_bdo_destinations_info_w_one; constant c_addr_w_reg_stat_enable_bst : natural := c_sdp_reg_stat_enable_addr_w; constant c_addr_w_reg_dp_xonoff : natural := 1; constant c_addr_w_ram_st_bst : natural := ceil_log2(c_sdp_S_sub_bf * c_sdp_N_pol_bf * c_stat_data_sz); @@ -363,6 +367,7 @@ architecture tb of tb_lofar2_unb2c_sdp_station_bf is constant c_mm_span_ram_bf_weights : natural := 2**c_addr_w_ram_bf_weights; constant c_mm_span_reg_bf_scale : natural := 2**c_addr_w_reg_bf_scale; constant c_mm_span_reg_hdr_dat : natural := 2**c_addr_w_reg_hdr_dat; + constant c_mm_span_reg_bdo_destinations : natural := 2**c_addr_w_reg_bdo_destinations; constant c_mm_span_reg_stat_enable_bst : natural := 2**c_addr_w_reg_stat_enable_bst; constant c_mm_span_reg_dp_xonoff : natural := 2**c_addr_w_reg_dp_xonoff; constant c_mm_span_ram_st_bst : natural := 2**c_addr_w_ram_st_bst; @@ -382,6 +387,7 @@ architecture tb of tb_lofar2_unb2c_sdp_station_bf is constant c_mm_file_reg_bf_scale : string := mmf_unb_file_prefix(c_unb_nr, c_node_nr) & "REG_BF_SCALE"; constant c_mm_file_reg_sdp_info : string := mmf_unb_file_prefix(c_unb_nr, c_node_nr) & "REG_SDP_INFO"; constant c_mm_file_reg_hdr_dat : string := mmf_unb_file_prefix(c_unb_nr, c_node_nr) & "REG_HDR_DAT"; -- c_sdp_N_beamsets = 2 beamsets + constant c_mm_file_reg_bdo_destinations : string := mmf_unb_file_prefix(c_unb_nr, c_node_nr) & "REG_BDO_DESTINATIONS"; -- Tb BSN moments constant c_stimuli_done_bsn : natural := c_init_bsn + c_bsn_latency + c_nof_block_per_sync * 3; @@ -412,6 +418,10 @@ architecture tb of tb_lofar2_unb2c_sdp_station_bf is signal rd_cep_ip_dst_addr : std_logic_vector(31 downto 0); signal rd_cep_udp_src_port : std_logic_vector(15 downto 0); signal rd_cep_udp_dst_port : std_logic_vector(15 downto 0); + signal rd_nof_destinations : natural; + signal rd_nof_destinations_act : natural; + signal rd_nof_destinations_max : natural; + signal rd_nof_blocks_per_packet : natural; -- WG signal current_bsn_wg : std_logic_vector(c_dp_stream_bsn_w - 1 downto 0); @@ -679,7 +689,9 @@ begin variable v_bsn : natural; variable v_data_lo, v_data_hi : std_logic_vector(c_word_w - 1 downto 0); variable v_stat_data : std_logic_vector(c_longword_w - 1 downto 0); - variable v_len, v_span, v_offset, v_addr, v_sel : natural; -- address ranges, indices + variable v_len, v_span, + v_offset, v_offset_bdo, + v_addr, v_sel : natural; -- address ranges, indices variable v_W, v_P, v_PB, v_S, v_A, v_B, v_G : natural; -- array indicies variable v_re, v_im, v_weight : integer; variable v_re_exp, v_im_exp : real := 0.0; @@ -814,10 +826,26 @@ begin mmf_mm_bus_wr(c_mm_file_reg_hdr_dat, v_offset + 38, TO_SINT(c_cep_eth_src_mac(31 downto 0)), tb_clk); -- use signed to fit 32 b in INTEGER mmf_mm_bus_wr(c_mm_file_reg_hdr_dat, v_offset + 26, TO_SINT(c_cep_ip_src_addr), tb_clk); -- use signed to fit 32 b in INTEGER mmf_mm_bus_wr(c_mm_file_reg_hdr_dat, v_offset + 24, TO_UINT(c_cep_udp_src_port), tb_clk); - mmf_mm_bus_wr(c_mm_file_reg_hdr_dat, v_offset + 41, TO_UINT(c_sdp_cep_eth_dst_mac(47 downto 32)), tb_clk); - mmf_mm_bus_wr(c_mm_file_reg_hdr_dat, v_offset + 40, TO_SINT(c_sdp_cep_eth_dst_mac(31 downto 0)), tb_clk); -- use signed to fit 32 b in INTEGER - mmf_mm_bus_wr(c_mm_file_reg_hdr_dat, v_offset + 25, TO_SINT(c_sdp_cep_ip_dst_addr), tb_clk); -- use signed to fit 32 b in INTEGER - mmf_mm_bus_wr(c_mm_file_reg_hdr_dat, v_offset + 23, TO_UINT(c_sdp_cep_udp_dst_port), tb_clk); + if c_nof_bdo_destinations_max = 1 then + -- . Set destination MAC/IP/UDP via c_mm_file_reg_hdr_dat + mmf_mm_bus_wr(c_mm_file_reg_hdr_dat, v_offset + 41, TO_UINT(c_sdp_cep_eth_dst_mac(47 downto 32)), tb_clk); + mmf_mm_bus_wr(c_mm_file_reg_hdr_dat, v_offset + 40, TO_SINT(c_sdp_cep_eth_dst_mac(31 downto 0)), tb_clk); -- use signed to fit 32 b in INTEGER + mmf_mm_bus_wr(c_mm_file_reg_hdr_dat, v_offset + 25, TO_SINT(c_sdp_cep_ip_dst_addr), tb_clk); -- use signed to fit 32 b in INTEGER + mmf_mm_bus_wr(c_mm_file_reg_hdr_dat, v_offset + 23, TO_UINT(c_sdp_cep_udp_dst_port), tb_clk); + else + -- . Set nof_destinations = c_nof_bdo_destinations = 1 + v_offset_bdo := bset * c_mm_span_reg_bdo_destinations + c_sdp_bdo_mm_nof_destinations_max * 4; + mmf_mm_bus_wr(c_mm_file_reg_bdo_destinations, v_offset_bdo + 0, c_nof_bdo_destinations, tb_clk); + -- . Set destination MAC/IP/UDP via c_mm_file_reg_bdo_destinations, for + -- the first and only destination + v_offset_bdo := bset * c_mm_span_reg_bdo_destinations; + mmf_mm_bus_wr(c_mm_file_reg_bdo_destinations, v_offset_bdo + 1, to_uint(c_sdp_cep_eth_dst_mac(47 downto 32)), tb_clk); + mmf_mm_bus_wr(c_mm_file_reg_bdo_destinations, v_offset_bdo, to_sint(c_sdp_cep_eth_dst_mac(31 downto 0)), tb_clk); + v_offset_bdo := bset * c_mm_span_reg_bdo_destinations + c_sdp_bdo_mm_nof_destinations_max * 2; + mmf_mm_bus_wr(c_mm_file_reg_bdo_destinations, v_offset_bdo, to_sint(c_sdp_cep_ip_dst_addr), tb_clk); + v_offset_bdo := bset * c_mm_span_reg_bdo_destinations + c_sdp_bdo_mm_nof_destinations_max * 3; + mmf_mm_bus_wr(c_mm_file_reg_bdo_destinations, v_offset_bdo, to_uint(c_sdp_cep_udp_dst_port), tb_clk); + end if; proc_common_wait_cross_clock_domain_latency(c_mm_clk_period, c_ext_clk_period, c_common_cross_clock_domain_latency * 2); -- . Read back @@ -825,19 +853,45 @@ begin mmf_mm_bus_rd(c_mm_file_reg_hdr_dat, v_offset + 38, rd_data, tb_clk); rd_cep_eth_src_mac(31 downto 0) <= rd_data; mmf_mm_bus_rd(c_mm_file_reg_hdr_dat, v_offset + 26, rd_data, tb_clk); rd_cep_ip_src_addr <= rd_data; mmf_mm_bus_rd(c_mm_file_reg_hdr_dat, v_offset + 24, rd_data, tb_clk); rd_cep_udp_src_port <= rd_data(15 downto 0); - mmf_mm_bus_rd(c_mm_file_reg_hdr_dat, v_offset + 41, rd_data, tb_clk); rd_cep_eth_dst_mac(47 downto 32) <= rd_data(15 downto 0); - mmf_mm_bus_rd(c_mm_file_reg_hdr_dat, v_offset + 40, rd_data, tb_clk); rd_cep_eth_dst_mac(31 downto 0) <= rd_data; - mmf_mm_bus_rd(c_mm_file_reg_hdr_dat, v_offset + 25, rd_data, tb_clk); rd_cep_ip_dst_addr <= rd_data; - mmf_mm_bus_rd(c_mm_file_reg_hdr_dat, v_offset + 23, rd_data, tb_clk); rd_cep_udp_dst_port <= rd_data(15 downto 0); + if c_nof_bdo_destinations_max = 1 then + -- . Read back destination MAC/IP/UDP via c_mm_file_reg_hdr_dat + mmf_mm_bus_rd(c_mm_file_reg_hdr_dat, v_offset + 41, rd_data, tb_clk); rd_cep_eth_dst_mac(47 downto 32) <= rd_data(15 downto 0); + mmf_mm_bus_rd(c_mm_file_reg_hdr_dat, v_offset + 40, rd_data, tb_clk); rd_cep_eth_dst_mac(31 downto 0) <= rd_data; + mmf_mm_bus_rd(c_mm_file_reg_hdr_dat, v_offset + 25, rd_data, tb_clk); rd_cep_ip_dst_addr <= rd_data; + mmf_mm_bus_rd(c_mm_file_reg_hdr_dat, v_offset + 23, rd_data, tb_clk); rd_cep_udp_dst_port <= rd_data(15 downto 0); + else + -- . Read back nof destinations info via c_mm_file_reg_bdo_destinations + v_offset_bdo := bset * c_mm_span_reg_bdo_destinations + c_sdp_bdo_mm_nof_destinations_max * 4; + mmf_mm_bus_rd(c_mm_file_reg_bdo_destinations, v_offset_bdo + 0, rd_data, tb_clk); rd_nof_destinations <= to_uint(rd_data(7 downto 0)); + mmf_mm_bus_rd(c_mm_file_reg_bdo_destinations, v_offset_bdo + 1, rd_data, tb_clk); rd_nof_destinations_act <= to_uint(rd_data(7 downto 0)); + mmf_mm_bus_rd(c_mm_file_reg_bdo_destinations, v_offset_bdo + 2, rd_data, tb_clk); rd_nof_destinations_max <= to_uint(rd_data(7 downto 0)); + mmf_mm_bus_rd(c_mm_file_reg_bdo_destinations, v_offset_bdo + 3, rd_data, tb_clk); rd_nof_blocks_per_packet <= to_uint(rd_data(7 downto 0)); + -- . Read back destination MAC/IP/UDP via c_mm_file_reg_bdo_destinations + v_offset_bdo := bset * c_mm_span_reg_bdo_destinations; + mmf_mm_bus_rd(c_mm_file_reg_bdo_destinations, v_offset_bdo + 1, rd_data, tb_clk); rd_cep_eth_dst_mac(47 downto 32) <= rd_data(15 downto 0); + mmf_mm_bus_rd(c_mm_file_reg_bdo_destinations, v_offset_bdo, rd_data, tb_clk); rd_cep_eth_dst_mac(31 downto 0) <= rd_data; + v_offset_bdo := bset * c_mm_span_reg_bdo_destinations + c_sdp_bdo_mm_nof_destinations_max * 2; + mmf_mm_bus_rd(c_mm_file_reg_bdo_destinations, v_offset_bdo, rd_data, tb_clk); rd_cep_ip_dst_addr <= rd_data; + v_offset_bdo := bset * c_mm_span_reg_bdo_destinations + c_sdp_bdo_mm_nof_destinations_max * 3; + mmf_mm_bus_rd(c_mm_file_reg_bdo_destinations, v_offset_bdo, rd_data, tb_clk); rd_cep_udp_dst_port <= rd_data(15 downto 0); + end if; proc_common_wait_some_cycles(tb_clk, 1); - -- . verify read back + + -- . verify read back source MAC/IP/UDP assert rd_cep_eth_src_mac = c_cep_eth_src_mac report "Wrong MM read rd_cep_eth_src_mac for beamset " & natural'image(bset) severity ERROR; assert rd_cep_ip_src_addr = c_cep_ip_src_addr report "Wrong MM read rd_cep_ip_src_addr for beamset " & natural'image(bset) severity ERROR; assert rd_cep_udp_src_port = c_cep_udp_src_port report "Wrong MM read rd_cep_udp_src_port for beamset " & natural'image(bset) severity ERROR; + -- . verify read back destination MAC/IP/UDP assert rd_cep_eth_dst_mac = c_sdp_cep_eth_dst_mac report "Wrong MM read rd_cep_eth_dst_mac for beamset " & natural'image(bset) severity ERROR; assert rd_cep_ip_dst_addr = c_sdp_cep_ip_dst_addr report "Wrong MM read rd_cep_ip_dst_addr for beamset " & natural'image(bset) severity ERROR; assert rd_cep_udp_dst_port = c_sdp_cep_udp_dst_port report "Wrong MM read rd_cep_udp_dst_port for beamset " & natural'image(bset) severity ERROR; - + if c_nof_bdo_destinations_max > 1 then + -- . Verify read back nof destinations info + assert rd_nof_destinations = c_nof_bdo_destinations report "Wrong MM read rd_nof_destinations for beamset " & natural'image(bset) severity ERROR; + assert rd_nof_destinations_act = c_nof_bdo_destinations report "Wrong MM read rd_nof_destinations_act for beamset " & natural'image(bset) severity ERROR; + assert rd_nof_destinations_max = c_nof_bdo_destinations_max report "Wrong MM read rd_nof_destinations_max for beamset " & natural'image(bset) severity ERROR; + assert rd_nof_blocks_per_packet = c_sdp_cep_nof_blocks_per_packet report "Wrong MM read rd_nof_blocks_per_packet for beamset " & natural'image(bset) severity ERROR; + end if; ---------------------------------------------------------------------------- -- Enable BST offload (not verified here, but only for view in Wave window) ---------------------------------------------------------------------------- diff --git a/applications/lofar2/designs/lofar2_unb2c_sdp_station/src/vhdl/lofar2_unb2c_sdp_station_pkg.vhd b/applications/lofar2/designs/lofar2_unb2c_sdp_station/src/vhdl/lofar2_unb2c_sdp_station_pkg.vhd index b8c68379c6..4e5184e416 100644 --- a/applications/lofar2/designs/lofar2_unb2c_sdp_station/src/vhdl/lofar2_unb2c_sdp_station_pkg.vhd +++ b/applications/lofar2/designs/lofar2_unb2c_sdp_station/src/vhdl/lofar2_unb2c_sdp_station_pkg.vhd @@ -46,7 +46,7 @@ package lofar2_unb2c_sdp_station_pkg is constant c_fsub : t_lofar2_unb2c_sdp_station_config := (false, true, false, false, false, 1, false, false, 0); -- use c_bf on one node also to simulate bdo transpose -- use c_bf_ring with ring also to simulate bdo identity - constant c_bf : t_lofar2_unb2c_sdp_station_config := (false, true, false, true, true, 1, false, false, 0); + constant c_bf : t_lofar2_unb2c_sdp_station_config := (false, true, false, true, true, 31, false, false, 0); constant c_bf_ring : t_lofar2_unb2c_sdp_station_config := (false, true, false, true, false, 1, false, true, 0); constant c_xsub_one : t_lofar2_unb2c_sdp_station_config := (false, true, false, false, false, 1, true, false, 1); constant c_xsub_ring : t_lofar2_unb2c_sdp_station_config := (false, true, false, false, false, 1, true, true, 9); -- GitLab