Generic: use constant or not?

R

Ricardo

Hello,

The generic part of entity declaration. I've found that there are two
ways, like:

GENERIC ( constant value : integer := 5 )

or

GENERIC ( value : integer := 5 )

Both ways seem to work fine, for synthesis and simulation. I suppose
they are equivalent. Wich difference the "constant" do? Any comments?

Regards,

Ricardo.
 
M

Mike Treseler

Ricardo said:
The generic part of entity declaration. I've found that there are two
ways, like:
GENERIC ( constant value : integer := 5 )
or
GENERIC ( value : integer := 5 )

Both ways seem to work fine, for synthesis and simulation. I suppose
they are equivalent.

yes

Wich difference the "constant" do? Any comments?


I leave out the "constant" because
a generic cannot be of any other class.
If someday there are other options
(generic types would be nice!), I expect
that constant will still be the default class.

-- Mike Treseler
 
?

=?ISO-8859-1?Q?Sch=FCle_Daniel?=

Ricardo said:
Hello,

The generic part of entity declaration. I've found that there are two
ways, like:

GENERIC ( constant value : integer := 5 )

or

GENERIC ( value : integer := 5 )

Both ways seem to work fine, for synthesis and simulation. I suppose
they are equivalent. Wich difference the "constant" do? Any comments?

from my book 'A VHDL primer'
"A generic declares constant object of mode -in-"

whether you write constant or not, it's constant per default
the same is true for procedures

procedure test(a: in bit, b: out bit);
if object class is omited then parameters with
-in- mode are implicitely constant and thoese with
-inout- or -out- mode are variable's and could be written as

procedure test(constant a: in bit, variable b: out bit);

if one wants b to be signal this should be then

procedure test(constant a: in bit, signal b: out bit);

hth, Daniel
 

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,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top