Using VHDL Libraries
In the Efinity® software v2020.2 and higher, you can use VHDL libraries to organize and reference commonly used packages and entities.
Create a Library
To create a library for your project:
- Open the Project Editor.
- Click the Design tab.
- Add the design file(s) that have the packages you want to use. You can add multiple files.
- Double click the cell under Library.
- In the drop-down menu, choose Add New.
- Enter the library name and click OK.Note: In VHDL, the work library refers to the current library in the design. When assigning a library name to a VHDL design file, you are encouraged not to use the word work as the library name only (instead use a variable like name, example: my_work). Doing so will cause an error in synthesis. Leave it blank (or default) if the file is part of the current library in the design project.
- (Optional) If you add more than one library file to your project, double-click in the Library cell for each file and either choose the library name or add a new one.
Library names are saved across projects.
Add a File to a Library
You add a file to a library in the tab. Double-click the Library cell for the file and choose the name from the drop-down list.
Reference a Library
You use the library and use VHDL language
constructs to reference your new library. The following simple code example shows a
new library file for the package mylibrary:
mylibrary.vhd
--! Use standard library
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
package mylibrary is
--! factor width
constant DF_WIDTH : integer := 12;
end package mylibrary;
After you add this file to your project and create a library for it, you can refer to the file in your code:
Referring to the Package
--! Use standard library
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
--! Use costum library
library mylibrary;
use mylibrary.mylibrary.all;
--! Multiplier entity brief description
--! Detailed description of this
--! multiplier design element.
entity multiplier is
port (
a : in signed (DF_WIDTH-1 downto 0); --! Multiplier first factor
b : in signed (DF_WIDTH-1 downto 0); --! Multiplier second factor
result : out signed (2*DF_WIDTH-1 downto 0) --! Multiplier result
);
end entity;
Reference Trion and Titanium Primitive Libraries
The Efinity® software includes VHDL libraries for Trion
and Titanium primitives. You use the
library and
use VHDL language constructs to reference these libraries:
library efxphysicallib;
use efxphysicallib.efxcomponents.all;Notice: The following documents provide example code for these libraries: