From 8901c8e985d5bc9ea418de07505e1f667623b4a2 Mon Sep 17 00:00:00 2001 From: Eric Kooistra <kooistra@astron.nl> Date: Tue, 23 Mar 2021 17:38:48 +0100 Subject: [PATCH] Clarified WG valid amplitude clipping range in relation to c_diag_wg_gain_w. --- libraries/base/diag/src/vhdl/diag_pkg.vhd | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/base/diag/src/vhdl/diag_pkg.vhd b/libraries/base/diag/src/vhdl/diag_pkg.vhd index 3fcfd25e7a..7e86c09706 100644 --- a/libraries/base/diag/src/vhdl/diag_pkg.vhd +++ b/libraries/base/diag/src/vhdl/diag_pkg.vhd @@ -81,6 +81,9 @@ PACKAGE diag_pkg IS CONSTANT c_diag_wg_gain_w : NATURAL := 1; -- Normalized range [0 1> maps to fixed point range [0:2**c_diag_wg_ampl_w> -- . use gain 2**0 = 1 to have fulle scale without clipping -- . use gain 2**g_calc_gain_w > 1 to cause clipping + -- For c_diag_wg_gain_w = 1 there is clipping from [1 2> For normalized values >= 2**c_diag_wg_gain_w = 2 + -- the behaviour becomes more or less undefined. Due to wrapping it appears that normalized values [2 3> + -- result in a sinus again. Therefore use normalized range [0 2**c_diag_wg_gain_w>. CONSTANT c_diag_wg_ampl_unit : REAL := 2**REAL(c_diag_wg_ampl_w-c_diag_wg_gain_w)*c_diag_wg_ampl_norm; -- ^= Full Scale range [-c_wg_full_scale +c_wg_full_scale] without clipping CONSTANT c_diag_wg_freq_unit : REAL := 2**REAL(c_diag_wg_freq_w); -- ^= c_clk_freq = Fs (sample frequency), assuming one sinus waveform in the buffer CONSTANT c_diag_wg_phase_unit : REAL := 2**REAL(c_diag_wg_phase_w)/ 360.0; -- ^= 1 degree -- GitLab