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

Support g_read_all_SST.

parent 4bdc79e2
No related branches found
No related tags found
1 merge request!198Clarified reading one WPFB unit into sp_subband_powers_arr2. Updated comments....
...@@ -50,10 +50,12 @@ ...@@ -50,10 +50,12 @@
-- Usage: -- Usage:
-- > as 7 # default -- > as 7 # default
-- > as 12 # for detailed debugging -- > as 12 # for detailed debugging
-- add wave -position insertpoint \ -- # Manually add missing signal
-- > add wave -position insertpoint \
-- sim:/tb_lofar2_unb2b_sdp_station_fsub/sp_subband_ssts_arr2 -- sim:/tb_lofar2_unb2b_sdp_station_fsub/sp_subband_ssts_arr2
-- > run -a -- > run -a
-- # Takes about 40 m -- # Takes about 30 m when g_read_all_SST = FALSE
-- # Takes about 40 m when g_read_all_SST = TRUE
-- --
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
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; 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;
...@@ -77,7 +79,8 @@ ENTITY tb_lofar2_unb2b_sdp_station_fsub IS ...@@ -77,7 +79,8 @@ ENTITY tb_lofar2_unb2b_sdp_station_fsub IS
g_wg_ampl : REAL := 1.0; -- WG normalized amplitude g_wg_ampl : REAL := 1.0; -- WG normalized amplitude
g_subband : NATURAL := 102; -- select subband at index 102 = 102/1024 * 200MHz = 19.921875 MHz g_subband : NATURAL := 102; -- select subband at index 102 = 102/1024 * 200MHz = 19.921875 MHz
g_subband_weight_gain : REAL := 1.0; -- subband weight normalized gain g_subband_weight_gain : REAL := 1.0; -- subband weight normalized gain
g_subband_weight_phase : REAL := 30.0 -- subband weight phase rotation in degrees g_subband_weight_phase : REAL := 30.0; -- subband weight phase rotation in degrees
g_read_all_SST : BOOLEAN := TRUE -- when FALSE only read SST for g_subband, to save sim time
); );
END tb_lofar2_unb2b_sdp_station_fsub; END tb_lofar2_unb2b_sdp_station_fsub;
...@@ -416,23 +419,27 @@ BEGIN ...@@ -416,23 +419,27 @@ BEGIN
v_P := (I / c_stat_data_sz) MOD c_sdp_N_pol; -- 0, 1 per SP pol, polarization index v_P := (I / c_stat_data_sz) MOD c_sdp_N_pol; -- 0, 1 per SP pol, polarization index
v_B := I / (c_sdp_N_pol * c_stat_data_sz); -- subband index, range(N_sub = 512) per dual pol v_B := I / (c_sdp_N_pol * c_stat_data_sz); -- subband index, range(N_sub = 512) per dual pol
v_addr := I + c_pfb_index * v_span; -- MM address for WPFB unit of selected g_sp v_addr := I + c_pfb_index * v_span; -- MM address for WPFB unit of selected g_sp
IF v_W = 0 THEN -- Only read SST for g_subband for dual pol SP, to save sim time
-- low part IF g_read_all_SST = TRUE OR v_B = g_subband THEN
mmf_mm_bus_rd(c_mm_file_ram_st_sst, v_addr, rd_data, tb_clk); IF v_W = 0 THEN
v_data_lo := rd_data; -- low part
ELSE mmf_mm_bus_rd(c_mm_file_ram_st_sst, v_addr, rd_data, tb_clk);
-- high part v_data_lo := rd_data;
mmf_mm_bus_rd(c_mm_file_ram_st_sst, v_addr, rd_data, tb_clk); ELSE
v_data_hi := rd_data; -- high part
v_stat_data := v_data_hi & v_data_lo; mmf_mm_bus_rd(c_mm_file_ram_st_sst, v_addr, rd_data, tb_clk);
v_data_hi := rd_data;
sp_subband_ssts_arr2(v_P)(v_B) <= v_stat_data; v_stat_data := v_data_hi & v_data_lo;
stat_data <= v_stat_data; -- for time series view in Wave window
sp_subband_ssts_arr2(v_P)(v_B) <= v_stat_data;
-- sum of all subband powers per pol stat_data <= v_stat_data; -- for time series view in Wave window
sp_subband_sst_sum_arr(v_P) <= sp_subband_sst_sum_arr(v_P) + TO_UREAL(v_stat_data);
-- sum of all subband powers per pol
sp_subband_sst_sum_arr(v_P) <= sp_subband_sst_sum_arr(v_P) + TO_UREAL(v_stat_data);
END IF;
END IF; END IF;
END LOOP; END LOOP;
proc_common_wait_some_cycles(tb_clk, 1);
-- Subband power of g_subband in g_sp -- Subband power of g_subband in g_sp
-- . For the selected g_subband in g_sp the sp_subband_sst will be close -- . For the selected g_subband in g_sp the sp_subband_sst will be close
...@@ -446,9 +453,9 @@ BEGIN ...@@ -446,9 +453,9 @@ BEGIN
-- indication of the SNR, although that also depends on the SNR of the WG sinus. -- indication of the SNR, although that also depends on the SNR of the WG sinus.
v_power := sp_subband_sst_sum_arr(c_pol_index) - sp_subband_sst; v_power := sp_subband_sst_sum_arr(c_pol_index) - sp_subband_sst;
sp_subband_sst_leakage <= v_power; sp_subband_sst_leakage <= v_power;
IF v_power > 0.0 THEN IF sp_subband_sst > c_eps AND v_power > c_eps THEN
sp_subband_sst_leakage_snr_dB <= 10.0 * LOG10(sp_subband_sst / v_power); sp_subband_sst_leakage_snr_dB <= 10.0 * LOG10(sp_subband_sst / v_power);
ELSE ELSIF g_read_all_SST THEN
REPORT "Wrong, zero leakage is unexpected for SP-" & NATURAL'IMAGE(g_sp) SEVERITY ERROR; REPORT "Wrong, zero leakage is unexpected for SP-" & NATURAL'IMAGE(g_sp) SEVERITY ERROR;
END IF; END IF;
...@@ -457,13 +464,13 @@ BEGIN ...@@ -457,13 +464,13 @@ BEGIN
-- ration indicates the suppression, provided that the other input was zero. -- ration indicates the suppression, provided that the other input was zero.
v_power := sp_subband_sst_sum_arr(not_int(c_pol_index)); v_power := sp_subband_sst_sum_arr(not_int(c_pol_index));
sp_subband_sst_crosstalk <= v_power; sp_subband_sst_crosstalk <= v_power;
IF v_power > 0.0 THEN IF sp_subband_sst > c_eps AND v_power > c_eps THEN
sp_subband_sst_crosstalk_snr_dB <= 10.0 * LOG10(sp_subband_sst / v_power); sp_subband_sst_crosstalk_snr_dB <= 10.0 * LOG10(sp_subband_sst / v_power);
ELSE ELSIF g_read_all_SST THEN
REPORT "Wrong, zero crosstalk is unexpected for SP-" & NATURAL'IMAGE(g_sp) SEVERITY ERROR; REPORT "Wrong, zero crosstalk is unexpected for SP-" & NATURAL'IMAGE(g_sp) SEVERITY ERROR;
END IF; END IF;
proc_common_wait_some_cycles(tb_clk, 1); proc_common_wait_some_cycles(tb_clk, 10);
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- Log WG, subband statistics -- Log WG, subband statistics
...@@ -492,14 +499,16 @@ BEGIN ...@@ -492,14 +499,16 @@ BEGIN
print_str(". sp_subband_sst = " & real_to_str(sp_subband_sst, 20, 1)); print_str(". sp_subband_sst = " & real_to_str(sp_subband_sst, 20, 1));
print_str(". sp_subband_sst / exp_subband_sst = " & real_to_str(sp_subband_sst / exp_subband_sst, 20, 6)); print_str(". sp_subband_sst / exp_subband_sst = " & real_to_str(sp_subband_sst / exp_subband_sst, 20, 6));
-- Log WPFB details, these are allready verified in tb of wpfb_unit_dev.vhd, so here IF g_read_all_SST THEN
-- quality indicators like leakage and crosstalk are also reported out of interest. -- Log WPFB details, these are allready verified in tb of wpfb_unit_dev.vhd, so here
print_str(""); -- quality indicators like leakage and crosstalk are also reported out of interest.
print_str("SST quality indicators"); print_str("");
print_str(". sp_subband_sst_leakage = " & real_to_str(sp_subband_sst_leakage, 20, 0)); print_str("SST quality indicators");
print_str(". sp_subband_sst_leakage_snr_dB = " & real_to_str(sp_subband_sst_leakage_snr_dB, 20, 3)); print_str(". sp_subband_sst_leakage = " & real_to_str(sp_subband_sst_leakage, 20, 0));
print_str(". sp_subband_sst_crosstalk = " & real_to_str(sp_subband_sst_crosstalk, 20, 0)); print_str(". sp_subband_sst_leakage_snr_dB = " & real_to_str(sp_subband_sst_leakage_snr_dB, 20, 3));
print_str(". sp_subband_sst_crosstalk_snr_db = " & real_to_str(sp_subband_sst_crosstalk_snr_db, 20, 3)); print_str(". sp_subband_sst_crosstalk = " & real_to_str(sp_subband_sst_crosstalk, 20, 0));
print_str(". sp_subband_sst_crosstalk_snr_db = " & real_to_str(sp_subband_sst_crosstalk_snr_db, 20, 3));
END IF;
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- Verify SST -- Verify SST
...@@ -508,9 +517,11 @@ BEGIN ...@@ -508,9 +517,11 @@ BEGIN
ASSERT sp_subband_sst > c_lo_factor * exp_subband_sst REPORT "Wrong subband power for SP " & NATURAL'IMAGE(g_sp) SEVERITY ERROR; ASSERT sp_subband_sst > c_lo_factor * exp_subband_sst REPORT "Wrong subband power for SP " & NATURAL'IMAGE(g_sp) SEVERITY ERROR;
ASSERT sp_subband_sst < c_hi_factor * exp_subband_sst REPORT "Wrong subband power for SP " & NATURAL'IMAGE(g_sp) SEVERITY ERROR; ASSERT sp_subband_sst < c_hi_factor * exp_subband_sst REPORT "Wrong subband power for SP " & NATURAL'IMAGE(g_sp) SEVERITY ERROR;
-- Verify expected SNR quality measures IF g_read_all_SST THEN
ASSERT sp_subband_sst_leakage_snr_dB > c_exp_subband_sst_leakage_snr_dB REPORT "Wrong to much leakage for SP " & NATURAL'IMAGE(g_sp) SEVERITY ERROR; -- Verify expected SNR quality measures
ASSERT sp_subband_sst_crosstalk_snr_dB > c_exp_subband_sst_crosstalk_snr_dB REPORT "Wrong to much crosstalk for SP " & NATURAL'IMAGE(g_sp) SEVERITY ERROR; ASSERT sp_subband_sst_leakage_snr_dB > c_exp_subband_sst_leakage_snr_dB REPORT "Wrong to much leakage for SP " & NATURAL'IMAGE(g_sp) SEVERITY ERROR;
ASSERT sp_subband_sst_crosstalk_snr_dB > c_exp_subband_sst_crosstalk_snr_dB REPORT "Wrong to much crosstalk for SP " & NATURAL'IMAGE(g_sp) SEVERITY ERROR;
END IF;
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- End Simulation -- End Simulation
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment