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

Added atan2(y, x) with atan2(0, 0) = 0.0 without Error message.

parent 017d5ce6
No related branches found
No related tags found
1 merge request!198Clarified reading one WPFB unit into sp_subband_powers_arr2. Updated comments....
...@@ -210,6 +210,8 @@ PACKAGE common_pkg IS ...@@ -210,6 +210,8 @@ PACKAGE common_pkg IS
FUNCTION unpack_complex_im(data : INTEGER; w : NATURAL) RETURN INTEGER; -- pack order: im & re FUNCTION unpack_complex_im(data : INTEGER; w : NATURAL) RETURN INTEGER; -- pack order: im & re
FUNCTION unpack_complex_im(data : STD_LOGIC_VECTOR; w : NATURAL) RETURN INTEGER; -- pack order: im & re FUNCTION unpack_complex_im(data : STD_LOGIC_VECTOR; w : NATURAL) RETURN INTEGER; -- pack order: im & re
FUNCTION atan2(Y, X: REAL) RETURN REAL; -- = ARCTAN(Y, X) but returns 0 when Y = X = 0, without reporting Error: ARCTAN(0.0, 0.0) is undetermined
FUNCTION to_natural_arr(n : t_integer_arr; to_zero : BOOLEAN) RETURN t_natural_arr; -- if to_zero=TRUE then negative numbers are forced to zero, otherwise they will give a compile range error FUNCTION to_natural_arr(n : t_integer_arr; to_zero : BOOLEAN) RETURN t_natural_arr; -- if to_zero=TRUE then negative numbers are forced to zero, otherwise they will give a compile range error
FUNCTION to_natural_arr(n : t_nat_natural_arr) RETURN t_natural_arr; FUNCTION to_natural_arr(n : t_nat_natural_arr) RETURN t_natural_arr;
FUNCTION to_integer_arr(n : t_natural_arr) RETURN t_integer_arr; FUNCTION to_integer_arr(n : t_natural_arr) RETURN t_integer_arr;
...@@ -756,6 +758,14 @@ PACKAGE BODY common_pkg IS ...@@ -756,6 +758,14 @@ PACKAGE BODY common_pkg IS
RETURN TO_SINT(c_complex_slv(c_complex_w-1 DOWNTO w)); -- Im in MS part RETURN TO_SINT(c_complex_slv(c_complex_w-1 DOWNTO w)); -- Im in MS part
END; END;
FUNCTION atan2(Y, X: REAL) RETURN REAL IS
BEGIN
IF Y = 0.0 AND X = 0.0 THEN
RETURN 0.0;
ELSE
RETURN ARCTAN(Y, X);
END IF;
END;
FUNCTION to_natural_arr(n : t_integer_arr; to_zero : BOOLEAN) RETURN t_natural_arr IS FUNCTION to_natural_arr(n : t_integer_arr; to_zero : BOOLEAN) RETURN t_natural_arr IS
VARIABLE vN : t_integer_arr(n'LENGTH-1 DOWNTO 0); VARIABLE vN : t_integer_arr(n'LENGTH-1 DOWNTO 0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment