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

Fixed: keep angle in SIN(), COS() within 2pi to avoid: Error: XLOCAL <= 0.0...

Fixed: keep angle in SIN(), COS() within 2pi to avoid: Error: XLOCAL <= 0.0 after reduction in COS(X).
parent 95a1be40
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
...@@ -561,8 +561,9 @@ PACKAGE BODY tb_diag_pkg IS ...@@ -561,8 +561,9 @@ PACKAGE BODY tb_diag_pkg IS
CONSTANT c_omega : REAL := MATH_2_PI * c_sub / c_Nfft; CONSTANT c_omega : REAL := MATH_2_PI * c_sub / c_Nfft;
CONSTANT c_lat : REAL := 1.0 * c_omega; -- the I and Q start when in_val='1', this introduces 1 dp_clk latency, so adjust phase of ref_I and ref_Q to compensate CONSTANT c_lat : REAL := 1.0 * c_omega; -- the I and Q start when in_val='1', this introduces 1 dp_clk latency, so adjust phase of ref_I and ref_Q to compensate
CONSTANT c_k : REAL := REAL(in_cnt); CONSTANT c_k : REAL := REAL(in_cnt);
CONSTANT c_I : REAL := SIN(c_k * c_omega + c_lat); -- I = in phase reference CONSTANT c_angle : REAL := (c_k * c_omega + c_lat) MOD MATH_2_PI; -- keep angle in SIN(), COS() within 2pi to avoid "Error: XLOCAL <= 0.0 after reduction in COS(X)"
CONSTANT c_Q : REAL := COS(c_k * c_omega + c_lat); -- Q = quadrature reference CONSTANT c_I : REAL := SIN(c_angle); -- I = in phase reference
CONSTANT c_Q : REAL := COS(c_angle); -- Q = quadrature reference
CONSTANT c_dat : REAL := REAL(TO_SINT(in_dat)); CONSTANT c_dat : REAL := REAL(TO_SINT(in_dat));
CONSTANT c_phase : REAL := ARCTAN(accum_Q, accum_I + c_eps); CONSTANT c_phase : REAL := ARCTAN(accum_Q, accum_I + c_eps);
CONSTANT c_ampl : REAL := SQRT((ABS(accum_I))**2.0 + (ABS(accum_Q))**2.0) * 2.0 / c_Nsamples; CONSTANT c_ampl : REAL := SQRT((ABS(accum_I))**2.0 + (ABS(accum_Q))**2.0) * 2.0 / c_Nsamples;
...@@ -650,7 +651,8 @@ PACKAGE BODY tb_diag_pkg IS ...@@ -650,7 +651,8 @@ PACKAGE BODY tb_diag_pkg IS
CONSTANT c_lat : REAL := 1.0 * c_omega; -- adjust phase of c_cw to compensate for measurement latency CONSTANT c_lat : REAL := 1.0 * c_omega; -- adjust phase of c_cw to compensate for measurement latency
CONSTANT c_k : REAL := REAL(in_cnt); CONSTANT c_k : REAL := REAL(in_cnt);
CONSTANT c_dat : REAL := REAL(TO_SINT(in_dat)); CONSTANT c_dat : REAL := REAL(TO_SINT(in_dat));
CONSTANT c_cw : REAL := cw_ampl * SIN(c_k * c_omega + cw_phase + c_lat); CONSTANT c_angle : REAL := (c_k * c_omega + cw_phase + c_lat) MOD MATH_2_PI; -- keep angle in SIN(), COS() within 2pi to avoid "Error: XLOCAL <= 0.0 after reduction in COS(X)"
CONSTANT c_cw : REAL := cw_ampl * SIN(c_angle);
CONSTANT c_noise : REAL := c_cw - c_dat; CONSTANT c_noise : REAL := c_cw - c_dat;
CONSTANT c_noise_power : REAL := (ABS(c_noise))**2.0; CONSTANT c_noise_power : REAL := (ABS(c_noise))**2.0;
BEGIN BEGIN
......
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