Contents
Up
Previous
Next


Packages


The package construct is used to combine commonly used variables, constants, subprograms and others into a group that can be accessed in many places with the library and use statements. The package declaration contains object declarations that may be made visible to entities and architectures with the use and library statements. Each package must also have a package body. It contains objects that are used by the package but can not be used by other entities or architectures. The package body may be empty.

The syntax for the package declaration is

package-declaration-item : subprogram-declaration | subprogram-prototype |
    type-declaration | subtype-declaration | constant-declaration |
    signal-declaration | file-declaration | alias-declaration | 
    component-declaration | attribute-declaration | 
    attribute-specification | disconnection-specification | use-clause
package-declaration-list : { package-declaration-item }
package-declaration : 
    PACKAGE simple-name IS
      package-declaration-list
    END [simple-name] ";"

The syntax for the package body is
package-body-item : subprogram-declaration | subprogram-prototype |
    type-declaration | subtype-declaration | constant-declaration |
    file-declaration | alias-declaration | use-clause
package-body-list : { package-body-item }
package-body :
  PACKAGE BODY simple-name IS
    package-body-list
  END [simple-name] ";"

If the simple name is included after END it must repeat the name of the package.