Let's say I have two packages : package_1
and package_2
and an entity : my_entity
.
The entity uses the first package
-- This is my_entity
USE WORK.package_1.ALL;
The package_1 uses the second package;
-- This is package_1
USE WORK.package_2.ALL;
The package_2 implements a procedure called ... my_procedure
(y)
-- This is package_2
PROCEDURE my_procedure IS ...
Now, is there a way to call my_procedure
from my_entity
? The current version isn't compiling in Modelsim.
Your entity also requires a reference to:
USE WORK.package_2.ALL;
In VHDL, a package reference is to a compiled image that is in the library and only gets what is in the corresponding declarative part of the package. IE: unlike C, it does not get anything from the packages that are referenced by a package.
This is good as it helps isolate declarations - only include what you need and that is all that you get.
From note of @user1818839, you can just make my_procedure visible by doing:
USE work.package_2.my_procedure;
Alternately, if you want access to my_procedure when referencing package_1, then an alias will work well:
alias my_procedure is work.package_2.my_procedure[TypeOfParam1];
For an example of this, see the VHDL-2008 version of std_logic_textio which aliases to std_logic_1164 (without ambiguity since they are the same procedure).