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

Added min max measurments.

parent e4524ace
No related branches found
No related tags found
2 merge requests!100Removed text for XSub that is now written in Confluence Subband correlator...,!68Resolve L2SDP-162
...@@ -118,8 +118,12 @@ PACKAGE tb_diag_pkg IS ...@@ -118,8 +118,12 @@ PACKAGE tb_diag_pkg IS
SIGNAL in_dat : IN STD_LOGIC_VECTOR; SIGNAL in_dat : IN STD_LOGIC_VECTOR;
SIGNAL in_start : IN STD_LOGIC; -- start of interval, e.g. sop or sync SIGNAL in_start : IN STD_LOGIC; -- start of interval, e.g. sop or sync
SIGNAL in_val : IN STD_LOGIC; SIGNAL in_val : IN STD_LOGIC;
SIGNAL track_max : INOUT REAL; -- store local tracker in signal
SIGNAL track_min : INOUT REAL; -- store local tracker in signal
SIGNAL accum_mean : INOUT REAL; -- store local accumulator in signal SIGNAL accum_mean : INOUT REAL; -- store local accumulator in signal
SIGNAL accum_power : INOUT REAL; -- store local accumulator in signal SIGNAL accum_power : INOUT REAL; -- store local accumulator in signal
SIGNAL measured_max : OUT REAL; -- maximum sample value
SIGNAL measured_min : OUT REAL; -- minimum sample value
SIGNAL measured_mean : OUT REAL; -- average sample value (DC) SIGNAL measured_mean : OUT REAL; -- average sample value (DC)
SIGNAL measured_power : OUT REAL; -- average sample power SIGNAL measured_power : OUT REAL; -- average sample power
SIGNAL measured_ampl : OUT REAL); -- corresponding sine amplitude SIGNAL measured_ampl : OUT REAL); -- corresponding sine amplitude
...@@ -462,8 +466,12 @@ PACKAGE BODY tb_diag_pkg IS ...@@ -462,8 +466,12 @@ PACKAGE BODY tb_diag_pkg IS
SIGNAL in_dat : IN STD_LOGIC_VECTOR; SIGNAL in_dat : IN STD_LOGIC_VECTOR;
SIGNAL in_start : IN STD_LOGIC; -- start of interval, e.g. sop or sync SIGNAL in_start : IN STD_LOGIC; -- start of interval, e.g. sop or sync
SIGNAL in_val : IN STD_LOGIC; SIGNAL in_val : IN STD_LOGIC;
SIGNAL track_max : INOUT REAL; -- store local tracker in signal
SIGNAL track_min : INOUT REAL; -- store local tracker in signal
SIGNAL accum_mean : INOUT REAL; -- store local accumulator in signal SIGNAL accum_mean : INOUT REAL; -- store local accumulator in signal
SIGNAL accum_power : INOUT REAL; -- store local accumulator in signal SIGNAL accum_power : INOUT REAL; -- store local accumulator in signal
SIGNAL measured_max : OUT REAL; -- maximum sample value
SIGNAL measured_min : OUT REAL; -- minimum sample value
SIGNAL measured_mean : OUT REAL; -- average sample value (DC) SIGNAL measured_mean : OUT REAL; -- average sample value (DC)
SIGNAL measured_power : OUT REAL; -- average sample power SIGNAL measured_power : OUT REAL; -- average sample power
SIGNAL measured_ampl : OUT REAL) IS -- corresponding sine amplitude SIGNAL measured_ampl : OUT REAL) IS -- corresponding sine amplitude
...@@ -475,14 +483,20 @@ PACKAGE BODY tb_diag_pkg IS ...@@ -475,14 +483,20 @@ PACKAGE BODY tb_diag_pkg IS
BEGIN BEGIN
IF rising_edge(dp_clk) THEN IF rising_edge(dp_clk) THEN
IF in_start='1' THEN IF in_start='1' THEN
-- Hold last interval accumulation -- Hold last interval max, min and accumulation
measured_max <= track_max;
measured_min <= track_min;
measured_power <= c_power; measured_power <= c_power;
measured_ampl <= c_ampl; measured_ampl <= c_ampl;
-- Start new interval accumulation -- Start new interval accumulation
track_max <= REAL'LOW;
track_min <= REAL'HIGH;
accum_mean <= c_dat; accum_mean <= c_dat;
accum_power <= (ABS(c_dat))**2.0; -- Must use ABS() with ** of real, because (negative)**2.0 yields error and value 0.0, also must use brackets (ABS()) to avoid compile error accum_power <= (ABS(c_dat))**2.0; -- Must use ABS() with ** of real, because (negative)**2.0 yields error and value 0.0, also must use brackets (ABS()) to avoid compile error
ELSIF in_val='1' THEN ELSIF in_val='1' THEN
-- Accumulate during interval -- Detect and accumulate during interval
track_max <= largest(track_max, c_dat);
track_min <= smallest(track_min, c_dat);
accum_mean <= accum_mean + c_dat; accum_mean <= accum_mean + c_dat;
accum_power <= accum_power + (ABS(c_dat))**2.0; accum_power <= accum_power + (ABS(c_dat))**2.0;
END IF; END IF;
......
...@@ -91,9 +91,9 @@ ENTITY tb_wpfb_unit_dev_wg IS ...@@ -91,9 +91,9 @@ ENTITY tb_wpfb_unit_dev_wg IS
GENERIC ( GENERIC (
g_tb_index : NATURAL := 0; -- use g_tb_index to identify and separate print_str() loggings from multi tb g_tb_index : NATURAL := 0; -- use g_tb_index to identify and separate print_str() loggings from multi tb
-- WG -- WG
g_subband_index_a : REAL := 61.0; -- 0:511 g_subband_index_a : REAL := 61.5; -- 0:511
g_subband_index_b : 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_a : REAL := 0.9; -- 1.0 is full scale
g_amplitude_b : REAL := 0.0; -- 1.0 is full scale g_amplitude_b : REAL := 0.0; -- 1.0 is full scale
g_phase_a : REAL := 0.0; -- 0:360 degrees g_phase_a : REAL := 0.0; -- 0:360 degrees
g_phase_b : REAL := 0.0; -- 0:360 degrees g_phase_b : REAL := 0.0; -- 0:360 degrees
...@@ -284,14 +284,22 @@ ARCHITECTURE tb OF tb_wpfb_unit_dev_wg IS ...@@ -284,14 +284,22 @@ ARCHITECTURE tb OF tb_wpfb_unit_dev_wg IS
-- Input power measurement -- Input power measurement
-- . signal input A -- . signal input A
SIGNAL input_track_max_a : REAL := 0.0; -- track sample max
SIGNAL input_track_min_a : REAL := 0.0; -- track sample min
SIGNAL input_accum_mean_a : REAL := 0.0; -- accumulate sample mean (DC) SIGNAL input_accum_mean_a : REAL := 0.0; -- accumulate sample mean (DC)
SIGNAL input_accum_power_a : REAL := 0.0; -- accumulate sample power SIGNAL input_accum_power_a : REAL := 0.0; -- accumulate sample power
SIGNAL input_max_a : REAL := 0.0; -- measured sample max
SIGNAL input_min_a : REAL := 0.0; -- measured sample min
SIGNAL input_mean_a : REAL := 0.0; -- measured average input sample mean (DC) based on AST SIGNAL input_mean_a : REAL := 0.0; -- measured average input sample mean (DC) based on AST
SIGNAL input_power_a : REAL := 0.0; -- measured average input sample power based on AST SIGNAL input_power_a : REAL := 0.0; -- measured average input sample power based on AST
SIGNAL input_ampl_a : REAL := 0.0; -- measured input amplitude based on AST SIGNAL input_ampl_a : REAL := 0.0; -- measured input amplitude based on AST
-- . signal input B -- . signal input B
SIGNAL input_track_max_b : REAL := 0.0; -- track sample max
SIGNAL input_track_min_b : REAL := 0.0; -- track sample min
SIGNAL input_accum_mean_b : REAL := 0.0; -- accumulate sample mean (DC) SIGNAL input_accum_mean_b : REAL := 0.0; -- accumulate sample mean (DC)
SIGNAL input_accum_power_b : REAL := 0.0; -- accumulate sample power SIGNAL input_accum_power_b : REAL := 0.0; -- accumulate sample power
SIGNAL input_max_b : REAL := 0.0; -- measured sample max
SIGNAL input_min_b : REAL := 0.0; -- measured sample min
SIGNAL input_mean_b : REAL := 0.0; -- measured average input sample mean (DC) based on AST SIGNAL input_mean_b : REAL := 0.0; -- measured average input sample mean (DC) based on AST
SIGNAL input_power_b : REAL := 0.0; -- measured average input sample power based on AST SIGNAL input_power_b : REAL := 0.0; -- measured average input sample power based on AST
SIGNAL input_ampl_b : REAL := 0.0; -- measured input amplitude based on AST SIGNAL input_ampl_b : REAL := 0.0; -- measured input amplitude based on AST
...@@ -331,14 +339,22 @@ ARCHITECTURE tb OF tb_wpfb_unit_dev_wg IS ...@@ -331,14 +339,22 @@ ARCHITECTURE tb OF tb_wpfb_unit_dev_wg IS
-- FIR filter output power measurement -- FIR filter output power measurement
-- . signal input A -- . signal input A
SIGNAL fir_track_max_a : REAL := 0.0; -- track sample max
SIGNAL fir_track_min_a : REAL := 0.0; -- track sample min
SIGNAL fir_accum_mean_a : REAL := 0.0; -- accumulate sample mean (DC) SIGNAL fir_accum_mean_a : REAL := 0.0; -- accumulate sample mean (DC)
SIGNAL fir_accum_power_a : REAL := 0.0; -- accumulate sample power SIGNAL fir_accum_power_a : REAL := 0.0; -- accumulate sample power
SIGNAL fir_max_a : REAL := 0.0; -- measured sample max
SIGNAL fir_min_a : REAL := 0.0; -- measured sample min
SIGNAL fir_mean_a : REAL := 0.0; -- measured average input sample mean (DC) based on AST SIGNAL fir_mean_a : REAL := 0.0; -- measured average input sample mean (DC) based on AST
SIGNAL fir_power_a : REAL := 0.0; -- measured average input sample power based on AST SIGNAL fir_power_a : REAL := 0.0; -- measured average input sample power based on AST
SIGNAL fir_ampl_a : REAL := 0.0; -- measured input amplitude based on AST SIGNAL fir_ampl_a : REAL := 0.0; -- measured input amplitude based on AST
-- . signal input B -- . signal input B
SIGNAL fir_track_max_b : REAL := 0.0; -- track sample max
SIGNAL fir_track_min_b : REAL := 0.0; -- track sample min
SIGNAL fir_accum_mean_b : REAL := 0.0; -- accumulate sample mean (DC) SIGNAL fir_accum_mean_b : REAL := 0.0; -- accumulate sample mean (DC)
SIGNAL fir_accum_power_b : REAL := 0.0; -- accumulate sample power SIGNAL fir_accum_power_b : REAL := 0.0; -- accumulate sample power
SIGNAL fir_max_b : REAL := 0.0; -- measured sample max
SIGNAL fir_min_b : REAL := 0.0; -- measured sample min
SIGNAL fir_mean_b : REAL := 0.0; -- measured average input sample mean (DC) based on AST SIGNAL fir_mean_b : REAL := 0.0; -- measured average input sample mean (DC) based on AST
SIGNAL fir_power_b : REAL := 0.0; -- measured average input sample power based on AST SIGNAL fir_power_b : REAL := 0.0; -- measured average input sample power based on AST
SIGNAL fir_ampl_b : REAL := 0.0; -- measured input amplitude based on AST SIGNAL fir_ampl_b : REAL := 0.0; -- measured input amplitude based on AST
...@@ -690,8 +706,8 @@ BEGIN ...@@ -690,8 +706,8 @@ BEGIN
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- Measure ADC/WG input mean (DC) and power, and determine sine amplitude -- Measure ADC/WG input mean (DC) and power, and determine sine amplitude
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
proc_diag_measure_cw_statistics(c_N_samples, dp_clk, in_sosi.re, in_sosi.sync, in_sosi.valid, input_accum_mean_a, input_accum_power_a, input_mean_a, input_power_a, input_ampl_a); proc_diag_measure_cw_statistics(c_N_samples, dp_clk, in_sosi.re, in_sosi.sync, in_sosi.valid, input_track_max_a, input_track_min_a, input_accum_mean_a, input_accum_power_a, input_max_a, input_min_a, input_mean_a, input_power_a, input_ampl_a);
proc_diag_measure_cw_statistics(c_N_samples, dp_clk, in_sosi.im, in_sosi.sync, in_sosi.valid, input_accum_mean_b, input_accum_power_b, input_mean_b, input_power_b, input_ampl_b); proc_diag_measure_cw_statistics(c_N_samples, dp_clk, in_sosi.im, in_sosi.sync, in_sosi.valid, input_track_max_b, input_track_min_b, input_accum_mean_b, input_accum_power_b, input_max_b, input_min_b, input_mean_b, input_power_b, input_ampl_b);
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- Measure WG amplitude and phase using local I = sin and Q = cos -- Measure WG amplitude and phase using local I = sin and Q = cos
...@@ -713,8 +729,8 @@ BEGIN ...@@ -713,8 +729,8 @@ BEGIN
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- Measure FIR filter output mean (DC) and power, and determine sine amplitude -- Measure FIR filter output mean (DC) and power, and determine sine amplitude
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
proc_diag_measure_cw_statistics(c_N_samples, dp_clk, fil_sosi.re, fil_sosi.sync, fil_sosi.valid, fir_accum_mean_a, fir_accum_power_a, fir_mean_a, fir_power_a, fir_ampl_a); -- use fir_ to distinguish from similar fil_ signal proc_diag_measure_cw_statistics(c_N_samples, dp_clk, fil_sosi.re, fil_sosi.sync, fil_sosi.valid, fir_track_max_a, fir_track_min_a, fir_accum_mean_a, fir_accum_power_a, fir_max_a, fir_min_a, fir_mean_a, fir_power_a, fir_ampl_a); -- use fir_ to distinguish from similar fil_ signal
proc_diag_measure_cw_statistics(c_N_samples, dp_clk, fil_sosi.im, fil_sosi.sync, fil_sosi.valid, fir_accum_mean_b, fir_accum_power_b, fir_mean_b, fir_power_b, fir_ampl_b); -- use fir_ to distinguish from similar fil_ signal proc_diag_measure_cw_statistics(c_N_samples, dp_clk, fil_sosi.im, fil_sosi.sync, fil_sosi.valid, fir_track_max_b, fir_track_min_b, fir_accum_mean_b, fir_accum_power_b, fir_max_b, fir_min_b, fir_mean_b, fir_power_b, fir_ampl_b); -- use fir_ to distinguish from similar fil_ signal
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- Measure FIR filter output amplitude and phase using local I = sin and Q = cos -- Measure FIR filter output amplitude and phase using local I = sin and Q = cos
...@@ -862,16 +878,20 @@ BEGIN ...@@ -862,16 +878,20 @@ BEGIN
print_str(". g_amplitude_a = " & real_to_str(g_amplitude_a, 5, 3)); print_str(". g_amplitude_a = " & real_to_str(g_amplitude_a, 5, 3));
print_str(". g_phase_a = " & real_to_str(g_phase_a, 6, 1) & " degrees"); print_str(". g_phase_a = " & real_to_str(g_phase_a, 6, 1) & " degrees");
print_str(""); print_str("");
print_str("DC levels"); print_str("DC, min, max levels");
print_str(". input_min_a = " & real_to_str(input_min_a, 10, 3));
print_str(". input_max_a = " & real_to_str(input_max_a, 10, 3));
print_str(". input_mean_a = " & real_to_str(input_mean_a, 10, 3)); print_str(". input_mean_a = " & real_to_str(input_mean_a, 10, 3));
print_str(". fir_min_a = " & real_to_str(fir_min_a, 10, 3));
print_str(". fir_max_a = " & real_to_str(fir_max_a, 10, 3));
print_str(". fir_mean_a = " & real_to_str(fir_mean_a, 10, 3)); print_str(". fir_mean_a = " & real_to_str(fir_mean_a, 10, 3));
print_str(""); print_str("");
print_str("Amplitudes:"); print_str("Amplitudes:");
print_str(". c_wg_ampl_a = " & int_to_str(NATURAL(c_wg_ampl_a))); print_str(". c_wg_ampl_a = " & int_to_str(NATURAL(c_wg_ampl_a)));
print_str(". input_ampl_a = " & real_to_str(input_ampl_a, 10, 3)); print_str(". input_ampl_a = " & real_to_str(input_ampl_a, 10, 3));
print_str(". cw_ampl_a = " & real_to_str(cw_ampl_a, 10, 3)); print_str(". cw_ampl_a = " & real_to_str(cw_ampl_a, 10, 3));
print_str(". fir_ampl_a = " & real_to_str(fir_ampl_a, 10, 3));
IF NOT c_bin_a_frac_en THEN IF NOT c_bin_a_frac_en THEN
print_str(". fir_ampl_a = " & real_to_str(fir_ampl_a, 10, 3));
print_str(". fil_ampl_a = " & real_to_str(fil_ampl_a, 10, 3)); print_str(". fil_ampl_a = " & real_to_str(fil_ampl_a, 10, 3));
END IF; END IF;
print_str(". sub_a_re = " & int_to_str(sub_a_re)); print_str(". sub_a_re = " & int_to_str(sub_a_re));
...@@ -887,7 +907,9 @@ BEGIN ...@@ -887,7 +907,9 @@ BEGIN
print_str("SNR and WPFB processing gain:"); 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]"); print_str(". c_wg_snr_a_dB = " & real_to_str(c_wg_snr_a_dB, 7, 2) & " [dB]");
print_str(". wg_measured_snr_a_dB = " & real_to_str(wg_measured_snr_a_dB, 7, 2) & " [dB]"); print_str(". wg_measured_snr_a_dB = " & real_to_str(wg_measured_snr_a_dB, 7, 2) & " [dB]");
IF NOT c_bin_a_frac_en THEN
print_str(". fil_measured_snr_a_dB = " & real_to_str(fil_measured_snr_a_dB, 7, 2) & " [dB]"); print_str(". fil_measured_snr_a_dB = " & real_to_str(fil_measured_snr_a_dB, 7, 2) & " [dB]");
END IF;
print_str(". sst_measured_snr_a_dB = " & real_to_str(sst_measured_snr_a_dB, 7, 2) & " [dB]"); print_str(". sst_measured_snr_a_dB = " & real_to_str(sst_measured_snr_a_dB, 7, 2) & " [dB]");
print_str(". wpfb_measured_proc_gain_a_dB = " & real_to_str(wpfb_measured_proc_gain_a_dB, 7, 2) & " [dB]"); print_str(". wpfb_measured_proc_gain_a_dB = " & real_to_str(wpfb_measured_proc_gain_a_dB, 7, 2) & " [dB]");
print_str(""); print_str("");
...@@ -897,16 +919,20 @@ BEGIN ...@@ -897,16 +919,20 @@ BEGIN
print_str(". g_amplitude_b = " & real_to_str(g_amplitude_b, 5, 3)); print_str(". g_amplitude_b = " & real_to_str(g_amplitude_b, 5, 3));
print_str(". g_phase_b = " & real_to_str(g_phase_b, 6, 1) & " degrees"); print_str(". g_phase_b = " & real_to_str(g_phase_b, 6, 1) & " degrees");
print_str(""); print_str("");
print_str("DC levels"); print_str("DC, min, max levels");
print_str(". input_min_b = " & real_to_str(input_min_b, 10, 3));
print_str(". input_max_b = " & real_to_str(input_max_b, 10, 3));
print_str(". input_mean_b = " & real_to_str(input_mean_b, 10, 3)); print_str(". input_mean_b = " & real_to_str(input_mean_b, 10, 3));
print_str(". fir_min_b = " & real_to_str(fir_min_b, 10, 3));
print_str(". fir_max_b = " & real_to_str(fir_max_b, 10, 3));
print_str(". fir_mean_b = " & real_to_str(fir_mean_b, 10, 3)); print_str(". fir_mean_b = " & real_to_str(fir_mean_b, 10, 3));
print_str(""); print_str("");
print_str("Amplitudes:"); print_str("Amplitudes:");
print_str(". c_wg_ampl_b = " & int_to_str(NATURAL(c_wg_ampl_b))); print_str(". c_wg_ampl_b = " & int_to_str(NATURAL(c_wg_ampl_b)));
print_str(". input_ampl_b = " & real_to_str(input_ampl_b, 10, 3)); print_str(". input_ampl_b = " & real_to_str(input_ampl_b, 10, 3));
print_str(". cw_ampl_b = " & real_to_str(cw_ampl_b, 10, 3)); print_str(". cw_ampl_b = " & real_to_str(cw_ampl_b, 10, 3));
print_str(". fir_ampl_b = " & real_to_str(fir_ampl_b, 10, 3));
IF NOT c_bin_b_frac_en THEN IF NOT c_bin_b_frac_en THEN
print_str(". fir_ampl_b = " & real_to_str(fir_ampl_b, 10, 3));
print_str(". fil_ampl_b = " & real_to_str(fil_ampl_b, 10, 3)); print_str(". fil_ampl_b = " & real_to_str(fil_ampl_b, 10, 3));
END IF; END IF;
print_str(". sub_b_re = " & int_to_str(sub_b_re)); print_str(". sub_b_re = " & int_to_str(sub_b_re));
...@@ -922,7 +948,9 @@ BEGIN ...@@ -922,7 +948,9 @@ BEGIN
print_str("SNR and WPFB processing gain:"); 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]"); print_str(". c_wg_snr_b_dB = " & real_to_str(c_wg_snr_b_dB, 7, 2) & " [dB]");
print_str(". wg_measured_snr_b_dB = " & real_to_str(wg_measured_snr_b_dB, 7, 2) & " [dB]"); print_str(". wg_measured_snr_b_dB = " & real_to_str(wg_measured_snr_b_dB, 7, 2) & " [dB]");
IF NOT c_bin_b_frac_en THEN
print_str(". fil_measured_snr_b_dB = " & real_to_str(fil_measured_snr_b_dB, 7, 2) & " [dB]"); print_str(". fil_measured_snr_b_dB = " & real_to_str(fil_measured_snr_b_dB, 7, 2) & " [dB]");
END IF;
print_str(". sst_measured_snr_b_dB = " & real_to_str(sst_measured_snr_b_dB, 7, 2) & " [dB]"); print_str(". sst_measured_snr_b_dB = " & real_to_str(sst_measured_snr_b_dB, 7, 2) & " [dB]");
print_str(". wpfb_measured_proc_gain_b_dB = " & real_to_str(wpfb_measured_proc_gain_b_dB, 7, 2) & " [dB]"); print_str(". wpfb_measured_proc_gain_b_dB = " & real_to_str(wpfb_measured_proc_gain_b_dB, 7, 2) & " [dB]");
print_str(""); print_str("");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment