Contents
Up
Previous
Next
Modules
For reasons of readability and re-usability, the modular programming technique
is a common style of design. GM VHDL supports this through the use of
components, packages and design files. This section describes the use
of design files or modules. Design
files are used not only for organization and re-use but also for compilation
speed. They allow a design to be split into several files that
can be later combined into a complete design. This supports organization
by allowing logically related objects to be put together in a file. Re-use
is exploited by using the same design file for different designs by combining
with different files. Finally, compilation speed is better because when a
change is made to a large design, not all the files need to be re-compiled.
If a change was made to a large design in one file then the whole design
would need to be re-compiled.
Each design file in GM VHDL defines a library. The library name is the
base name of the design file. When a design file is compiled, the library
is created with the .o extension. In order to use something from a library
in another design file, the library and use statements are used. The
library statement simply lists the names of the libraries that will be
used by the following design. The use statement specifies what parts of
the library will be used. The library and use statements do not
make the library components available throughout the file, but only to the
following design.
The syntax for the use and library statements is:
library-clause : LIBRARY name-list ";"
use-clause : USE selected-name { "," selected-name } ";"
If the suffix of the selected name in the use clause denotes a declared
object, then that object will be made available. If the suffix of the
selected name is the reserved word ALL, then the prefix should denote a
package or library and everything in that package or library
is made available. For example,
the vector library contains the package named functions
use vector.functions.all;
would make everything in that package available for use. The statement
use vector.functions.to_bit;
would just make the to_bit function available for use. If a library
unit named parts contains any entities and architectures that are used for
components, then
use parts.all;
would make every entity and architecture of the parts library available.
Modules and compatibility