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

Improved and clarified definition of sign of resolution_w in TO_SREAL().

parent 4a0077ff
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
...@@ -1793,12 +1793,13 @@ PACKAGE BODY common_pkg IS ...@@ -1793,12 +1793,13 @@ PACKAGE BODY common_pkg IS
VARIABLE v_real : REAL := TO_SREAL(svec); VARIABLE v_real : REAL := TO_SREAL(svec);
BEGIN BEGIN
-- Then scale to real: -- Then scale to real:
-- . The resolution_w is the number of bits that LSbit 0 in svec is after or before the fixed point. -- . The resolution_w is the number of bits that LSbit 0 in svec(HIGH-1 DOWNTO 0) is after
-- . The real value is then scaled by scaling the integer value by 2**resolution_w: -- (when resolution_w > 0), or before (when resolution_w < 0) the fixed point.
-- . The real value is then scaled by scaling the integer value by 2**(-1 * resolution_w):
-- . resolution_w = 0 : scale by 2**0 = 1, so no scaling and the value is treated as an integer -- . resolution_w = 0 : scale by 2**0 = 1, so no scaling and the value is treated as an integer
-- . resolution_w < 0 : scale up -- . resolution_w < 0 : scale up
-- . resolution_w > 0 : scale down -- . resolution_w > 0 : scale down
RETURN v_real * 2.0**REAL(resolution_w); RETURN v_real * 2.0**REAL(-1 * resolution_w);
END; END;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment