Passing user-defined types through the port (global variables??)

Feb 04, 2004 3 Replies

I have had to define a data type to deal with logarithmic values. It's basically a real number ranging from -10000 to 10000. However, I would like to use this user-defined data type in the entity of the device, i.e. given the user-defined type is called llrValue, the architecture port would be



ENTITY sova_decoder IS PORT ( Approiri : IN llrValue )



Where do I define the data type such that it would be recognised once it appears in the entity? Or is there some other way to do this?



cheers


- Kwaj http://alpha400.ee.unsw.edu.au/~p3015094

It's

would like

given

would be

once it

You need to use a package, e.g.

package types is

subtype llrvalue is real range -10000.0 to 10000.0;

end;

Then if you compile it into the same library you are using for your entity, it will appear in the current working library, so you can say

use WORK.types.all; entity sova_decoder is ...

regards

Alan

Alan Fitch Consultant DOULOS - Developing Design Know-how VHDL * Verilog * SystemC * Perl * Tcl/Tk * Verification * Project Services Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24 1AW, UK Tel: +44 (0)1425 471223 mail: alan.fitch@doulos.com Fax: +44 (0)1425 471573 Web: http://www.doulos.com The contents of this message may contain personal views which are not the views of Doulos Ltd., unless specifically stated.

Define the type in a package, then "use" the package before the entity declaration.

lib mylib; use mylib.mypkg.all;

entity sova_decoder is port ( Approiri : IN llrValue

Regards, Allan.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required