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 @@
-- Usage:
-- > as 7 # default
-- > 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
-- > 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;
......@@ -77,7 +79,8 @@ ENTITY tb_lofar2_unb2b_sdp_station_fsub IS
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_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;
......@@ -416,6 +419,8 @@ BEGIN
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_addr := I + c_pfb_index * v_span; -- MM address for WPFB unit of selected g_sp
-- Only read SST for g_subband for dual pol SP, to save sim time
IF g_read_all_SST = TRUE OR v_B = g_subband THEN
IF v_W = 0 THEN
-- low part
mmf_mm_bus_rd(c_mm_file_ram_st_sst, v_addr, rd_data, tb_clk);
......@@ -432,7 +437,9 @@ BEGIN
-- 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 LOOP;
proc_common_wait_some_cycles(tb_clk, 1);
-- Subband power of g_subband in g_sp
-- . For the selected g_subband in g_sp the sp_subband_sst will be close
......@@ -446,9 +453,9 @@ BEGIN
-- 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;
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);
ELSE
ELSIF g_read_all_SST THEN
REPORT "Wrong, zero leakage is unexpected for SP-" & NATURAL'IMAGE(g_sp) SEVERITY ERROR;
END IF;
......@@ -457,13 +464,13 @@ BEGIN
-- ration indicates the suppression, provided that the other input was zero.
v_power := sp_subband_sst_sum_arr(not_int(c_pol_index));
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);
ELSE
ELSIF g_read_all_SST THEN
REPORT "Wrong, zero crosstalk is unexpected for SP-" & NATURAL'IMAGE(g_sp) SEVERITY ERROR;
END IF;
proc_common_wait_some_cycles(tb_clk, 1);
proc_common_wait_some_cycles(tb_clk, 10);
---------------------------------------------------------------------------
-- Log WG, subband statistics
......@@ -492,6 +499,7 @@ BEGIN
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));
IF g_read_all_SST THEN
-- Log WPFB details, these are allready verified in tb of wpfb_unit_dev.vhd, so here
-- quality indicators like leakage and crosstalk are also reported out of interest.
print_str("");
......@@ -500,6 +508,7 @@ BEGIN
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 = " & 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
......@@ -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_hi_factor * exp_subband_sst REPORT "Wrong subband power for SP " & NATURAL'IMAGE(g_sp) SEVERITY ERROR;
IF g_read_all_SST THEN
-- Verify expected SNR quality measures
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment