5.1. Design Units and Libraries

When you write VHDL descriptions, you write them in a design file, then invoke a compiler to analyse them and insert them into a design library. A number of VHDL constructs may be separately analysed for inclusion in a design library. These constructs are called library units. The primary library units are entity declarations, package declarations and configuration declarations (see Section 5.2). The secondary library units are architecture bodies and package bodies. These library units depend on the specification of their interface in a corresponding primary library unit, so the primary unit must be analysed before any corresponding secondary unit.

A design file may contain a number of library units. The structure of a design file can be specified by the syntax:

Libraries are referred to using identifiers called logical names. This name must be translated by the host operating system into an implementation dependent storage name. For example, design libraries may be implemented as database files, and the logical name might be used to determine the database file name. Library units in a given library can be referred to by prefixing their name with the library logical name. So for example, ttl_lib.ttl_10 would refer to the unit ttl_10 in library ttl_lib.

The context clause preceding each library unit specifies which other libraries it references and which packages it uses. The scope of the names made visible by the context clause extends until the end of the design unit.

There are two special libraries which are implicitly available to all design units, and so do not need to be named in a library clause. The first of these is called work, and refers to the working design library into which the current design units will be placed by the analyser. Hence in a design unit, the previously analysed design units in a design file can be referred to using the library name work.

The second special libary is called std, and contains the packages standard and textio. Standard contains all of the predefined types and functions. All of the items in this package are implicitly visible, so no use clause is necessary to access them.