Table of Contents

Design Components

Overview

Notes

All parts of a VHDL design have to be analysed/compiled before they can be used for simulation or synthesis.

In total, five different so called design units exist: entity/architecture, package/package body and configuration. A file must contain at least one design unit to be accepted by the compiler.

Libraries

Desktop Computer

Setup file:

PROJECT1: /home/user_bill/VHDL_Stuff/project1_lib

Commandline:

compile -library PROJECT1 p_frame_types.vhd

Notes

After compilation, the design units are stored in a so called “library”.

The purpose of the library mechanism is platform independency, i.e. every VHDL tool has to map the logical library name to a physical directory. If the target library is not specified when compiling a VHDL file, the design units are compiled into the default library ’work’.

It is often mapped to the start-up directory of the software per default.

Special setup files or option settings are needed to specify alternatives. In the example above, the logical library name PROJECT1 is mapped to the physical directory “/home/user_bill/VHDL_Stuff/project1_lib” in the setup files for the simulator and synthesis tool.

This library must be named as target when VHDL files are compiled, i.e. the command will look like “compile -library project1 p_frame_types.vhd”.

Within another VHDL file the library PROJECT1 has to be made visible with the LIBRARY statement if elements of the P_FRAME_TYPES package are to be used.

The LIBRARY Statement

library EXAMPLE;
use EXAMPLE.PKG.all;
 
entity A is
. . .
end A;
 
library EXAMPLE;
use EXAMPLE.PKG.all;
 
entity B is
. . .
end B;
 
architecture BEH of A is
. . .
end BEH;
architecture BEH of B is
. . .
end BEH;

Notes

Library statements may only be placed in front of VHDL design units and are valid for the immediately following unit, only.

Secondary design units, however, inherit library declarations that apply to their primary counterparts. Thus, a library clause needs not be repeated in front of an architecture or package body, even when they are placed in separate files (cf. “architecture BEH of B”).

The libraries WORK and STD are visible by default and need not be declared via library statements. Libraries can be used advantageously to separate the object code of different design projects.

The USE Statement

library EXAMPLE;
library OTHER_1;
library OTHER_2;
 
use EXAMPLE.PKG_1.CONST_A,
    EXAMPLE.PKG_1.CONST_B;
 
use EXAMPLE.PKG_2.all;
 
use EXAMPLE.ENTITY_1;
 
architecture BEH of ENTITY_1 is
   use OTHER_1.all;
   signal A : integer;
begin
   A <= OTHER_2.PKG.CONST_A;
end BEH;

Notes

A library statement alone does not give access to the design units and objects contained in this library.

An additional use clause is necessary for this purpose. Most of the rules concerning its location and consequences are equivalent to the library statement and consequently both statements appear conjunctively most of the time.

A use clause makes individual elements of a library visible within a design unit. It is even possible to select specific objects from a package.

Usually, however, the keyword ’all’ is used to make all its declarations available to the user. The keyword ’all’ is also applicable to complete library contents.