This package contains miscellaneous useful functions.
function xor3
(a, b, c : std_ulogic)
return std_ulogic;
function maj23
(a, b, c : std_ulogic)
return std_ulogic;
provide the sum and carry outputs of a full adder with inputs a, b and c.
The result type is std_ulogic.
function xor3
(a, b, c : std_ulogic_vector)
return std_ulogic_vector;
function maj23
(a, b, c : std_ulogic_vector)
return std_ulogic_vector;
A carry-save adder (CSA) is a row of full adders. It can be used in dividers or array multipliers, for example.
The result type is std_ulogic_vector(A'length-1 downto 0).
function ilog
(a : positive;
n : positive := 2)
return natural;
calculates the (integer) logarithm of a, with a base of n. Mathematically, the result is ceil(logn(a)). Examples:
ilog(1) => 0
ilog(2) => 1
ilog(3) => 2
ilog(4) => 2
ilog(5) => 3
ilog(16, 4) => 2
Note: This function is not meant for real designs but for testbenches. It calculates the minimum number of bits needed to enumerate a different states.