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

Added array_init() for boolean array.

parent bba69ae6
Branches
No related tags found
2 merge requests!28Master,!15Resolve L2SDP-27
...@@ -299,6 +299,7 @@ PACKAGE common_pkg IS ...@@ -299,6 +299,7 @@ PACKAGE common_pkg IS
FUNCTION sel_n(sel : NATURAL; a, b, c, d, e, f, g, h, i, j : STRING) RETURN STRING; -- 10 FUNCTION sel_n(sel : NATURAL; a, b, c, d, e, f, g, h, i, j : STRING) RETURN STRING; -- 10
FUNCTION array_init(init : STD_LOGIC; nof : NATURAL) RETURN STD_LOGIC_VECTOR; -- useful to init a unconstrained array of size 1 FUNCTION array_init(init : STD_LOGIC; nof : NATURAL) RETURN STD_LOGIC_VECTOR; -- useful to init a unconstrained array of size 1
FUNCTION array_init(init : BOOLEAN; nof : NATURAL) RETURN t_nat_boolean_arr; -- useful to init a unconstrained array of size 1
FUNCTION array_init(init, nof : NATURAL) RETURN t_natural_arr; -- useful to init a unconstrained array of size 1 FUNCTION array_init(init, nof : NATURAL) RETURN t_natural_arr; -- useful to init a unconstrained array of size 1
FUNCTION array_init(init, nof : NATURAL) RETURN t_nat_natural_arr; -- useful to init a unconstrained array of size 1 FUNCTION array_init(init, nof : NATURAL) RETURN t_nat_natural_arr; -- useful to init a unconstrained array of size 1
FUNCTION array_init(init, nof, incr : NATURAL) RETURN t_natural_arr; -- useful to init an array with incrementing numbers FUNCTION array_init(init, nof, incr : NATURAL) RETURN t_natural_arr; -- useful to init an array with incrementing numbers
...@@ -1342,6 +1343,15 @@ PACKAGE BODY common_pkg IS ...@@ -1342,6 +1343,15 @@ PACKAGE BODY common_pkg IS
RETURN v_arr; RETURN v_arr;
END; END;
FUNCTION array_init(init : BOOLEAN; nof : NATURAL) RETURN t_nat_boolean_arr IS
VARIABLE v_arr : t_nat_boolean_arr(0 TO nof-1);
BEGIN
FOR I IN v_arr'RANGE LOOP
v_arr(I) := init;
END LOOP;
RETURN v_arr;
END;
FUNCTION array_init(init, nof : NATURAL) RETURN t_natural_arr IS FUNCTION array_init(init, nof : NATURAL) RETURN t_natural_arr IS
VARIABLE v_arr : t_natural_arr(0 TO nof-1); VARIABLE v_arr : t_natural_arr(0 TO nof-1);
BEGIN BEGIN
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment