Contents Up << >>

Compiling Programs

You must first enter your VHDL design with a text editor of your choice. You can run the compiler by typing

vhdl [options] vhdl_file [output_file]

The items in square brackets are optional. Valid options are -87, -L, and -O. Since some features of VHDL'93 are not compatible (see the section on VHDL'93), the -87 option allows you to compile files written in VHDL'87. Only files which use incompatible features of VHDL'87 need to be compiled with this option. The -L option is used to specify the directories you would like the compiler to search when looking for source and object files. The directories should immediately follow the -L with no spaces and be separated by semicolons (ex. -L\gmvhdl\lib;\myvhdl). If you do not specify the -L option, the value of the VHDLPATH environment variable will be used.

The -O option can be used to add the resulting object file to the library file that follows the -O with no spaces (ex. -Owork.lib). This is the equivalent of adding the object file to the named library using vlib (vlib is described in the Modules section of the Learning more chapter.

The file with the name vhdl_file will be compiled into a library (or object) file. If the optional output file name is not present, the compiler will produce an object file with the same name as the VHDL file only with a .o extension. If the output file name is present, the compiler will produce an object file with the name output_file.

If a design file references entities from any other design file (i.e. with the VHDL library statement), they must be compiled before compiling the design that refers to them. If you attempt to compile a design with un-compiled references then the compiler will report an error.

In order to compile a particular entity for execution, you must now use the linker to link your program. You may run the linker as

link [options] output_file library_file entity [architecture]

or

link [options] output_file library_file configuration

Valid options are -87 and -L. If all the files in your project are compiled with the -87 you can use the -87 option with the linker as well. If none or only some of the files are compiled with the -87 option, you should not use this option. The -L option is used to specify the directories you would like the linker to search when looking for object files. The directories should immediately follow the -L with no spaces and be separated by semicolons (ex. -L\gmvhdl\lib;\myvhdl). If you do not specify the -L option, the value of the VHDLPATH environment variable will be used.

The output_file is the name of the executable program that the linker will create. library_name is the name of the library that contains the entity you wish to compile. The entity is the name of the entity you wish to compile. If architecture is included, it should be the name of the architecture to compile for the named entity. If the architecture part is not included, the last architecture compiled for that entity will be used. If you wish to simulate the configuration of a configuration declaration, you may use the second form giving the name of the configuration.

If you re-compile a design file that is referenced in another design file, the design that refers to it must also be re-compiled. If you do not do this, the linker will report an error when you try to link the program.

Now you may execute the program with either of the loaders sv or sve. The next chapter gives details on how to use the two loaders.