Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

VHDL package body and

Status
Not open for further replies.

shaiko

Advanced Member level 5
Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Visit site
Activity points
18,302
As far as I know, a VHDL package is defined as follows :

What is the section in red for?

Code:
package some_package is
[COLOR="#FF0000"]-- but what is this region for...?[/COLOR]
end package some_package ;

package body some_package is
-- I know that this region contains function prototypes for example 
end package body some_package ;
 

Can you describe a function in the package body without declaring it in the red section ?
 

I've always declared them. Don't know if you can avoid declaring it. You'll have to either look it up or wait till one of the VHDL experts responds.
 

Information in this page suggests that a function declaration is optional...
**broken link removed**

VHDL experts...please leave your input.
In a package, is there anything that must be written only in the declaration section (and nowhere else)?
Can this part of a package be left blank with everything described in the package body?
 

Information in this page suggests that a function declaration is optional...
**broken link removed**.

The link doesn't talk about packages at all, just functions in general.

I see that it doesn't fail a parsing check...
Did you also try to import the function in your design? I presume the function without delarative part won't be visible.
 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating
Can you describe a function in the package body without declaring it in the red section ?

Yes. You can also declare constants, procedures, types or anything else in the body too.
What is important to remember here is scope. Anything declared only inside the body is only visible inside the package body, Not to anyone calling:

use my_lib.my_package.all;

This can be useful if you have some utility function that is used inside several of the functions declared in the package declaration.
 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top