diff --git a/libraries/base/common/src/vhdl/common_pkg.vhd b/libraries/base/common/src/vhdl/common_pkg.vhd index 58e8b511359f7c00e7788c636eff2713d2edf18c..17bf94944d10e3fdea42e92135fdc73afd07ef0b 100644 --- a/libraries/base/common/src/vhdl/common_pkg.vhd +++ b/libraries/base/common/src/vhdl/common_pkg.vhd @@ -199,6 +199,8 @@ PACKAGE common_pkg IS FUNCTION to_bool(n: IN STD_LOGIC) RETURN BOOLEAN; -- if '1' or 'H' then return TRUE else FALSE FUNCTION to_bool(n: IN INTEGER) RETURN BOOLEAN; -- if 0 then return FALSE else TRUE + FUNCTION not_int(n: IN INTEGER) RETURN INTEGER; -- if 0 then return 1 else 0 + 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_integer_arr(n : t_natural_arr) RETURN t_integer_arr; @@ -704,6 +706,10 @@ PACKAGE BODY common_pkg IS RETURN NOT (n = 0); END; + FUNCTION not_int(n : INTEGER) RETURN INTEGER IS + BEGIN + RETURN sel_a_b(n = 0, 1, 0); + END; 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);