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

libraries and packages

Altera_Forum
Honored Contributor II
1,626 Views

The background: I need to define my own type that I would like to use in entity's port. It looks like there is no other way to make this type public other than define it in package. 

 

The code is 

 

-- mvb_lib.vhd -- 

 

package mvb_lib is 

type bit_cell is ('0','1',nl,nh); 

end mvb_lib  

 

If in my top object i declare 

 

library mvb_lib 

use mvb_lib.all 

 

the compiler does not comply but when I use bit_cell it terminates with error object "bit_cell" used but not declared. 

 

I found out, that I can use 

use work.mvb_lib.all 

in my file and in the properties of the file fill in "mvb_lib" into the library entry. 

 

But this is a little bit strange for me. Is there other "clean" way of using packages in projects?
0 Kudos
7 Replies
Altera_Forum
Honored Contributor II
620 Views

Hi, 

 

The first notes you mentioned should work i.e 

 

-- mvb_lib.vhd -- 

 

package mvb_lib is 

type bit_cell is ('0','1',NL,NH); 

end mvb_lib  

 

If in my top object i declare 

 

library mvb_lib 

use mvb_lib.all 

 

 

Did you make sure that you compiled the Package first before referencing it?
0 Kudos
Altera_Forum
Honored Contributor II
620 Views

Did you mean to have this file in the file list before other vhd files that use the library? Or do I need to make new project just to compile the library?

0 Kudos
Altera_Forum
Honored Contributor II
620 Views

Hi, 

 

you must have the files in the list before you can reference them. If you are still having problems, then send me the files of relevance and I will make a script for you and make the necessary changes. 

 

Thanks
0 Kudos
Altera_Forum
Honored Contributor II
620 Views

That would be nice from you!!

0 Kudos
Altera_Forum
Honored Contributor II
620 Views

I am sending you back a zip file called mvb_lib_project.zip. 

 

Extract this file and run the script "compile.do" in the  

 

Tools-> TCL-> Run Macro option in Modelsim. 

 

you will see that there are two unbound components 

 

data_pe : entity work.edp 

port map ( 

a => data_in, 

q => data_r, 

clr => reset, 

clk => clk 

); 

 

------------------------------------------------------------------------------- 

-- Positive edge detector for data_in 

------------------------------------------------------------------------------- 

data_ne : entity work.edn 

port map ( 

a => data_in, 

q => data_f, 

clr => reset, 

clk => clk 

); 

 

but this is because you have not provided me the edn and edp files. 

 

If you add this to the compile.do script but BEFORE the top level file, your project will compile. 

 

Hope this helps
0 Kudos
Altera_Forum
Honored Contributor II
620 Views

Thanx! 

 

In my Quartus II 7.2 I found only menu item Tools/TclScripts which opens window with a list of 2 tcl scripts that are in /quartus/common/tcl/apps/gui directory. There is no button nor input field where I can input the script you send me. 

 

Do I require also the other files beside the compile.do, which are in the directories or are these files generated by the compiler?
0 Kudos
Altera_Forum
Honored Contributor II
620 Views

Hi, 

 

Sorry for the delay in my reply. 

 

I was under the impression you were just using modelsim and not Quartus. 

 

Anyway I have rebuilt your files, re-naming them and giving the design more structure, so it is cleaner. 

 

the following zip file allows you to 

 

1) Compile the design in Modelsim 

2) Compile the design in Quartus II 

 

When you extract the zip file it will be evident on how to compile in either one of the tools 

 

Hope this helps
0 Kudos
Reply