Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16619 Discussions

Quartus issues picking up VHDL package files in libraries

Altera_Forum
Honored Contributor II
4,855 Views

Calling all passengers... 

 

Just wondering if anyone knows what the skinny is with quartus not picking up VHDL package files in library folders in quartus? It seems to pick up all other VHDL files from other folders. 

 

If I specify them in the file list then it works fine but not when specified as part of a library folder. It's wierd and I've tried a couple of things to get it to work without avail. 

 

Ahh you say but why the big deal, Just specify it in the files list. That is okay for a small design case but when building a large design that shares common source/libraries the file list would suddenly become longer than well.... "Up the railtrack from Miami to Canada". 

 

Anyway let me know if anyone has seen similar issues with this or am I just drinking the overfermented beer from the buffet cart? 

 

Cheers, 

The Flying Scotsman 4472
0 Kudos
11 Replies
Altera_Forum
Honored Contributor II
2,996 Views

The User Library inside of Quartus is very different than the VHDL definition of a library(which makes sense, since Quartus's Library settings are used in Verilog designs, schematic, etc.) 

 

Anyway, a Quartus User Library is a pointer to look for missing files. But note that Quartus will only open source files that match the name of the entity/module being looked for. For example, let's say you have an HDL file that instantiates something called ingress. First Quartus will look for any entity/moduels named ingress in the files you've specifically added. If not, it will look in the project directory, followed by the User Library directories, for a design file called ingress. This would include ingress.vhd, ingress.v, ingress.bdf, invgress.vhdl, ingress.tdf, ingress.vqm, ingress.edif, etc. 

 

Note that Quartus does not read in all the files within a project directory or User Library. So if the name of your file is my_ingress.vhd, this will not match ingress and will not be read in. You will specifically have to add the file. This is especially common with packages, as the entities/constants they call out won't match the file name. 

 

It is generally recommended to specifically add files rather than rely on User Libraries(although many people successfully do User Libraries). This way Quartus does not read in a file you do not explicitly specify. And if it read in all the files in a User Library directory, then there would often be problems. Designers often have multiple copies of a design for testing, simulation, etc., which would now compete with each other for a definition. 

 

Lastly, VHDL libraries are a different beast altogether. When explicitly adding VHDL files, there is a Properties box on the right which can be used to specify which VHDL library a file is compiled into. (I've never been a fan of this in VHDL, in that the library construct occurs outside of the language and is done differently for every tool)
0 Kudos
Altera_Forum
Honored Contributor II
2,996 Views

And just a quick reminder that you can use relative pathnames for the files you add, to make life easier if you move the design to a new directory/computer/whatever.

0 Kudos
Altera_Forum
Honored Contributor II
2,996 Views

Editing your qsf file has the same effects of clicking Assignment editor. 

BTW, use tcl instead of qsf. Tcl can be generated by quartus and executed by quartus too. 

Qsf can be easily modified when you edit the Assignment editor. Tcl can have different name from your project name. This will be conveniont if you have different settings for the same project.
0 Kudos
Altera_Forum
Honored Contributor II
2,996 Views

No TheFlyingScotsman, you did not drink that formented Beer you've mentioned. I have the exact same problem, except I cannot even execute my library files from the file folder. Below is my thread..  

 

http://www.alteraforum.com/forum/showthread.php?p=1729#post1729
0 Kudos
Altera_Forum
Honored Contributor II
2,996 Views

Hi, 

 

I had the same problem and finally today I solved the problem, at least mine hoping it would help you to solve yours since you seem to have the same problem I've had. 

 

I realized that if I had a Package definition, then this package had to be included in the Top Level VHD File using a USE clause. It seem that Package is not read, neither compiled if you just include it in the user file area (Assignment\Setting\File name). Let's say we have 3 VHD files named main.vhd, parts_lib.vhd and comp_PKG.vhd, where : 

 

parts_lib.vhd and comp_PKG.vhd are to be included in a library folder, then in you top level file you should have this : 

 

library ieee; 

use ieee.std_logic_1164.all; 

library comp_PKG; 

use comp_PKG.comp_PKG.all; --> Providing the package name carries the same name as 

the folder it's compiled in. 

 

As you can see, I did not include a parts_lib use clause here. Instead, I've included it in the user file folder (Assignment\Setting\File name). It did compile correctly that way.  

 

However, it seems that including library Files in the Project User Library (Assignment\Settings\Library name) does nothing; all .VHD files had to be included in the Project User File (Assignment\Settings\File name). 

Hope it will help...
0 Kudos
Altera_Forum
Honored Contributor II
2,996 Views

Your answer is very helpful, thank you. But I have another problem:when I want to write test bench in Quartus II, how can I write the configuration part?

0 Kudos
Altera_Forum
Honored Contributor II
2,996 Views

Hi everyone, here is my understanding of how the library files are best used (from much experimentation): 

 

 

First off, this is what works for me: 

 

I have re-usable design entities in a library folder. Most of these have multiple architectures. In this folder of .vhd files I have a single .vhd which declares a package, eg. my_pkg. This package has a component declaration for each .vhd file in the directory.  

 

All of the .vhd files use the "- synthesis library my_lib" directive for keeping them in a unique namespace.  

 

So, in my project, the only file i need to include is the package file.  

 

If i use any of the components declared in the package file i must add to the file in my project where the components are used/ mapped: 

 

library my_lib; 

use my_lib.my_pkg.all; 

 

you will get warnings from quartus that it is using design units not in the project but this is fine.  

 

For some reason Quartus will only infer design entities for component declarations, either using my indirect package method, or a component declaration directly in your project files.  

 

I tried direct instantiation, by specifying the library as follows: 

 

my_device: entity my_lib.my_entityname( anArchitecture ) etc. 

 

which in theory should work but does not. Quartus does not bother to look in the additional directories to infer the design unit from the file names of the same name. 

 

I have a feeling that it is down to the compiler not having compiled the components into their specified vhdl libraries (using their synthesis directives) before the components are used in my project. Somehow it does do this when the components are explicitly declared before instantiation. 

 

;) 

 

[bitwiselannon]
0 Kudos
Altera_Forum
Honored Contributor II
2,996 Views

I think I have a simple way of explaining some of these things... 

 

Quartus II has a very simple auto-discovery algorithm for basic project setups. When searching for entity foo, it looks for foo.<hdl extension> in the project directory or in the directories defined by Settings -> Libraries. I think a better label for this menu item would be "Search Paths for Auto-Discovered Entities". Quartus II does not auto-find package, architecture, or any other type of file. You need to add those files to your Quartus II project explicitly.
0 Kudos
Altera_Forum
Honored Contributor II
2,996 Views

 

--- Quote Start ---  

I think I have a simple way of explaining some of these things... 

 

Quartus II has a very simple auto-discovery algorithm for basic project setups. When searching for entity foo, it looks for foo.<hdl extension> in the project directory or in the directories defined by Settings -> Libraries. I think a better label for this menu item would be "Search Paths for Auto-Discovered Entities". Quartus II does not auto-find package, architecture, or any other type of file. You need to add those files to your Quartus II project explicitly. 

--- Quote End ---  

 

 

I have found exactly the same, meaning that it has, for me, just ignored library names in VHDL and just assumed everything is the work library, regardless of name. The auto discovery is useful, as I have been able to instantiate AHDL entities from VHDL and vice versa (legacy project with modern fixes, not the way I would recommend.).
0 Kudos
Altera_Forum
Honored Contributor II
2,996 Views

 

--- Quote Start ---  

When searching for entity foo, it looks for foo.<hdl extension> in the project directory or in the directories defined by Settings -> Libraries. 

--- Quote End ---  

I'm afraid this doesn't seem to be the case. By the above explanation (which seems to be how it's meant to work), the direct instantiation of a component specifying entity, library and architecture (i use the --synthesis library my_lib directive in the same file as the entity declaration) - for example: 

MY_COMPONENT: entity my_lib.my_entityname(my_arch) port map( etc. should cause the Quartus compiler to search the user specified directories for the specified entity (assuming the .vhd file containing the entity declaration has not been added to the project). 

 

In reality you get a compile error that the entity 'my_entity' is used but not declared, or not in the current library. 

 

Ultimately I only managed to get quartus to look in my specified directory by declaring the component in a package file (that was included in the project) and using instances of the declared component.  

 

But for an entity with multiple architectures, I need to specify a configuration which will produce almost the same problems unless the actual entity.vhd file is included in the project, making the ability to specify additional directories in Quartus redundant.  

 

Try referring to an entity in a .vhd file not in the project but in a directory added to the project or global library list. If you can get Quartus to compile can somebody let me know how they are instantiating those components?
0 Kudos
Altera_Forum
Honored Contributor II
2,996 Views

The auto-discover for fles is very basic; I think they basically want you to add all files to the QSF with the Add Files option or Tcl... Looks like the docs could be more clear on this point. 

 

When you have a direct entity instantiation, you must add the instantiated entity to the project source file list. It supports auto-discovery only when you instantiate indirectly using a component.  

 

But the libraries can still help you manage multiple versions of files or files with same name etc... The software will look in an explicit library namespace first before searching the default library "work". For example, if you refer to mylib.mypkg, Quartus II will look in mylib for a primary design unit called mypkg. If mylib doesn't exist or doesn't contain mypkg, Quartus II will look for mypkg in the library "work". There is some discussion about how libraries can help in the QII handbook: http://www.altera.com/literature/hb/qts/qts_qii51008.pdf, page 12.
0 Kudos
Reply