where to define a type?

M

Max

I need to define a type, and I need to use it in port defenition of my
entity.

for example:

entity my_entity is
Port ( A: inout my_type);

I have write a package to define my_type.

The problem is that ModelSim 5.6 starter don't support pakages other
then standard (ieee).

Can I define my_type outside of package? I tried to put the definition
at the beginnig of file and also in the entity definition, but it
doesn't compile.

thanks
 
M

Mike Treseler

Max said:
I need to define a type, and I need to use it in port defenition of my
entity.

for example:

entity my_entity is
Port ( A: inout my_type);

I have write a package to define my_type.

That's correct, or if it's just a vector length
use a generic:

entity my_entity is
generic (cnt_len : natural := 32);
Port ( A: inout my_cnt(cnd_len-1 downto 0) );

The problem is that ModelSim 5.6 starter don't support pakages other
then standard (ieee).

I expect that it does.
Be sure to compile the package and put a:

use work.my_package.all;

before the entity.

Can I define my_type outside of package? I tried to put the definition
at the beginnig of file and also in the entity definition, but it
doesn't compile.

No, a generic can instance a type, but cannot define one.

Consider keeping port types standard and define
your custom types in the architecture or in a process.

-- Mike Treseler
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top