diff --git a/libraries/base/common/src/vhdl/common_pkg.vhd b/libraries/base/common/src/vhdl/common_pkg.vhd index f26318f9307ab924d5422850505eaa1d75d965f1..79591b0b305fbab6107ee2acb05afe6e709a73ef 100644 --- a/libraries/base/common/src/vhdl/common_pkg.vhd +++ b/libraries/base/common/src/vhdl/common_pkg.vhd @@ -1793,12 +1793,13 @@ PACKAGE BODY common_pkg IS VARIABLE v_real : REAL := TO_SREAL(svec); BEGIN -- 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 real value is then scaled by scaling the integer value by 2**resolution_w: + -- . The resolution_w is the number of bits that LSbit 0 in svec(HIGH-1 DOWNTO 0) is after + -- (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 up -- . resolution_w > 0 : scale down - RETURN v_real * 2.0**REAL(resolution_w); + RETURN v_real * 2.0**REAL(-1 * resolution_w); END;