Skip to content
Snippets Groups Projects
Commit d0bdd5c5 authored by Eric Kooistra's avatar Eric Kooistra
Browse files

Merge branch 'L2SDP-563' into 'master'

Resolve L2SDP-563

Closes L2SDP-563

See merge request desp/hdl!186
parents db42a104 1ecf8b10
No related branches found
No related tags found
1 merge request!186Resolve L2SDP-563
Pipeline #23327 passed
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
-- > as 7 # default -- > as 7 # default
-- > as 12 # for detailed debugging -- > as 12 # for detailed debugging
-- > run -a -- > run -a
-- Takes about 45 m
-- --
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
LIBRARY IEEE, common_lib, unb2b_board_lib, i2c_lib, mm_lib, dp_lib, diag_lib, lofar2_sdp_lib, wpfb_lib, tech_pll_lib, tr_10GbE_lib, lofar2_unb2b_sdp_station_lib; LIBRARY IEEE, common_lib, unb2b_board_lib, i2c_lib, mm_lib, dp_lib, diag_lib, lofar2_sdp_lib, wpfb_lib, tech_pll_lib, tr_10GbE_lib, lofar2_unb2b_sdp_station_lib;
...@@ -87,6 +88,7 @@ ARCHITECTURE tb OF tb_lofar2_unb2b_sdp_station_bf IS ...@@ -87,6 +88,7 @@ ARCHITECTURE tb OF tb_lofar2_unb2b_sdp_station_bf IS
CONSTANT c_nof_clk_per_sync : NATURAL := c_nof_block_per_sync*c_sdp_N_fft; CONSTANT c_nof_clk_per_sync : NATURAL := c_nof_block_per_sync*c_sdp_N_fft;
CONSTANT c_pps_period : NATURAL := c_nof_clk_per_sync; CONSTANT c_pps_period : NATURAL := c_nof_clk_per_sync;
CONSTANT c_wpfb_sim : t_wpfb := func_wpfb_set_nof_block_per_sync(c_sdp_wpfb_subbands, c_nof_block_per_sync); CONSTANT c_wpfb_sim : t_wpfb := func_wpfb_set_nof_block_per_sync(c_sdp_wpfb_subbands, c_nof_block_per_sync);
CONSTANT c_stat_data_sz : NATURAL := c_longword_sz/c_word_sz; -- = 2
CONSTANT c_percentage : REAL := 0.05; -- percentage that actual value may differ from expected value CONSTANT c_percentage : REAL := 0.05; -- percentage that actual value may differ from expected value
CONSTANT c_lo_factor : REAL := 1.0 - c_percentage; -- lower boundary CONSTANT c_lo_factor : REAL := 1.0 - c_percentage; -- lower boundary
...@@ -109,7 +111,8 @@ ARCHITECTURE tb OF tb_lofar2_unb2b_sdp_station_bf IS ...@@ -109,7 +111,8 @@ ARCHITECTURE tb OF tb_lofar2_unb2b_sdp_station_bf IS
CONSTANT c_exp_beamlet_power_sp_0 : REAL := c_exp_wg_power_sp_0 * c_exp_sp_beamlet_power_ratio; CONSTANT c_exp_beamlet_power_sp_0 : REAL := c_exp_wg_power_sp_0 * c_exp_sp_beamlet_power_ratio;
TYPE t_real_arr IS ARRAY (INTEGER RANGE <>) OF REAL; TYPE t_real_arr IS ARRAY (INTEGER RANGE <>) OF REAL;
TyPE t_slv_64_subbands_arr IS ARRAY (INTEGER RANGE <>) OF t_slv_64_arr(0 TO c_sdp_S_sub_bf); TYPE t_slv_64_subbands_arr IS ARRAY (INTEGER RANGE <>) OF t_slv_64_arr(0 TO c_sdp_N_sub);
TYPE t_slv_64_beamlets_arr IS ARRAY (INTEGER RANGE <>) OF t_slv_64_arr(0 TO c_sdp_S_sub_bf);
-- MM -- MM
CONSTANT c_mm_file_reg_ppsh : STRING := mmf_unb_file_prefix(c_unb_nr, c_node_nr) & "PIO_PPS"; CONSTANT c_mm_file_reg_ppsh : STRING := mmf_unb_file_prefix(c_unb_nr, c_node_nr) & "PIO_PPS";
...@@ -130,23 +133,28 @@ ARCHITECTURE tb OF tb_lofar2_unb2b_sdp_station_bf IS ...@@ -130,23 +133,28 @@ ARCHITECTURE tb OF tb_lofar2_unb2b_sdp_station_bf IS
SIGNAL current_bsn_wg : STD_LOGIC_VECTOR(c_dp_stream_bsn_w-1 DOWNTO 0); SIGNAL current_bsn_wg : STD_LOGIC_VECTOR(c_dp_stream_bsn_w-1 DOWNTO 0);
-- WPFB -- WPFB
SIGNAL sp_subband_powers_arr2 : t_slv_64_subbands_arr(c_sdp_N_beamsets*c_sdp_N_pol-1 DOWNTO 0); -- [sp][sub] SIGNAL sp_subband_powers_arr2 : t_slv_64_subbands_arr(c_sdp_N_pol-1 DOWNTO 0); -- [sp][sub]
SIGNAL sp_beamlet_powers_arr2 : t_slv_64_subbands_arr(c_sdp_N_beamsets*c_sdp_N_pol-1 DOWNTO 0); -- [sp][sub] SIGNAL sp_beamlet_powers_arr2 : t_slv_64_beamlets_arr(c_sdp_N_beamsets*c_sdp_N_pol_bf-1 DOWNTO 0); -- [sp][sub]
SIGNAL sp_beamlet_power_0 : REAL; SIGNAL sp_beamlet_power_0 : REAL;
SIGNAL sp_beamlet_power_sum : t_real_arr(c_sdp_N_beamsets*c_sdp_N_pol-1 DOWNTO 0) := (OTHERS=>0.0); SIGNAL sp_beamlet_power_sum : t_real_arr(c_sdp_N_beamsets*c_sdp_N_pol_bf-1 DOWNTO 0) := (OTHERS=>0.0);
SIGNAL sp_beamlet_power_sum_0 : REAL; SIGNAL sp_beamlet_power_sum_0 : REAL;
SIGNAL sp_beamlet_power_ratio_0 : REAL; SIGNAL sp_beamlet_power_ratio_0 : REAL;
SIGNAL sp_beamlet_power_sum_ratio_0 : REAL; SIGNAL sp_beamlet_power_sum_ratio_0 : REAL;
SIGNAL sp_beamlet_power_leakage_sum_0 : REAL; SIGNAL sp_beamlet_power_leakage_sum_0 : REAL;
-- 10GbE -- 10GbE
CONSTANT c_exp_beamlet_index : NATURAL := NATURAL(c_subband_sp_0) * c_sdp_N_pol; CONSTANT c_exp_beamlet_index : NATURAL := NATURAL(c_subband_sp_0) * c_sdp_N_pol_bf;
CONSTANT c_exp_beamlet_re : STD_LOGIC_VECTOR(7 DOWNTO 0) := x"81"; --Derived from simulation CONSTANT c_exp_beamlet_re : STD_LOGIC_VECTOR(7 DOWNTO 0) := x"81"; -- = -127, derived from simulation
CONSTANT c_exp_beamlet_im : STD_LOGIC_VECTOR(7 DOWNTO 0) := x"7F"; --Derived from simulation CONSTANT c_exp_beamlet_im : STD_LOGIC_VECTOR(7 DOWNTO 0) := x"7F"; -- = +127, derived from simulation
SIGNAL beamlet_arr2_re : t_slv_8_arr(c_sdp_cep_nof_beamlets_per_block-1 DOWNTO 0); SIGNAL dbg_beamlet_arr_re : t_slv_8_arr(c_sdp_cep_nof_blocks_per_packet-1 DOWNTO 0); -- [3:0]
SIGNAL beamlet_arr2_im : t_slv_8_arr(c_sdp_cep_nof_beamlets_per_block-1 DOWNTO 0); SIGNAL dbg_beamlet_arr_im : t_slv_8_arr(c_sdp_cep_nof_blocks_per_packet-1 DOWNTO 0); -- [3:0]
SIGNAL dbg_beamlet_cnt : NATURAL;
SIGNAL dbg_beamlet_valid : STD_LOGIC;
SIGNAL beamlet_arr2_re : t_slv_8_arr(c_sdp_cep_nof_beamlets_per_block * c_sdp_N_pol_bf-1 DOWNTO 0); -- [488 * 2-1:0] = [975:0]
SIGNAL beamlet_arr2_im : t_slv_8_arr(c_sdp_cep_nof_beamlets_per_block * c_sdp_N_pol_bf-1 DOWNTO 0); -- [488 * 2-1:0] = [975:0]
SIGNAL tr_10GbE_src_out : t_dp_sosi; SIGNAL tr_10GbE_src_out : t_dp_sosi;
SIGNAL tr_ref_clk_312 : STD_LOGIC := '0'; SIGNAL tr_ref_clk_312 : STD_LOGIC := '0';
...@@ -192,7 +200,6 @@ BEGIN ...@@ -192,7 +200,6 @@ BEGIN
eth_clk <= NOT eth_clk AFTER c_eth_clk_period/2; -- Ethernet ref clock (125 MHz) eth_clk <= NOT eth_clk AFTER c_eth_clk_period/2; -- Ethernet ref clock (125 MHz)
JESD204B_REFCLK <= NOT JESD204B_REFCLK AFTER c_bck_ref_clk_period/2; -- JESD sample clock (200MHz) JESD204B_REFCLK <= NOT JESD204B_REFCLK AFTER c_bck_ref_clk_period/2; -- JESD sample clock (200MHz)
SA_CLK <= NOT SA_CLK AFTER c_sa_clk_period/2; -- Serial Gigabit IO sa clock (644 MHz) SA_CLK <= NOT SA_CLK AFTER c_sa_clk_period/2; -- Serial Gigabit IO sa clock (644 MHz)
pps_rst <= '0' AFTER c_ext_clk_period*2;
INTA <= 'H'; -- pull up INTA <= 'H'; -- pull up
INTB <= 'H'; -- pull up INTB <= 'H'; -- pull up
...@@ -316,13 +323,12 @@ BEGIN ...@@ -316,13 +323,12 @@ BEGIN
VARIABLE v_sp_beamlet_power : REAL; VARIABLE v_sp_beamlet_power : REAL;
VARIABLE v_sp_subband_power : REAL; VARIABLE v_sp_subband_power : REAL;
VARIABLE v_W, v_T, v_U, v_S, v_B : NATURAL; -- array indicies VARIABLE v_W, v_T, v_U, v_S, v_B : NATURAL; -- array indicies
VARIABLE v_re, v_im : INTEGER;
VARIABLE v_re_exp, v_im_exp : INTEGER;
BEGIN BEGIN
-- Wait for DUT power up after reset -- Wait for DUT power up after reset
WAIT FOR 1 us; WAIT FOR 1 us;
proc_common_wait_until_hi_lo(ext_clk, ext_pps);
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
-- Enable UDP offload (dp_xonoff) of beamset 0 -- Enable UDP offload (dp_xonoff) of beamset 0
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
...@@ -337,6 +343,10 @@ BEGIN ...@@ -337,6 +343,10 @@ BEGIN
mmf_mm_bus_wr(c_mm_file_reg_bsn_source_v2, 1, c_nof_clk_per_sync, tb_clk); -- nof_block_per_sync mmf_mm_bus_wr(c_mm_file_reg_bsn_source_v2, 1, c_nof_clk_per_sync, tb_clk); -- nof_block_per_sync
mmf_mm_bus_wr(c_mm_file_reg_bsn_source_v2, 0, 16#00000003#, tb_clk); -- Enable BS at PPS mmf_mm_bus_wr(c_mm_file_reg_bsn_source_v2, 0, 16#00000003#, tb_clk); -- Enable BS at PPS
-- Release PPS pulser, to get first PPS now and to start BSN source
WAIT FOR 1 us;
pps_rst <= '0';
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
-- Enable WG -- Enable WG
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
...@@ -372,17 +382,18 @@ BEGIN ...@@ -372,17 +382,18 @@ BEGIN
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- . the subband statistics are c_wpfb_sim.stat_data_sz = 2 word power values. -- . the subband statistics are c_wpfb_sim.stat_data_sz = 2 word power values.
-- . there are c_sdp_N_sub = 512 subbands per signal path -- . there are c_sdp_N_sub = 512 subbands per signal path
-- . one complex WPFB can process two real inputs A, B -- . one complex WPFB can process two real inputs A, B, is c_sdp_Q_fft = c_sdp_N_pol = 2
-- . the subbands are output alternately so A0 B0 A1 B1 ... A511 B511 for input A, B -- . the subbands are output alternately so A0 B0 A1 B1 ... A511 B511 for input A, B
-- . the subband statistics multiple WPFB units appear in order in the ram_st_sst address map -- . the subband statistics multiple WPFB units appear in order in the ram_st_sst address map
-- . the subband statistics are stored first lo word 0 then hi word 1 -- . the subband statistics are stored first lo word 0 then hi word 1
FOR I IN 0 TO c_sdp_N_pol*c_sdp_S_sub_bf*(c_longword_sz/c_word_sz)-1 LOOP FOR I IN 0 TO c_sdp_N_pol*c_sdp_N_sub*c_stat_data_sz-1 LOOP -- 2048 = 2 * 512 * 64/32
v_W := I MOD (c_longword_sz/c_word_sz); v_W := I MOD c_stat_data_sz; -- 0, 1 per statistics word
v_T := (I / (c_longword_sz/c_word_sz)) MOD c_sdp_N_pol; v_T := (I / c_stat_data_sz) MOD c_sdp_N_pol; -- 0, 1 per pol
v_U := I / (c_sdp_N_pol*(c_longword_sz/c_word_sz)*c_sdp_S_sub_bf); v_U := I / (c_sdp_N_pol*c_stat_data_sz*c_sdp_N_sub); -- / 2048
v_S := v_T + v_U * c_sdp_N_pol; v_S := v_T + v_U * c_sdp_N_pol;
v_B := (I / (c_sdp_N_pol*(c_longword_sz/c_word_sz))) MOD c_sdp_S_sub_bf; v_B := (I / (c_sdp_N_pol*c_stat_data_sz)) MOD c_sdp_N_sub; -- 0:511 per dual pol
-- Only read sp 0, pol 0 (v_S = 0)
IF v_S=0 THEN IF v_S=0 THEN
IF v_W=0 THEN IF v_W=0 THEN
-- low part -- low part
...@@ -399,27 +410,27 @@ BEGIN ...@@ -399,27 +410,27 @@ BEGIN
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- Read beamlet statistics -- Read beamlet statistics
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- . the beamlet statistics are (c_longword_sz/c_word_sz) = 2 word power values. -- . the beamlet statistics are c_stat_data_sz = 2 word power values.
-- . there are c_sdp_S_sub_bf = 488 subbands per signal path -- . there are c_sdp_S_sub_bf = 488 subbands per signal path
-- . the subbands are output alternately so A0 B0 A1 B1 ... A5487 B487 for input A, B -- . the subbands are output alternately so A0 B0 A1 B1 ... A5487 B487 for input A, B
-- . the subband statistics multiple units appear in order in the ram_st_bst address map -- . the subband statistics multiple units appear in order in the ram_st_bst address map
-- . the subband statistics are stored first lo word 0 then hi word 1 -- . the subband statistics are stored first lo word 0 then hi word 1
-- . Only read beamset 0, pol 0 FOR I IN 0 TO c_sdp_N_pol_bf*c_sdp_S_sub_bf*c_stat_data_sz-1 LOOP
FOR I IN 0 TO c_sdp_N_pol*c_sdp_S_sub_bf*(c_longword_sz/c_word_sz)-1 LOOP v_W := I MOD c_stat_data_sz;
v_W := I MOD (c_longword_sz/c_word_sz); v_T := (I / c_stat_data_sz) MOD c_sdp_N_pol_bf;
v_T := (I / (c_longword_sz/c_word_sz)) MOD c_sdp_N_pol; v_U := I / (c_sdp_N_pol_bf*c_stat_data_sz*c_sdp_S_sub_bf);
v_U := I / (c_sdp_N_pol*(c_longword_sz/c_word_sz)*c_sdp_S_sub_bf); v_S := v_T + v_U * c_sdp_N_pol_bf;
v_S := v_T + v_U * c_sdp_N_pol; v_B := (I / (c_sdp_N_pol_bf*c_stat_data_sz)) MOD c_sdp_S_sub_bf;
v_B := (I / (c_sdp_N_pol*(c_longword_sz/c_word_sz))) MOD c_sdp_S_sub_bf; -- Only read beamset 0, pol 0 (v_S = 0)
IF v_S=0 THEN IF v_S=0 THEN
IF v_W=0 THEN IF v_W=0 THEN
-- low part -- low part
--mmf_mm_bus_rd(c_mm_file_ram_st_bst, I+(c_sdp_N_pol*c_sdp_N_sub*(c_longword_sz/c_word_sz)), rd_data, tb_clk); --mmf_mm_bus_rd(c_mm_file_ram_st_bst, I+(c_sdp_N_pol_bf*c_sdp_N_sub*c_stat_data_sz), rd_data, tb_clk);
mmf_mm_bus_rd(c_mm_file_ram_st_bst, I, rd_data, tb_clk); mmf_mm_bus_rd(c_mm_file_ram_st_bst, I, rd_data, tb_clk);
sp_beamlet_powers_arr2(v_S)(v_B)(31 DOWNTO 0) <= rd_data; sp_beamlet_powers_arr2(v_S)(v_B)(31 DOWNTO 0) <= rd_data;
ELSE ELSE
-- high part -- high part
--mmf_mm_bus_rd(c_mm_file_ram_st_bst, I+(c_sdp_N_pol*c_sdp_N_sub*(c_longword_sz/c_word_sz)), rd_data, tb_clk); --mmf_mm_bus_rd(c_mm_file_ram_st_bst, I+(c_sdp_N_pol_bf*c_sdp_N_sub*c_stat_data_sz), rd_data, tb_clk);
mmf_mm_bus_rd(c_mm_file_ram_st_bst, I, rd_data, tb_clk); mmf_mm_bus_rd(c_mm_file_ram_st_bst, I, rd_data, tb_clk);
sp_beamlet_powers_arr2(v_S)(v_B)(63 DOWNTO 32) <= rd_data; sp_beamlet_powers_arr2(v_S)(v_B)(63 DOWNTO 32) <= rd_data;
...@@ -436,47 +447,49 @@ BEGIN ...@@ -436,47 +447,49 @@ BEGIN
-- sp_beamlet_power_sum is the sum of all subband powers per SP, this value will be close to sp_beamlet_power -- sp_beamlet_power_sum is the sum of all subband powers per SP, this value will be close to sp_beamlet_power
-- because the input is a sinus, so most power will be in 1 subband. The sp_beamlet_power_leakage_sum shows -- because the input is a sinus, so most power will be in 1 subband. The sp_beamlet_power_leakage_sum shows
-- how much power from the input sinus at a specific subband has leaked into the 511 other subbands. -- how much power from the input sinus at a specific subband has leaked into the 511 other subbands.
sp_beamlet_power_0 <= REAL(TO_UINT(sp_beamlet_powers_arr2(0)(INTEGER(ROUND(c_subband_sp_0)))(61 DOWNTO 30)))*2.0**30 + sp_beamlet_power_0 <=
REAL(TO_UINT(sp_beamlet_powers_arr2(0)(INTEGER(ROUND(c_subband_sp_0)))(61 DOWNTO 30)))*2.0**30 +
REAL(TO_UINT(sp_beamlet_powers_arr2(0)(INTEGER(ROUND(c_subband_sp_0)))(29 DOWNTO 0))); REAL(TO_UINT(sp_beamlet_powers_arr2(0)(INTEGER(ROUND(c_subband_sp_0)))(29 DOWNTO 0)));
sp_beamlet_power_sum_0 <= sp_beamlet_power_sum(0); sp_beamlet_power_sum_0 <= sp_beamlet_power_sum(0);
proc_common_wait_some_cycles(tb_clk, 1); proc_common_wait_some_cycles(tb_clk, 1);
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- Read 10GbE Stream -- Read 10GbE Stream
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- Wait until start of a beamlet packet, capture only first block in packet
proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.sop); proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.sop);
FOR I IN 0 TO 8 LOOP -- Packet header is 9.25 words wide, which can be discarded FOR I IN 0 TO 8 LOOP -- Packet header is 9.25 words wide, which can be discarded
proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.valid); proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.valid);
proc_common_wait_some_cycles(ext_clk, 1); proc_common_wait_some_cycles(ext_clk, 1);
END LOOP; END LOOP;
-- First word contains 3 beamlets + 1 header part -- First word contains 1.5 dual pol (= XY, X) beamlets + 1 header part
beamlet_arr2_re(0) <= tr_10GbE_src_out.data(7 DOWNTO 0); beamlet_arr2_re(0) <= tr_10GbE_src_out.data(7 DOWNTO 0); -- X
beamlet_arr2_im(0) <= tr_10GbE_src_out.data(15 DOWNTO 8); beamlet_arr2_im(0) <= tr_10GbE_src_out.data(15 DOWNTO 8);
beamlet_arr2_re(1) <= tr_10GbE_src_out.data(23 DOWNTO 16); beamlet_arr2_re(1) <= tr_10GbE_src_out.data(23 DOWNTO 16); -- Y
beamlet_arr2_im(1) <= tr_10GbE_src_out.data(31 DOWNTO 24); beamlet_arr2_im(1) <= tr_10GbE_src_out.data(31 DOWNTO 24);
beamlet_arr2_re(2) <= tr_10GbE_src_out.data(39 DOWNTO 32); beamlet_arr2_re(2) <= tr_10GbE_src_out.data(39 DOWNTO 32); -- X
beamlet_arr2_im(2) <= tr_10GbE_src_out.data(47 DOWNTO 40); beamlet_arr2_im(2) <= tr_10GbE_src_out.data(47 DOWNTO 40);
proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.valid); proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.valid);
proc_common_wait_some_cycles(ext_clk, 1); proc_common_wait_some_cycles(ext_clk, 1);
FOR I IN 1 TO (c_sdp_cep_nof_beamlets_per_block/4)-1 LOOP -- 2 dual pol beamlets (= Y, XY, X) /64b data word
beamlet_arr2_re(I*4 -1) <= tr_10GbE_src_out.data(7 DOWNTO 0); FOR I IN 1 TO (c_sdp_cep_nof_beamlets_per_block/2)-1 LOOP
beamlet_arr2_re(I*4 -1) <= tr_10GbE_src_out.data(7 DOWNTO 0); -- Y
beamlet_arr2_im(I*4 -1) <= tr_10GbE_src_out.data(15 DOWNTO 8); beamlet_arr2_im(I*4 -1) <= tr_10GbE_src_out.data(15 DOWNTO 8);
beamlet_arr2_re(I*4 +0) <= tr_10GbE_src_out.data(23 DOWNTO 16); beamlet_arr2_re(I*4 +0) <= tr_10GbE_src_out.data(23 DOWNTO 16); -- X
beamlet_arr2_im(I*4 +0) <= tr_10GbE_src_out.data(31 DOWNTO 24); beamlet_arr2_im(I*4 +0) <= tr_10GbE_src_out.data(31 DOWNTO 24);
beamlet_arr2_re(I*4 +1) <= tr_10GbE_src_out.data(39 DOWNTO 32); beamlet_arr2_re(I*4 +1) <= tr_10GbE_src_out.data(39 DOWNTO 32); -- Y
beamlet_arr2_im(I*4 +1) <= tr_10GbE_src_out.data(47 DOWNTO 40); beamlet_arr2_im(I*4 +1) <= tr_10GbE_src_out.data(47 DOWNTO 40);
beamlet_arr2_re(I*4 +2) <= tr_10GbE_src_out.data(55 DOWNTO 48); beamlet_arr2_re(I*4 +2) <= tr_10GbE_src_out.data(55 DOWNTO 48); -- X
beamlet_arr2_im(I*4 +2) <= tr_10GbE_src_out.data(63 DOWNTO 56); beamlet_arr2_im(I*4 +2) <= tr_10GbE_src_out.data(63 DOWNTO 56);
proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.valid); proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.valid);
proc_common_wait_some_cycles(ext_clk, 1); proc_common_wait_some_cycles(ext_clk, 1);
END LOOP; END LOOP;
-- Last word contains last 0.5 (= Y) dual pol beamlet
beamlet_arr2_re(c_sdp_cep_nof_beamlets_per_block-1) <= tr_10GbE_src_out.data(55 DOWNTO 48); beamlet_arr2_re(c_sdp_cep_nof_beamlets_per_block * c_sdp_N_pol_bf-1) <= tr_10GbE_src_out.data(55 DOWNTO 48); -- Y
beamlet_arr2_im(c_sdp_cep_nof_beamlets_per_block-1) <= tr_10GbE_src_out.data(63 DOWNTO 56); beamlet_arr2_im(c_sdp_cep_nof_beamlets_per_block * c_sdp_N_pol_bf-1) <= tr_10GbE_src_out.data(63 DOWNTO 56);
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- Verify subband statistics -- Verify subband statistics
...@@ -522,8 +535,10 @@ BEGIN ...@@ -522,8 +535,10 @@ BEGIN
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- Verify 10GbE UDP offload -- Verify 10GbE UDP offload
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
ASSERT beamlet_arr2_re(c_exp_beamlet_index) = c_exp_beamlet_re REPORT "Wrong 10GbE output (re)" SEVERITY ERROR; v_re := TO_SINT(beamlet_arr2_re(c_exp_beamlet_index)); v_re_exp := TO_SINT(c_exp_beamlet_re);
ASSERT beamlet_arr2_im(c_exp_beamlet_index) = c_exp_beamlet_im REPORT "Wrong 10GbE output (im)" SEVERITY ERROR; v_im := TO_SINT(beamlet_arr2_im(c_exp_beamlet_index)); v_im_exp := TO_SINT(c_exp_beamlet_im);
ASSERT v_re = v_re_exp REPORT "Wrong 10GbE output (re) " & INTEGER'IMAGE(v_re) & " != " & INTEGER'IMAGE(v_re_exp) SEVERITY ERROR;
ASSERT v_im = v_im_exp REPORT "Wrong 10GbE output (im) " & INTEGER'IMAGE(v_re) & " != " & INTEGER'IMAGE(v_re_exp) SEVERITY ERROR;
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- End Simulation -- End Simulation
...@@ -534,4 +549,66 @@ BEGIN ...@@ -534,4 +549,66 @@ BEGIN
WAIT; WAIT;
END PROCESS; END PROCESS;
-----------------------------------------------------------------------------
-- Debugging signals
-----------------------------------------------------------------------------
-- Show received beamlets from 10GbE stream in Wave Window
-- . expect c_nof_block_per_sync / c_sdp_cep_nof_blocks_per_packet * c_sdp_N_beamsets
-- = 16 / 4 * 2 = 4 * 2 = 8 packets per sync interval
-- . expect c_sdp_cep_nof_beamlets_per_block = c_sdp_S_sub_bf = 488 dual pol
-- and complex beamlets per packet, so 2 dual pol beamlets/64b data word.
p_dbg_10GbE_beamlets : PROCESS
BEGIN
-- Wait until start of (next) beamlet packet
dbg_beamlet_cnt <= 0;
dbg_beamlet_valid <= '0';
proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.sop);
FOR I IN 0 TO 8 LOOP -- Packet header is 9.25 words wide, which can be discarded
proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.valid);
-- Use at least one WAIT instead of proc_common_wait_some_cycles() to avoid Modelsim warning:
-- (vcom-1090) Possible infinite loop: Process contains no WAIT statement.
WAIT UNTIL rising_edge(ext_clk);
END LOOP;
-- First word contains 1.5 dual pol (= XY, X) beamlets + 1 header part
dbg_beamlet_arr_re(0) <= tr_10GbE_src_out.data(7 DOWNTO 0); -- X
dbg_beamlet_arr_im(0) <= tr_10GbE_src_out.data(15 DOWNTO 8);
dbg_beamlet_arr_re(1) <= tr_10GbE_src_out.data(23 DOWNTO 16); -- Y
dbg_beamlet_arr_im(1) <= tr_10GbE_src_out.data(31 DOWNTO 24);
dbg_beamlet_arr_re(2) <= tr_10GbE_src_out.data(39 DOWNTO 32); -- X
dbg_beamlet_arr_im(2) <= tr_10GbE_src_out.data(47 DOWNTO 40);
dbg_beamlet_arr_re(3) <= (OTHERS => '1'); -- mark unused octet by 0xFF = -1
dbg_beamlet_arr_im(3) <= (OTHERS => '1'); -- mark unused octet by 0xFF = -1
dbg_beamlet_cnt <= dbg_beamlet_cnt + 3;
dbg_beamlet_valid <= '1';
proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.valid);
proc_common_wait_some_cycles(ext_clk, 1);
-- 2 dual pol beamlets (= Y, XY, X) /64b data word
FOR I IN 1 TO (c_sdp_cep_nof_beamlets_per_block*c_sdp_cep_nof_blocks_per_packet/2)-1 LOOP
dbg_beamlet_arr_re(0) <= tr_10GbE_src_out.data(7 DOWNTO 0); -- Y
dbg_beamlet_arr_im(0) <= tr_10GbE_src_out.data(15 DOWNTO 8);
dbg_beamlet_arr_re(1) <= tr_10GbE_src_out.data(23 DOWNTO 16); -- X
dbg_beamlet_arr_im(1) <= tr_10GbE_src_out.data(31 DOWNTO 24);
dbg_beamlet_arr_re(2) <= tr_10GbE_src_out.data(39 DOWNTO 32); -- Y
dbg_beamlet_arr_im(2) <= tr_10GbE_src_out.data(47 DOWNTO 40);
dbg_beamlet_arr_re(3) <= tr_10GbE_src_out.data(55 DOWNTO 48); -- X
dbg_beamlet_arr_im(3) <= tr_10GbE_src_out.data(63 DOWNTO 56);
dbg_beamlet_cnt <= (dbg_beamlet_cnt + 4) MOD c_sdp_cep_nof_beamlets_per_block; -- 4 blocks/packet
dbg_beamlet_valid <= '1';
proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.valid);
proc_common_wait_some_cycles(ext_clk, 1);
END LOOP;
-- Last word contains last 0.5 (= Y) dual pol beamlet
dbg_beamlet_arr_re(0) <= tr_10GbE_src_out.data(55 DOWNTO 48); -- Y
dbg_beamlet_arr_im(0) <= tr_10GbE_src_out.data(63 DOWNTO 56);
dbg_beamlet_arr_re(1) <= (OTHERS => '1'); -- mark unused octet by 0xFF = -1
dbg_beamlet_arr_im(1) <= (OTHERS => '1'); -- mark unused octet by 0xFF = -1
dbg_beamlet_arr_re(2) <= (OTHERS => '1'); -- mark unused octet by 0xFF = -1
dbg_beamlet_arr_im(2) <= (OTHERS => '1'); -- mark unused octet by 0xFF = -1
dbg_beamlet_arr_re(3) <= (OTHERS => '1'); -- mark unused octet by 0xFF = -1
dbg_beamlet_arr_im(3) <= (OTHERS => '1'); -- mark unused octet by 0xFF = -1
dbg_beamlet_cnt <= dbg_beamlet_cnt + 1;
dbg_beamlet_valid <= '1';
END PROCESS;
END tb; END tb;
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
-- > as 7 # default -- > as 7 # default
-- > as 12 # for detailed debugging -- > as 12 # for detailed debugging
-- > run -a -- > run -a
-- Takes about 10 m
-- --
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
LIBRARY IEEE, common_lib, unb2b_board_lib, i2c_lib, mm_lib, dp_lib, diag_lib, lofar2_sdp_lib, wpfb_lib, lofar2_unb2b_sdp_station_lib, eth_lib; LIBRARY IEEE, common_lib, unb2b_board_lib, i2c_lib, mm_lib, dp_lib, diag_lib, lofar2_sdp_lib, wpfb_lib, lofar2_unb2b_sdp_station_lib, eth_lib;
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
-- > as 7 # default -- > as 7 # default
-- > as 12 # for detailed debugging -- > as 12 # for detailed debugging
-- > run -a -- > run -a
-- Takes about 45 m
-- --
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
LIBRARY IEEE, common_lib, unb2c_board_lib, i2c_lib, mm_lib, dp_lib, diag_lib, lofar2_sdp_lib, wpfb_lib, tech_pll_lib, tr_10GbE_lib, lofar2_unb2c_sdp_station_lib; LIBRARY IEEE, common_lib, unb2c_board_lib, i2c_lib, mm_lib, dp_lib, diag_lib, lofar2_sdp_lib, wpfb_lib, tech_pll_lib, tr_10GbE_lib, lofar2_unb2c_sdp_station_lib;
...@@ -87,6 +88,7 @@ ARCHITECTURE tb OF tb_lofar2_unb2c_sdp_station_bf IS ...@@ -87,6 +88,7 @@ ARCHITECTURE tb OF tb_lofar2_unb2c_sdp_station_bf IS
CONSTANT c_nof_clk_per_sync : NATURAL := c_nof_block_per_sync*c_sdp_N_fft; CONSTANT c_nof_clk_per_sync : NATURAL := c_nof_block_per_sync*c_sdp_N_fft;
CONSTANT c_pps_period : NATURAL := c_nof_clk_per_sync; CONSTANT c_pps_period : NATURAL := c_nof_clk_per_sync;
CONSTANT c_wpfb_sim : t_wpfb := func_wpfb_set_nof_block_per_sync(c_sdp_wpfb_subbands, c_nof_block_per_sync); CONSTANT c_wpfb_sim : t_wpfb := func_wpfb_set_nof_block_per_sync(c_sdp_wpfb_subbands, c_nof_block_per_sync);
CONSTANT c_stat_data_sz : NATURAL := c_longword_sz/c_word_sz; -- = 2
CONSTANT c_percentage : REAL := 0.05; -- percentage that actual value may differ from expected value CONSTANT c_percentage : REAL := 0.05; -- percentage that actual value may differ from expected value
CONSTANT c_lo_factor : REAL := 1.0 - c_percentage; -- lower boundary CONSTANT c_lo_factor : REAL := 1.0 - c_percentage; -- lower boundary
...@@ -109,7 +111,8 @@ ARCHITECTURE tb OF tb_lofar2_unb2c_sdp_station_bf IS ...@@ -109,7 +111,8 @@ ARCHITECTURE tb OF tb_lofar2_unb2c_sdp_station_bf IS
CONSTANT c_exp_beamlet_power_sp_0 : REAL := c_exp_wg_power_sp_0 * c_exp_sp_beamlet_power_ratio; CONSTANT c_exp_beamlet_power_sp_0 : REAL := c_exp_wg_power_sp_0 * c_exp_sp_beamlet_power_ratio;
TYPE t_real_arr IS ARRAY (INTEGER RANGE <>) OF REAL; TYPE t_real_arr IS ARRAY (INTEGER RANGE <>) OF REAL;
TyPE t_slv_64_subbands_arr IS ARRAY (INTEGER RANGE <>) OF t_slv_64_arr(0 TO c_sdp_S_sub_bf); TYPE t_slv_64_subbands_arr IS ARRAY (INTEGER RANGE <>) OF t_slv_64_arr(0 TO c_sdp_N_sub);
TYPE t_slv_64_beamlets_arr IS ARRAY (INTEGER RANGE <>) OF t_slv_64_arr(0 TO c_sdp_S_sub_bf);
-- MM -- MM
CONSTANT c_mm_file_reg_ppsh : STRING := mmf_unb_file_prefix(c_unb_nr, c_node_nr) & "PIO_PPS"; CONSTANT c_mm_file_reg_ppsh : STRING := mmf_unb_file_prefix(c_unb_nr, c_node_nr) & "PIO_PPS";
...@@ -130,23 +133,28 @@ ARCHITECTURE tb OF tb_lofar2_unb2c_sdp_station_bf IS ...@@ -130,23 +133,28 @@ ARCHITECTURE tb OF tb_lofar2_unb2c_sdp_station_bf IS
SIGNAL current_bsn_wg : STD_LOGIC_VECTOR(c_dp_stream_bsn_w-1 DOWNTO 0); SIGNAL current_bsn_wg : STD_LOGIC_VECTOR(c_dp_stream_bsn_w-1 DOWNTO 0);
-- WPFB -- WPFB
SIGNAL sp_subband_powers_arr2 : t_slv_64_subbands_arr(c_sdp_N_beamsets*c_sdp_N_pol-1 DOWNTO 0); -- [sp][sub] SIGNAL sp_subband_powers_arr2 : t_slv_64_subbands_arr(c_sdp_N_pol-1 DOWNTO 0); -- [sp][sub]
SIGNAL sp_beamlet_powers_arr2 : t_slv_64_subbands_arr(c_sdp_N_beamsets*c_sdp_N_pol-1 DOWNTO 0); -- [sp][sub] SIGNAL sp_beamlet_powers_arr2 : t_slv_64_beamlets_arr(c_sdp_N_beamsets*c_sdp_N_pol_bf-1 DOWNTO 0); -- [sp][sub]
SIGNAL sp_beamlet_power_0 : REAL; SIGNAL sp_beamlet_power_0 : REAL;
SIGNAL sp_beamlet_power_sum : t_real_arr(c_sdp_N_beamsets*c_sdp_N_pol-1 DOWNTO 0) := (OTHERS=>0.0); SIGNAL sp_beamlet_power_sum : t_real_arr(c_sdp_N_beamsets*c_sdp_N_pol_bf-1 DOWNTO 0) := (OTHERS=>0.0);
SIGNAL sp_beamlet_power_sum_0 : REAL; SIGNAL sp_beamlet_power_sum_0 : REAL;
SIGNAL sp_beamlet_power_ratio_0 : REAL; SIGNAL sp_beamlet_power_ratio_0 : REAL;
SIGNAL sp_beamlet_power_sum_ratio_0 : REAL; SIGNAL sp_beamlet_power_sum_ratio_0 : REAL;
SIGNAL sp_beamlet_power_leakage_sum_0 : REAL; SIGNAL sp_beamlet_power_leakage_sum_0 : REAL;
-- 10GbE -- 10GbE
CONSTANT c_exp_beamlet_index : NATURAL := NATURAL(c_subband_sp_0) * c_sdp_N_pol; CONSTANT c_exp_beamlet_index : NATURAL := NATURAL(c_subband_sp_0) * c_sdp_N_pol_bf;
CONSTANT c_exp_beamlet_re : STD_LOGIC_VECTOR(7 DOWNTO 0) := x"81"; --Derived from simulation CONSTANT c_exp_beamlet_re : STD_LOGIC_VECTOR(7 DOWNTO 0) := x"81"; -- = -127, derived from simulation
CONSTANT c_exp_beamlet_im : STD_LOGIC_VECTOR(7 DOWNTO 0) := x"7F"; --Derived from simulation CONSTANT c_exp_beamlet_im : STD_LOGIC_VECTOR(7 DOWNTO 0) := x"7F"; -- = +127, derived from simulation
SIGNAL beamlet_arr2_re : t_slv_8_arr(c_sdp_cep_nof_beamlets_per_block-1 DOWNTO 0); SIGNAL dbg_beamlet_arr_re : t_slv_8_arr(c_sdp_cep_nof_blocks_per_packet-1 DOWNTO 0); -- [3:0]
SIGNAL beamlet_arr2_im : t_slv_8_arr(c_sdp_cep_nof_beamlets_per_block-1 DOWNTO 0); SIGNAL dbg_beamlet_arr_im : t_slv_8_arr(c_sdp_cep_nof_blocks_per_packet-1 DOWNTO 0); -- [3:0]
SIGNAL dbg_beamlet_cnt : NATURAL;
SIGNAL dbg_beamlet_valid : STD_LOGIC;
SIGNAL beamlet_arr2_re : t_slv_8_arr(c_sdp_cep_nof_beamlets_per_block * c_sdp_N_pol_bf-1 DOWNTO 0); -- [488 * 2-1:0] = [975:0]
SIGNAL beamlet_arr2_im : t_slv_8_arr(c_sdp_cep_nof_beamlets_per_block * c_sdp_N_pol_bf-1 DOWNTO 0); -- [488 * 2-1:0] = [975:0]
SIGNAL tr_10GbE_src_out : t_dp_sosi; SIGNAL tr_10GbE_src_out : t_dp_sosi;
SIGNAL tr_ref_clk_312 : STD_LOGIC := '0'; SIGNAL tr_ref_clk_312 : STD_LOGIC := '0';
...@@ -298,13 +306,12 @@ BEGIN ...@@ -298,13 +306,12 @@ BEGIN
VARIABLE v_sp_beamlet_power : REAL; VARIABLE v_sp_beamlet_power : REAL;
VARIABLE v_sp_subband_power : REAL; VARIABLE v_sp_subband_power : REAL;
VARIABLE v_W, v_T, v_U, v_S, v_B : NATURAL; -- array indicies VARIABLE v_W, v_T, v_U, v_S, v_B : NATURAL; -- array indicies
VARIABLE v_re, v_im : INTEGER;
VARIABLE v_re_exp, v_im_exp : INTEGER;
BEGIN BEGIN
-- Wait for DUT power up after reset -- Wait for DUT power up after reset
WAIT FOR 1 us; WAIT FOR 1 us;
proc_common_wait_until_hi_lo(ext_clk, ext_pps);
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
-- Enable UDP offload (dp_xonoff) of beamset 0 -- Enable UDP offload (dp_xonoff) of beamset 0
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
...@@ -319,6 +326,10 @@ BEGIN ...@@ -319,6 +326,10 @@ BEGIN
mmf_mm_bus_wr(c_mm_file_reg_bsn_source_v2, 1, c_nof_clk_per_sync, tb_clk); -- nof_block_per_sync mmf_mm_bus_wr(c_mm_file_reg_bsn_source_v2, 1, c_nof_clk_per_sync, tb_clk); -- nof_block_per_sync
mmf_mm_bus_wr(c_mm_file_reg_bsn_source_v2, 0, 16#00000003#, tb_clk); -- Enable BS at PPS mmf_mm_bus_wr(c_mm_file_reg_bsn_source_v2, 0, 16#00000003#, tb_clk); -- Enable BS at PPS
-- Release PPS pulser, to get first PPS now and to start BSN source
WAIT FOR 1 us;
pps_rst <= '0';
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
-- Enable WG -- Enable WG
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
...@@ -354,17 +365,18 @@ BEGIN ...@@ -354,17 +365,18 @@ BEGIN
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- . the subband statistics are c_wpfb_sim.stat_data_sz = 2 word power values. -- . the subband statistics are c_wpfb_sim.stat_data_sz = 2 word power values.
-- . there are c_sdp_N_sub = 512 subbands per signal path -- . there are c_sdp_N_sub = 512 subbands per signal path
-- . one complex WPFB can process two real inputs A, B -- . one complex WPFB can process two real inputs A, B, is c_sdp_Q_fft = c_sdp_N_pol = 2
-- . the subbands are output alternately so A0 B0 A1 B1 ... A511 B511 for input A, B -- . the subbands are output alternately so A0 B0 A1 B1 ... A511 B511 for input A, B
-- . the subband statistics multiple WPFB units appear in order in the ram_st_sst address map -- . the subband statistics multiple WPFB units appear in order in the ram_st_sst address map
-- . the subband statistics are stored first lo word 0 then hi word 1 -- . the subband statistics are stored first lo word 0 then hi word 1
FOR I IN 0 TO c_sdp_N_pol*c_sdp_S_sub_bf*(c_longword_sz/c_word_sz)-1 LOOP FOR I IN 0 TO c_sdp_N_pol*c_sdp_N_sub*c_stat_data_sz-1 LOOP -- 2048 = 2 * 512 * 64/32
v_W := I MOD (c_longword_sz/c_word_sz); v_W := I MOD c_stat_data_sz; -- 0, 1 per statistics word
v_T := (I / (c_longword_sz/c_word_sz)) MOD c_sdp_N_pol; v_T := (I / c_stat_data_sz) MOD c_sdp_N_pol; -- 0, 1 per pol
v_U := I / (c_sdp_N_pol*(c_longword_sz/c_word_sz)*c_sdp_S_sub_bf); v_U := I / (c_sdp_N_pol*c_stat_data_sz*c_sdp_N_sub); -- / 2048
v_S := v_T + v_U * c_sdp_N_pol; v_S := v_T + v_U * c_sdp_N_pol;
v_B := (I / (c_sdp_N_pol*(c_longword_sz/c_word_sz))) MOD c_sdp_S_sub_bf; v_B := (I / (c_sdp_N_pol*c_stat_data_sz)) MOD c_sdp_N_sub; -- 0:511 per dual pol
-- Only read sp 0, pol 0 (v_S = 0)
IF v_S=0 THEN IF v_S=0 THEN
IF v_W=0 THEN IF v_W=0 THEN
-- low part -- low part
...@@ -381,27 +393,27 @@ BEGIN ...@@ -381,27 +393,27 @@ BEGIN
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- Read beamlet statistics -- Read beamlet statistics
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- . the beamlet statistics are (c_longword_sz/c_word_sz) = 2 word power values. -- . the beamlet statistics are c_stat_data_sz = 2 word power values.
-- . there are c_sdp_S_sub_bf = 488 subbands per signal path -- . there are c_sdp_S_sub_bf = 488 subbands per signal path
-- . the subbands are output alternately so A0 B0 A1 B1 ... A5487 B487 for input A, B -- . the subbands are output alternately so A0 B0 A1 B1 ... A5487 B487 for input A, B
-- . the subband statistics multiple units appear in order in the ram_st_bst address map -- . the subband statistics multiple units appear in order in the ram_st_bst address map
-- . the subband statistics are stored first lo word 0 then hi word 1 -- . the subband statistics are stored first lo word 0 then hi word 1
-- . Only read beamset 0, pol 0 FOR I IN 0 TO c_sdp_N_pol_bf*c_sdp_S_sub_bf*c_stat_data_sz-1 LOOP
FOR I IN 0 TO c_sdp_N_pol*c_sdp_S_sub_bf*(c_longword_sz/c_word_sz)-1 LOOP v_W := I MOD c_stat_data_sz;
v_W := I MOD (c_longword_sz/c_word_sz); v_T := (I / c_stat_data_sz) MOD c_sdp_N_pol_bf;
v_T := (I / (c_longword_sz/c_word_sz)) MOD c_sdp_N_pol; v_U := I / (c_sdp_N_pol_bf*c_stat_data_sz*c_sdp_S_sub_bf);
v_U := I / (c_sdp_N_pol*(c_longword_sz/c_word_sz)*c_sdp_S_sub_bf); v_S := v_T + v_U * c_sdp_N_pol_bf;
v_S := v_T + v_U * c_sdp_N_pol; v_B := (I / (c_sdp_N_pol_bf*c_stat_data_sz)) MOD c_sdp_S_sub_bf;
v_B := (I / (c_sdp_N_pol*(c_longword_sz/c_word_sz))) MOD c_sdp_S_sub_bf; -- Only read beamset 0, pol 0 (v_S = 0)
IF v_S=0 THEN IF v_S=0 THEN
IF v_W=0 THEN IF v_W=0 THEN
-- low part -- low part
--mmf_mm_bus_rd(c_mm_file_ram_st_bst, I+(c_sdp_N_pol*c_sdp_N_sub*(c_longword_sz/c_word_sz)), rd_data, tb_clk); --mmf_mm_bus_rd(c_mm_file_ram_st_bst, I+(c_sdp_N_pol_bf*c_sdp_N_sub*c_stat_data_sz), rd_data, tb_clk);
mmf_mm_bus_rd(c_mm_file_ram_st_bst, I, rd_data, tb_clk); mmf_mm_bus_rd(c_mm_file_ram_st_bst, I, rd_data, tb_clk);
sp_beamlet_powers_arr2(v_S)(v_B)(31 DOWNTO 0) <= rd_data; sp_beamlet_powers_arr2(v_S)(v_B)(31 DOWNTO 0) <= rd_data;
ELSE ELSE
-- high part -- high part
--mmf_mm_bus_rd(c_mm_file_ram_st_bst, I+(c_sdp_N_pol*c_sdp_N_sub*(c_longword_sz/c_word_sz)), rd_data, tb_clk); --mmf_mm_bus_rd(c_mm_file_ram_st_bst, I+(c_sdp_N_pol_bf*c_sdp_N_sub*c_stat_data_sz), rd_data, tb_clk);
mmf_mm_bus_rd(c_mm_file_ram_st_bst, I, rd_data, tb_clk); mmf_mm_bus_rd(c_mm_file_ram_st_bst, I, rd_data, tb_clk);
sp_beamlet_powers_arr2(v_S)(v_B)(63 DOWNTO 32) <= rd_data; sp_beamlet_powers_arr2(v_S)(v_B)(63 DOWNTO 32) <= rd_data;
...@@ -418,47 +430,49 @@ BEGIN ...@@ -418,47 +430,49 @@ BEGIN
-- sp_beamlet_power_sum is the sum of all subband powers per SP, this value will be close to sp_beamlet_power -- sp_beamlet_power_sum is the sum of all subband powers per SP, this value will be close to sp_beamlet_power
-- because the input is a sinus, so most power will be in 1 subband. The sp_beamlet_power_leakage_sum shows -- because the input is a sinus, so most power will be in 1 subband. The sp_beamlet_power_leakage_sum shows
-- how much power from the input sinus at a specific subband has leaked into the 511 other subbands. -- how much power from the input sinus at a specific subband has leaked into the 511 other subbands.
sp_beamlet_power_0 <= REAL(TO_UINT(sp_beamlet_powers_arr2(0)(INTEGER(ROUND(c_subband_sp_0)))(61 DOWNTO 30)))*2.0**30 + sp_beamlet_power_0 <=
REAL(TO_UINT(sp_beamlet_powers_arr2(0)(INTEGER(ROUND(c_subband_sp_0)))(61 DOWNTO 30)))*2.0**30 +
REAL(TO_UINT(sp_beamlet_powers_arr2(0)(INTEGER(ROUND(c_subband_sp_0)))(29 DOWNTO 0))); REAL(TO_UINT(sp_beamlet_powers_arr2(0)(INTEGER(ROUND(c_subband_sp_0)))(29 DOWNTO 0)));
sp_beamlet_power_sum_0 <= sp_beamlet_power_sum(0); sp_beamlet_power_sum_0 <= sp_beamlet_power_sum(0);
proc_common_wait_some_cycles(tb_clk, 1); proc_common_wait_some_cycles(tb_clk, 1);
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- Read 10GbE Stream -- Read 10GbE Stream
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- Wait until start of a beamlet packet, capture only first block in packet
proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.sop); proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.sop);
FOR I IN 0 TO 8 LOOP -- Packet header is 9.25 words wide, which can be discarded FOR I IN 0 TO 8 LOOP -- Packet header is 9.25 words wide, which can be discarded
proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.valid); proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.valid);
proc_common_wait_some_cycles(ext_clk, 1); proc_common_wait_some_cycles(ext_clk, 1);
END LOOP; END LOOP;
-- First word contains 3 beamlets + 1 header part -- First word contains 1.5 dual pol (= XY, X) beamlets + 1 header part
beamlet_arr2_re(0) <= tr_10GbE_src_out.data(7 DOWNTO 0); beamlet_arr2_re(0) <= tr_10GbE_src_out.data(7 DOWNTO 0); -- X
beamlet_arr2_im(0) <= tr_10GbE_src_out.data(15 DOWNTO 8); beamlet_arr2_im(0) <= tr_10GbE_src_out.data(15 DOWNTO 8);
beamlet_arr2_re(1) <= tr_10GbE_src_out.data(23 DOWNTO 16); beamlet_arr2_re(1) <= tr_10GbE_src_out.data(23 DOWNTO 16); -- Y
beamlet_arr2_im(1) <= tr_10GbE_src_out.data(31 DOWNTO 24); beamlet_arr2_im(1) <= tr_10GbE_src_out.data(31 DOWNTO 24);
beamlet_arr2_re(2) <= tr_10GbE_src_out.data(39 DOWNTO 32); beamlet_arr2_re(2) <= tr_10GbE_src_out.data(39 DOWNTO 32); -- X
beamlet_arr2_im(2) <= tr_10GbE_src_out.data(47 DOWNTO 40); beamlet_arr2_im(2) <= tr_10GbE_src_out.data(47 DOWNTO 40);
proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.valid); proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.valid);
proc_common_wait_some_cycles(ext_clk, 1); proc_common_wait_some_cycles(ext_clk, 1);
FOR I IN 1 TO (c_sdp_cep_nof_beamlets_per_block/4)-1 LOOP -- 2 dual pol beamlets (= Y, XY, X) /64b data word
beamlet_arr2_re(I*4 -1) <= tr_10GbE_src_out.data(7 DOWNTO 0); FOR I IN 1 TO (c_sdp_cep_nof_beamlets_per_block/2)-1 LOOP
beamlet_arr2_re(I*4 -1) <= tr_10GbE_src_out.data(7 DOWNTO 0); -- Y
beamlet_arr2_im(I*4 -1) <= tr_10GbE_src_out.data(15 DOWNTO 8); beamlet_arr2_im(I*4 -1) <= tr_10GbE_src_out.data(15 DOWNTO 8);
beamlet_arr2_re(I*4 +0) <= tr_10GbE_src_out.data(23 DOWNTO 16); beamlet_arr2_re(I*4 +0) <= tr_10GbE_src_out.data(23 DOWNTO 16); -- X
beamlet_arr2_im(I*4 +0) <= tr_10GbE_src_out.data(31 DOWNTO 24); beamlet_arr2_im(I*4 +0) <= tr_10GbE_src_out.data(31 DOWNTO 24);
beamlet_arr2_re(I*4 +1) <= tr_10GbE_src_out.data(39 DOWNTO 32); beamlet_arr2_re(I*4 +1) <= tr_10GbE_src_out.data(39 DOWNTO 32); -- Y
beamlet_arr2_im(I*4 +1) <= tr_10GbE_src_out.data(47 DOWNTO 40); beamlet_arr2_im(I*4 +1) <= tr_10GbE_src_out.data(47 DOWNTO 40);
beamlet_arr2_re(I*4 +2) <= tr_10GbE_src_out.data(55 DOWNTO 48); beamlet_arr2_re(I*4 +2) <= tr_10GbE_src_out.data(55 DOWNTO 48); -- X
beamlet_arr2_im(I*4 +2) <= tr_10GbE_src_out.data(63 DOWNTO 56); beamlet_arr2_im(I*4 +2) <= tr_10GbE_src_out.data(63 DOWNTO 56);
proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.valid); proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.valid);
proc_common_wait_some_cycles(ext_clk, 1); proc_common_wait_some_cycles(ext_clk, 1);
END LOOP; END LOOP;
-- Last word contains last 0.5 (= Y) dual pol beamlet
beamlet_arr2_re(c_sdp_cep_nof_beamlets_per_block-1) <= tr_10GbE_src_out.data(55 DOWNTO 48); beamlet_arr2_re(c_sdp_cep_nof_beamlets_per_block * c_sdp_N_pol_bf-1) <= tr_10GbE_src_out.data(55 DOWNTO 48); -- Y
beamlet_arr2_im(c_sdp_cep_nof_beamlets_per_block-1) <= tr_10GbE_src_out.data(63 DOWNTO 56); beamlet_arr2_im(c_sdp_cep_nof_beamlets_per_block * c_sdp_N_pol_bf-1) <= tr_10GbE_src_out.data(63 DOWNTO 56);
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- Verify subband statistics -- Verify subband statistics
...@@ -504,8 +518,10 @@ BEGIN ...@@ -504,8 +518,10 @@ BEGIN
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- Verify 10GbE UDP offload -- Verify 10GbE UDP offload
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
ASSERT beamlet_arr2_re(c_exp_beamlet_index) = c_exp_beamlet_re REPORT "Wrong 10GbE output (re)" SEVERITY ERROR; v_re := TO_SINT(beamlet_arr2_re(c_exp_beamlet_index)); v_re_exp := TO_SINT(c_exp_beamlet_re);
ASSERT beamlet_arr2_im(c_exp_beamlet_index) = c_exp_beamlet_im REPORT "Wrong 10GbE output (im)" SEVERITY ERROR; v_im := TO_SINT(beamlet_arr2_im(c_exp_beamlet_index)); v_im_exp := TO_SINT(c_exp_beamlet_im);
ASSERT v_re = v_re_exp REPORT "Wrong 10GbE output (re) " & INTEGER'IMAGE(v_re) & " != " & INTEGER'IMAGE(v_re_exp) SEVERITY ERROR;
ASSERT v_im = v_im_exp REPORT "Wrong 10GbE output (im) " & INTEGER'IMAGE(v_re) & " != " & INTEGER'IMAGE(v_re_exp) SEVERITY ERROR;
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- End Simulation -- End Simulation
...@@ -516,4 +532,66 @@ BEGIN ...@@ -516,4 +532,66 @@ BEGIN
WAIT; WAIT;
END PROCESS; END PROCESS;
-----------------------------------------------------------------------------
-- Debugging signals
-----------------------------------------------------------------------------
-- Show received beamlets from 10GbE stream in Wave Window
-- . expect c_nof_block_per_sync / c_sdp_cep_nof_blocks_per_packet * c_sdp_N_beamsets
-- = 16 / 4 * 2 = 4 * 2 = 8 packets per sync interval
-- . expect c_sdp_cep_nof_beamlets_per_block = c_sdp_S_sub_bf = 488 dual pol
-- and complex beamlets per packet, so 2 dual pol beamlets/64b data word.
p_dbg_10GbE_beamlets : PROCESS
BEGIN
-- Wait until start of (next) beamlet packet
dbg_beamlet_cnt <= 0;
dbg_beamlet_valid <= '0';
proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.sop);
FOR I IN 0 TO 8 LOOP -- Packet header is 9.25 words wide, which can be discarded
proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.valid);
-- Use at least one WAIT instead of proc_common_wait_some_cycles() to avoid Modelsim warning:
-- (vcom-1090) Possible infinite loop: Process contains no WAIT statement.
WAIT UNTIL rising_edge(ext_clk);
END LOOP;
-- First word contains 1.5 dual pol (= XY, X) beamlets + 1 header part
dbg_beamlet_arr_re(0) <= tr_10GbE_src_out.data(7 DOWNTO 0); -- X
dbg_beamlet_arr_im(0) <= tr_10GbE_src_out.data(15 DOWNTO 8);
dbg_beamlet_arr_re(1) <= tr_10GbE_src_out.data(23 DOWNTO 16); -- Y
dbg_beamlet_arr_im(1) <= tr_10GbE_src_out.data(31 DOWNTO 24);
dbg_beamlet_arr_re(2) <= tr_10GbE_src_out.data(39 DOWNTO 32); -- X
dbg_beamlet_arr_im(2) <= tr_10GbE_src_out.data(47 DOWNTO 40);
dbg_beamlet_arr_re(3) <= (OTHERS => '1'); -- mark unused octet by 0xFF = -1
dbg_beamlet_arr_im(3) <= (OTHERS => '1'); -- mark unused octet by 0xFF = -1
dbg_beamlet_cnt <= dbg_beamlet_cnt + 3;
dbg_beamlet_valid <= '1';
proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.valid);
proc_common_wait_some_cycles(ext_clk, 1);
-- 2 dual pol beamlets (= Y, XY, X) /64b data word
FOR I IN 1 TO (c_sdp_cep_nof_beamlets_per_block*c_sdp_cep_nof_blocks_per_packet/2)-1 LOOP
dbg_beamlet_arr_re(0) <= tr_10GbE_src_out.data(7 DOWNTO 0); -- Y
dbg_beamlet_arr_im(0) <= tr_10GbE_src_out.data(15 DOWNTO 8);
dbg_beamlet_arr_re(1) <= tr_10GbE_src_out.data(23 DOWNTO 16); -- X
dbg_beamlet_arr_im(1) <= tr_10GbE_src_out.data(31 DOWNTO 24);
dbg_beamlet_arr_re(2) <= tr_10GbE_src_out.data(39 DOWNTO 32); -- Y
dbg_beamlet_arr_im(2) <= tr_10GbE_src_out.data(47 DOWNTO 40);
dbg_beamlet_arr_re(3) <= tr_10GbE_src_out.data(55 DOWNTO 48); -- X
dbg_beamlet_arr_im(3) <= tr_10GbE_src_out.data(63 DOWNTO 56);
dbg_beamlet_cnt <= (dbg_beamlet_cnt + 4) MOD c_sdp_cep_nof_beamlets_per_block; -- 4 blocks/packet
dbg_beamlet_valid <= '1';
proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.valid);
proc_common_wait_some_cycles(ext_clk, 1);
END LOOP;
-- Last word contains last 0.5 (= Y) dual pol beamlet
dbg_beamlet_arr_re(0) <= tr_10GbE_src_out.data(55 DOWNTO 48); -- Y
dbg_beamlet_arr_im(0) <= tr_10GbE_src_out.data(63 DOWNTO 56);
dbg_beamlet_arr_re(1) <= (OTHERS => '1'); -- mark unused octet by 0xFF = -1
dbg_beamlet_arr_im(1) <= (OTHERS => '1'); -- mark unused octet by 0xFF = -1
dbg_beamlet_arr_re(2) <= (OTHERS => '1'); -- mark unused octet by 0xFF = -1
dbg_beamlet_arr_im(2) <= (OTHERS => '1'); -- mark unused octet by 0xFF = -1
dbg_beamlet_arr_re(3) <= (OTHERS => '1'); -- mark unused octet by 0xFF = -1
dbg_beamlet_arr_im(3) <= (OTHERS => '1'); -- mark unused octet by 0xFF = -1
dbg_beamlet_cnt <= dbg_beamlet_cnt + 1;
dbg_beamlet_valid <= '1';
END PROCESS;
END tb; END tb;
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
-- > as 7 # default -- > as 7 # default
-- > as 12 # for detailed debugging -- > as 12 # for detailed debugging
-- > run -a -- > run -a
-- Takes about 10 m
-- --
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
LIBRARY IEEE, common_lib, unb2c_board_lib, i2c_lib, mm_lib, dp_lib, diag_lib, lofar2_sdp_lib, wpfb_lib, lofar2_unb2c_sdp_station_lib, eth_lib; LIBRARY IEEE, common_lib, unb2c_board_lib, i2c_lib, mm_lib, dp_lib, diag_lib, lofar2_sdp_lib, wpfb_lib, lofar2_unb2c_sdp_station_lib, eth_lib;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment