abstract type signal

I

Ilya Kalistru

Hi everyone!

I have a module, that makes some actions with signal S of the type myType. This actions with signal S is independent of its type.

For using this modules for signals of various types I create a copies of module with another name and "Find and replace" myType to MyOtherType.
I think that it is conceptually wrong way.

Is there a way to define a signal of abstract data type and substitute the correct type in place abstract when I need use it? May I use "generic" for this purpose?
 
R

Rob Gaddi

Hi everyone!

I have a module, that makes some actions with signal S of the type myType. This actions with signal S is independent of its type.

For using this modules for signals of various types I create a copies of module with another name and "Find and replace" myType to MyOtherType.
I think that it is conceptually wrong way.

Is there a way to define a signal of abstract data type and substitute the correct type in place abstract when I need use it? May I use "generic" for this purpose?

That's a feature in VHDL-2008, and in my experience one that's not very widely supported yet.
 
A

Andy

I agree with Rob, but notify your tool vendor(s) if they do not yet support it(generic types). This will help them prioritize implementation of 2008 features, and let the know that more customers want to use 2008 features.

Andy
 
K

kevin.neilson

I had the same experience recently in which I had to make four almost-identical modules so I tried passing in the type as a generic, which looks like this:

entity delay is
generic (type DATATYPE);
port (...

In my notes I see that this was supported by my synthesizer (Synplify Pro) but not by Modelsim 10.1d, which despite being sold for ridiculous prices, does not support basic features from a standard from 2008, which if I calculate correctly, was FIVE YEARS AGO.

Even if this feature is supported, it's not really that great. It would bepreferable to have an unconstrained type, so you could do something like this:

signal internal_sig : data_in'type(data_in'range);

Your other option is to use Verilog.
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top