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

Added links to number format documents.

parent 912a6fcb
No related branches found
No related tags found
No related merge requests found
Pipeline #26675 passed
...@@ -387,6 +387,10 @@ PACKAGE common_pkg IS ...@@ -387,6 +387,10 @@ PACKAGE common_pkg IS
FUNCTION func_slv_extract( a_w, b_w, c_w : NATURAL; vec : STD_LOGIC_VECTOR; sel : NATURAL) RETURN STD_LOGIC_VECTOR; FUNCTION func_slv_extract( a_w, b_w, c_w : NATURAL; vec : STD_LOGIC_VECTOR; sel : NATURAL) RETURN STD_LOGIC_VECTOR;
FUNCTION func_slv_extract( a_w, b_w : NATURAL; vec : STD_LOGIC_VECTOR; sel : NATURAL) RETURN STD_LOGIC_VECTOR; FUNCTION func_slv_extract( a_w, b_w : NATURAL; vec : STD_LOGIC_VECTOR; sel : NATURAL) RETURN STD_LOGIC_VECTOR;
-- Number formats, see:
-- . https://support.astron.nl/confluence/display/L2M/L3+SDP+Decision%3A+Definition+of+fixed+point+numbers
-- . https://support.astron.nl/confluence/display/L2M/L4+SDPFW+Decision%3A+Number+representation%2C+resizing+and+rounding
FUNCTION TO_UINT(vec : STD_LOGIC_VECTOR) RETURN NATURAL; -- beware: NATURAL'HIGH = 2**31-1, not 2*32-1, use TO_SINT to avoid warning FUNCTION TO_UINT(vec : STD_LOGIC_VECTOR) RETURN NATURAL; -- beware: NATURAL'HIGH = 2**31-1, not 2*32-1, use TO_SINT to avoid warning
FUNCTION TO_SINT(vec : STD_LOGIC_VECTOR) RETURN INTEGER; FUNCTION TO_SINT(vec : STD_LOGIC_VECTOR) RETURN INTEGER;
...@@ -2073,6 +2077,9 @@ PACKAGE BODY common_pkg IS ...@@ -2073,6 +2077,9 @@ PACKAGE BODY common_pkg IS
RETURN sel_a_b(c_pos, c_real, -c_real); RETURN sel_a_b(c_pos, c_real, -c_real);
END; END;
-- Fixed point format
-- . https://support.astron.nl/confluence/display/L2M/L3+SDP+Decision%3A+Definition+of+fixed+point+numbers
FUNCTION TO_UREAL(uvec : STD_LOGIC_VECTOR; resolution_w : INTEGER) RETURN REAL IS FUNCTION TO_UREAL(uvec : STD_LOGIC_VECTOR; resolution_w : INTEGER) RETURN REAL IS
BEGIN BEGIN
-- First convert as unsigned integer, then scale to real. See TO_SREAL() -- First convert as unsigned integer, then scale to real. See TO_SREAL()
...@@ -2505,7 +2512,8 @@ PACKAGE BODY common_pkg IS ...@@ -2505,7 +2512,8 @@ PACKAGE BODY common_pkg IS
END; END;
------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------
-- Rounding schemes: -- Rounding schemes
-- . https://support.astron.nl/confluence/display/L2M/L4+SDPFW+Decision%3A+Number+representation%2C+resizing+and+rounding
------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------
-- --
-- From https://en.wikipedia.org/wiki/Rounding it follows that there are three main -- From https://en.wikipedia.org/wiki/Rounding it follows that there are three main
......
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