Specifications
VHDL Quick Reference
A-4 VHDL Reference Manual
Subprograms
-- FUNCTION DECLARATION
-- parameters are mode in
-- return statements must return a value
function is_zero (n : integer) return Boolean is
-- type, variable,constant,subprogram declarations
begin
-- sequential statements
if n = 0 then
return true;
else
return false;
end if;
end;
-- PROCEDURE DECLARATION
-- parameters may have mode in , out or inout
procedure count (incr : Boolean; big : out bit;
num : inout integer) is
-- type, variable,constant,subprogram declarations
begin
-- sequential statements
if incr then
num := num +1;
end if;
if num > 101 then
big := '1';
else
big := '0';
end if;
end;