FPGARelated.com
Forums

Altera and VHDL library

Started by Clemens Hermann April 11, 2005
Hi,

with the latest quartus II software I created two VHDL packages. After
testing the packages I wanted to combine them in a custom VHDL library
with no success. My goal is to have a directory that contains the
library (preferrably precompiled) so that I can pass it around and it
could be used by others as simple as the standard VHDL libraries (e.g.
ieee) like

LIBRARY my_lib;
USE my_lib.package1.all;
USE my_lib.package2.all;

without adding each single VHDL file the packages are based on.

Any pointer to information or hints how I could get things up and
running would be a great help.

thanks in advance,

/ch
Recent version of Quartus do not support user defined libraries. The
only way is to add each file to the project separately (you can, of
course, write a small tcl script that automates this task).

Avishay Orpaz.

Clemens Hermann wrote:
> Hi, > > with the latest quartus II software I created two VHDL packages.
After
> testing the packages I wanted to combine them in a custom VHDL
library
> with no success. My goal is to have a directory that contains the > library (preferrably precompiled) so that I can pass it around and it > could be used by others as simple as the standard VHDL libraries
(e.g.
> ieee) like > > LIBRARY my_lib; > USE my_lib.package1.all; > USE my_lib.package2.all; > > without adding each single VHDL file the packages are based on. > > Any pointer to information or hints how I could get things up and > running would be a great help. > > thanks in advance, > > /ch
Hi Clemens,

> with the latest quartus II software I created two VHDL packages. After > testing the packages I wanted to combine them in a custom VHDL library > with no success. My goal is to have a directory that contains the > library (preferrably precompiled)
There is no way Quartus can precompile a package (or a design entity) because it has to elaborate the package everytime it is being used. Thus, you will always have to keep the source code accessible. There's ways to encrypt the source code, but you will have to either use a code obfuscator or become part of Altera's AMPP program in order to encrypt the code in a way that Quartus can understand, but the rest of the world can't.
> so that I can pass it around and it > could be used by others as simple as the standard VHDL libraries
You could use a library directory and add this directory to your project. However, I don't believe the current versions support automatic filename inferencing for packages (i.e. if your package is called my_pkg, it will try to find my_pkg.vhd). Also, the current version always compiles into library "work". As long as there's no namespace conflicts this is quite workable, but not quite what the LRM specifies. I have heard that version 5.0 will support named libraries. Whether 5.0 also does automatic package filename inferencing is unclear to me. Hmmm.... would definitely be a wannahave... Quartus II 5.0 is due out early May, so let's just wait and see. Best regards, Ben Twijnstra Sasco
Ben Twijnstra wrote:

> Also, the current version always compiles into library "work". As long as > there's no namespace conflicts this is quite workable, but not quite what > the LRM specifies. I have heard that version 5.0 will support named > libraries.
You could change the library in the file properties tab with the GUI or with the following TCL command: set_global_assignment VHDL_FILE my_pkg.vhd -l�brary my_lib This works in QuartusII 4.2. The drawback is that a single file could NOT be in two libraries. Regards Frank

Hi Clemens,

 To use a package in multiple projects, the user must explicitly
include the file containing the package in each project separately.
(Quartus II does not auto-discover package files, only entity files.)
The package file must be listed prior to its first use because Quartus
II links VHDL design units during parsing.  In Quartus II 5.1, we'll
remove the requirement that VHDL source files be listed in the correct
order.  That way, users can simply add all their VHDL source files in
any order, and we'll still process the design correctly.


Now, as for VHDL libraries:  Prior to Quartus II 4.2,  all user VHDL
source files were compiled into the WORK library.  In 4.2, we still
compile VHDL source files into WORK by default, but we also added
several mechanisms that allow the user to specify a different
destination library.  These mechanisms are described in the Quartus II
Handbook, Chapter 6:
http://www.altera.com/literature/hb/qts/qts_qii51008.pdf

Hope this helps,

Subroto Datta
Altera Corp.




Clemens Hermann wrote:
> Hi, > > with the latest quartus II software I created two VHDL packages.
After
> testing the packages I wanted to combine them in a custom VHDL
library
> with no success. My goal is to have a directory that contains the > library (preferrably precompiled) so that I can pass it around and it > could be used by others as simple as the standard VHDL libraries
(e.g.
> ieee) like > > LIBRARY my_lib; > USE my_lib.package1.all; > USE my_lib.package2.all; > > without adding each single VHDL file the packages are based on. > > Any pointer to information or hints how I could get things up and > running would be a great help. > > thanks in advance, > > /ch
Hi Subroto,

first thanks to you and all the other people here helping me out!

> Now, as for VHDL libraries: Prior to Quartus II 4.2, all user VHDL > source files were compiled into the WORK library. In 4.2, we still > compile VHDL source files into WORK by default, but we also added > several mechanisms that allow the user to specify a different > destination library. These mechanisms are described in the Quartus II > Handbook, Chapter 6: > http://www.altera.com/literature/hb/qts/qts_qii51008.pdf
o.k., there is stated: <quote> Unlike the MAX+PLUS&#4294967295; II software and earlier versions of the Quartus II software, Quartus II software versions 2.1 and later do not support pre-compiled libraries. </quote> was there a special reason (of course there was :P) to drop this feature? When I write "my_lib" to File -> File Properties -> Library for the packages I want to be part of "my_lib" things work as desired. But the vhdl "library" is not reflected in the file system like new directory or similar. Am I right in the assumption that the library mechanism only allows to group elements in libraries within one single project and not to generate a library that then can be passed around and used in other projects _as Library_? A last question: Is the library name I entered (as described above) as proberty of a VHDL file in any way related to libraries listed in Assignments -> Settings -> User Libraries? Best regards and thanks again, /ch
Hi Clemens,

Here are the replies to your questions.

"Unlike the MAX+PLUS=AE II software and earlier versions of the Quartus
II software, Quartus II software versions 2.1 and later
do not support pre-compiled libraries. Was there a special reason (of
course there was :P) to drop this feature? "

We replaced the original VHDL and Verilog front-end in Quartus with a
solution that couldn't support the pre compiled library feature, buth
otherwise provided us with very robust language support, than what was
present in prior versions of Quartus.

"When I write "my_lib" to File -> File Properties -> Library for the
packages I want to be part of "my_lib" things work as desired. But the
vhdl "library" is not reflected in the file system like new directory
or similar. Am I right in the assumption that the library mechanism
only allows to group elements in libraries within one single project
and not to generate a library that then can be passed around and used
in other projects _as Library_?"

You are correct.  The Library field simply specifies the logical
namespace for the design units in a file.  Quartus does not support
precompiled libraries, where the software would parse the design files
and dump the parse trees into a specific directory, much like Modelsim.
 Instead, Quartus II parses design files on each invocation to
quartus_map.exe; it doesn't store a representation of the parse trees
on disk.

"A last question: Is the library name I entered (as described above) as
proberty of a VHDL file in any way related to libraries listed in
Assignments -> Settings -> User Libraries? "

No, it isn't.  User Libraries are directories in which Quartus II
searches for project source files.  The naming of the feature is a bit
unfortunate and historic.  It should've been named Include
Directories.

Hope this helps,
Subroto Datta
Altera Corp