constant in entity or in architecture

M

MariuszK

Hello,
What is a difference between constant declared in entity and in
architecture?

In this sample is the same? When it is change something (synthezis
etc.....):
----------------------------------------------------
entity EWeightValue is

port(
out1 : out TNumberType(1 downto 0)
);
constant cc: TNumberType:= "00";
end EWeightValue;

--}} End of automatically maintained section

architecture AWeightValue of EWeightValue is
constant cc: TNumberType:="00";
end EWbegin
out1 <= cc;
end AWeightValue;
 
?

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

MariuszK said:
Hello,
What is a difference between constant declared in entity and in
architecture?

In this sample is the same? When it is change something (synthezis
etc.....):
----------------------------------------------------
entity EWeightValue is

port(
out1 : out TNumberType(1 downto 0)
);
constant cc: TNumberType:= "00";
end EWeightValue;

--}} End of automatically maintained section

architecture AWeightValue of EWeightValue is
constant cc: TNumberType:="00";
end EWbegin
out1 <= cc;
end AWeightValue;

an entity may have more than one architecture
if all architectures are using the same constant than
this constant may as well be placed into entity declaration
(you save some typing work)

the generics of an entity may be different for each instantiation
one can think of constant in the entity as generic that has
the same value for all instantiations

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

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top