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

Log SST powers also in dB.

parent 2b2d7e6e
No related branches found
No related tags found
1 merge request!151Resolve L2SDP-490
......@@ -117,7 +117,7 @@ ENTITY tb_verify_pfb_wg IS
--g_sel_pfb : STRING := "PFB2";
-- WG
g_subband_index_a : REAL := 61.1; -- 0:511
g_subband_index_a : REAL := 61.0; -- 0:511
g_subband_index_b : REAL := 61.0; -- 0:511
g_amplitude_a : REAL := 1.0; -- 1.0 is full scale
g_amplitude_b : REAL := 0.0; -- 1.0 is full scale
......@@ -152,14 +152,14 @@ ENTITY tb_verify_pfb_wg IS
g_fil_backoff_w : NATURAL := 0; -- = 0, number of bits for input backoff to avoid output overflow
g_fil_in_dat_w : NATURAL := 14; -- = W_adc, number of input bits
g_internal_dat_w : NATURAL := 17; -- = number of bits between fil and fft, use 0 to use maximum default:
g_internal_dat_w : NATURAL := 0; -- = number of bits between fil and fft, use 0 to use maximum default:
-- . WPFB : g_internal_dat_w <= g_fft_stage_dat_w - g_fft_guard_w in fft_r2_pipe
-- . PFB2 : g_internal_dat_w <= g_fft_stage_dat_w
-- FFT
g_fft_out_dat_w : NATURAL := 18; -- = W_subband, number of output bits
g_fft_out_gain_w : NATURAL := 0; -- = 1, output gain factor applied after the last stage output, before requantization to out_dat_w
g_fft_stage_dat_w : NATURAL := 18; -- = c_dsp_mult_w = 18, number of bits that are used inter-stage
g_fft_out_gain_w : NATURAL := 1; -- = 1, output gain factor applied after the last stage output, before requantization to out_dat_w
g_fft_stage_dat_w : NATURAL := 27; -- = c_dsp_mult_w = 18, number of bits that are used inter-stage
g_fft_guard_w : NATURAL := 1; -- = 2
g_switch_en : STD_LOGIC := '0'; -- two real input decorrelation option in PFB2
g_r2_mul_extra_w : NATURAL := 0; -- = 2, WPFB extra bits at rTwoWMul output in rTwoSDFStage to improve rTwoSDFStage output requantization in fft_r2_pipe in wpfb_unit_dev
......@@ -246,8 +246,8 @@ ARCHITECTURE tb OF tb_verify_pfb_wg IS
CONSTANT c_nof_channels : NATURAL := 2**c_wpfb.nof_chan; -- = 2**0 = 1, so no time multiplexing of inputs
CONSTANT c_nof_sync : NATURAL := 5; -- nof sync intervals to simulate
CONSTANT c_pfb_sub_scaling : REAL := 2.0**REAL(g_fft_out_dat_w - g_fil_in_dat_w - 1); -- expected subband amplitude gain relative to input WG amplitude
-- -1 for divide by 2 in two real input separate (Ampl --> Ampl/2)
CONSTANT c_pfb_sub_scaling : REAL := 2.0**REAL(g_fft_out_dat_w + g_fft_out_gain_w - g_fil_in_dat_w - 1); -- expected subband amplitude gain relative to input WG amplitude
-- -1 for divide by 2 in two real input separate (Ampl --> Ampl/2)
-- Subband at WG frequency
CONSTANT c_bin_a : NATURAL := NATURAL(FLOOR(g_subband_index_a));
CONSTANT c_bin_a_frac_en : BOOLEAN := g_subband_index_a > REAL(c_bin_a);
......@@ -463,9 +463,13 @@ ARCHITECTURE tb OF tb_verify_pfb_wg IS
SIGNAL sp_subband_powers_b : t_nat_real_arr(0 TO c_N_sub-1) := (OTHERS=>0.0);
SIGNAL sst_wg_power_a : REAL := 0.0; -- measured WG sine power at WG bin in SST
SIGNAL sst_wg_power_a_dB : REAL := 0.0; -- measured WG sine power at WG bin in SST in dB
SIGNAL sst_noise_a : REAL := 0.0; -- measured sum of noise power in all other bins in SST
SIGNAL sst_noise_a_dB : REAL := 0.0; -- measured sum of noise power in all other bins in SST in dB
SIGNAL sst_wg_power_b : REAL := 0.0; -- measured WG sine power at WG bin in SST
SIGNAL sst_wg_power_b_dB : REAL := 0.0; -- measured WG sine power at WG bin in SST in dB
SIGNAL sst_noise_b : REAL := 0.0; -- measured sum of noise power in all other bins in SST
SIGNAL sst_noise_b_dB : REAL := 0.0; -- measured sum of noise power in all other bins in SST in dB
-- SNR and WPFB processing gain
SIGNAL sst_measured_snr_a : REAL := 0.0;
......@@ -938,6 +942,12 @@ BEGIN
END LOOP;
sst_noise_b <= v_sst_noise / REAL(c_N_sub - 1);
proc_common_wait_some_cycles(dp_clk, 1);
-- SST power in dB
sst_wg_power_a_dB <= 10.0 * LOG10(sst_wg_power_a + c_eps);
sst_wg_power_b_dB <= 10.0 * LOG10(sst_wg_power_b + c_eps);
sst_noise_a_dB <= 10.0 * LOG10(sst_noise_a + c_eps);
sst_noise_b_dB <= 10.0 * LOG10(sst_noise_b + c_eps);
-- Determine SNR in WG subband, using noise power in one subband
sst_measured_snr_a <= sst_wg_power_a / (sst_noise_a + c_eps); proc_common_wait_some_cycles(dp_clk, 1);
......@@ -1025,9 +1035,9 @@ BEGIN
print_str(". fil_phase_Ts_a = " & real_to_str(fil_phase_Ts_a, 10, 3));
print_str("");
print_str("Powers:");
print_str(". sst_wg_power_a = " & real_to_str(sst_wg_power_a, 15, 3));
print_str(". sst_noise_a = " & real_to_str(sst_noise_a, 15, 3));
print_str(". sst_noise_b = " & real_to_str(sst_noise_b, 15, 3)); -- FFT cross talk power from a to b (if g_amplitude_b = 0)
print_str(". sst_wg_power_a = " & real_to_str(sst_wg_power_a, 15, 3) & " = " & real_to_str(sst_wg_power_a_dB, 7, 2) & " [dB]");
print_str(". sst_noise_a = " & real_to_str(sst_noise_a, 15, 3) & " = " & real_to_str(sst_noise_a_dB, 7, 2) & " [dB]");
print_str(". sst_noise_b = " & real_to_str(sst_noise_b, 15, 3) & " = " & real_to_str(sst_noise_b_dB, 7, 2) & " [dB]"); -- FFT cross talk power from a to b (if g_amplitude_b = 0)
print_str("");
print_str("SNR and WPFB processing gain:");
print_str(". c_wg_snr_a_dB = " & real_to_str(c_wg_snr_a_dB, 7, 2) & " [dB]");
......@@ -1067,9 +1077,9 @@ BEGIN
print_str(". cw_phase_Ts_b = " & real_to_str(cw_phase_Ts_b, 10, 3));
print_str(". fil_phase_Ts_b = " & real_to_str(fil_phase_Ts_b, 10, 3));
print_str("Powers:");
print_str(". sst_wg_power_b = " & real_to_str(sst_wg_power_b, 15, 3));
print_str(". sst_noise_b = " & real_to_str(sst_noise_b, 15, 3));
print_str(". sst_noise_a = " & real_to_str(sst_noise_a, 15, 3)); -- FFT cross talk power from b to a (if g_amplitude_a = 0)
print_str(". sst_wg_power_b = " & real_to_str(sst_wg_power_b, 15, 3) & " = " & real_to_str(sst_wg_power_b_dB, 7, 2) & " [dB]");
print_str(". sst_noise_b = " & real_to_str(sst_noise_b, 15, 3) & " = " & real_to_str(sst_noise_b_dB, 7, 2) & " [dB]");
print_str(". sst_noise_a = " & real_to_str(sst_noise_a, 15, 3) & " = " & real_to_str(sst_noise_a_dB, 7, 2) & " [dB]"); -- FFT cross talk power from b to a (if g_amplitude_a = 0)
print_str("");
print_str("SNR and WPFB processing gain:");
print_str(". c_wg_snr_b_dB = " & real_to_str(c_wg_snr_b_dB, 7, 2) & " [dB]");
......
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