Contents Up << >>

Component declaration

In order to use a design as a component in another design it must be declared as a component. The component declaration is used to specify the interface of the component. The rule for the component declaration is: The generic clause and port clause specify the interface to the component, which is the same as in the entity declaration.

Let's divert from the subject of declarations momentarily to describe the component specification. The component declaration only describes the interface to the component. In the introduction to the structural model, it was mentioned that, by default, the compiler assumes there are entities declared elsewhere with the same name as the components. The component specification is used to indicate which entity or architecture to use for a component, overriding the default behavior.

The following is the grammar rule for the component specification: Every instantiation of a component must be named. The instantiation list indicates which instantiations this specification applies to. Thus, two different instantiations of the same component can use different entities. If the ALL keyword appears then the specification applies to all instantiations of the named component. If the OTHERS keyword appears, then the specification applies to any instantiation that does not appear in the instantiation list of any other specifications.

The second and third alternatives for the entity aspect are related to configurations and are discussed with the description of configurations. The first alternative of the entity aspect is used to name the entity that implements the component. If the architecture name does not appear in the entity aspect, then the last architecture compiled for that entity is implied. The generic and port map parts describe how the ports and generics of the entity are mapped to the ports and generics of the component. If the port or generic map does not appear, then a default mapping is used, mapping ports and generics of the same name together. Port and generic maps are described more in the concurrent statement section describing block statements.