Advanced Topics 209
The types of the parameters can be the same, but the number of
parameters can be different. This is shown by the following example:
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
PACKAGE p_addr_convert IS
FUNCTION convert_addr(a0, a1 : std_logic) return integer;
FUNCTION convert_addr(a0, a1, a2 : std_logic)return
integer;
FUNCTION convert_addr(a0, a1, a2, a3 : std_logic) return
integer;
END p_addr_convert;
PACKAGE BODY p_addr_convert IS
FUNCTION convert_addr(a0, a1 : std_logic) RETURN
INTEGER IS
VARIABLE result : INTEGER := 0;
BEGIN
IF (a0 = ‘ 1 ’) THEN
result := result + 1;
END IF;
IF (a1 = ‘ 1 ’) THEN
result := result + 2;
END IF;
RETURN result;
END convert_addr;
FUNCTION convert_addr(a0, a1, a2 : std_logic) RETURN
INTEGER IS
VARIABLE result : INTEGER := 0;
BEGIN
result := convert_addr(a0, a1);
IF (a2 = ‘ 1 ’) THEN
result := result + 4;
END IF;
RETURN result;
END convert_addr;
FUNCTION convert_addr(a0, a1, a2, a3 : std_logic) RETURN
INTEGER IS
VARIABLE result : INTEGER := 0;
BEGIN
result := convert_addr(a0, a1, a2);
IF (a3 = ‘ 1 ’) THEN