Parameter Types
Subprograms operate on values or objects that are passed in as parameters to the subprogram. Procedures differ from functions in that they can also pass information out on the parameter list. (The parameters of a procedure have directions, or modes.)
There are three classes of parameters available for subprograms: constant, variable and signal. The default class, if no other class is specified, is constant. The parameters that are used within the function or procedure are called the formal parameters, while the parameters passed into the function or procedure are called the actual parameters.
The primary difference between constant, variable and signal parameters is the type of actual parameters that can be passed into the subprogram when it is called. If the formal parameter of a subprogram is of class constant, the actual parameter can be any expression that evaluates to a data type matching that of the formal parameter. For parameters of class variable or signal, the actual parameters must be variable or signal objects, respectively.
Parameters of subprograms transfer only the value of the actual parameters (those parameters specified when the subprogram is called) for the formal parameters (the parameters specified in the subprogram declaration). Attribute information is not passed directly into the subprogram. (The attributes that you will most often be concerned with, such as 'event, will be available if you are using parameters of class signal.)