Altera_Forum
Honored Contributor
17 years agoVHDL User Library
Hello :
I am in the process of migrating my designs from schematic to VHDL, and have hit a snag with creating a company library of components. I would greatly appreciate any help. I have a number of components that I want to be available for all my projects. As an example, UnsignedDivide implemented in UnsignedDivide.vhd with an entity of ENTITY UnsignedDivide IS GENERIC ( NW : POSITIVE := 32 ; -- Numerator Width DW : POSITIVE := 16 ; -- Denominator Width QW : POSITIVE := 16 ); -- Quotient Width PORT (Clk : IN STD_LOGIC ; Start : IN STD_LOGIC ; Num : IN UNSIGNED (NW-1 DOWNTO 0) ; Den : IN UNSIGNED (DW-1 DOWNTO 0) ; Done : OUT STD_LOGIC ; Quo : OUT UNSIGNED (QW-1 DOWNTO 0) ); END ENTITY UnsignedDivide ; If I include this file in my project, I can directly instantiate multiple dividers and they all work fine. But I want to put all such files in a library and not have to include them in each project source. This was easy in schematic designs - just add a directory as a library that contained all the BSF, BDF and megawizard generated VHD files and they could just be added to any BDF in my project. i.e. the library was purely source. So I need to use a package I think. So, I created MyCompanyLibrary.vhd that contains : PACKAGE MyCompanyLibrary IS COMPONENT UnsignedDivide IS GENERIC ( NW : POSITIVE := 32 ; -- Numerator Width DW : POSITIVE := 16 ; -- Denominator Width QW : POSITIVE := 16 ); -- Quotient Width PORT (Clk : IN STD_LOGIC ; Start : IN STD_LOGIC ; Num : IN UNSIGNED (NW-1 DOWNTO 0) ; Den : IN UNSIGNED (DW-1 DOWNTO 0) ; Done : OUT STD_LOGIC ; Quo : OUT UNSIGNED (QW-1 DOWNTO 0) ); END COMPONENT UnsignedDivide ; -- etc END PACKAGE MyCompanyLibrary ; I cannot find how to progress from here. I am hoping to do something like this at the top of all my VHD project files : LIBRARY IEEE ; USE IEEE.STD_LOGIC_1164.ALL ; USE IEEE.NUMERIC_STD.ALL ; LIBRARY MYLIB ; USE MYLIB.MyCompanyLibrary.ALL I can make this work in ModelSim by mapping a library MYLIB in my project, and pre-compiling all the VHD of my library (the pkg file and the entity/architecture files) into this. I have been searching the Quartus help for hours now and can't find what I'm looking for. Any help will be appreciated. Thanks Gary