Whats the use of Code inside an Entity Declaration

T

Tricky

I only realised today that I can put sequential statements inside an
entity, rather than an architecture.

So, other than asserts or similar to check the viability of given
generics, what useful code can but put in there?

From making a test entity, I also noticed that an assert I had that
checked a generic, was not processed until the first delta cycle in
modelsim. I had some outputs from another process written to the
console before the assert inside the entity failed.
 
A

Andy

I only realised today that I can put sequential statements inside an
entity, rather than an architecture.

So, other than asserts or similar to check the viability of given
generics, what useful code can but put in there?

From making a test entity, I also noticed that an assert I had that
checked a generic, was not processed until the first delta cycle in
modelsim. I had some outputs from another process written to the
console before the assert inside the entity failed.

I think you can put any code that does not update a signal or shared
variable in the entity statement part.

Concurrent statements, including concurrent assertion statements, are
implied processes, and processes execute in indeterminate order within
the same delta cycle.

If you really want something to fail prior to simulation starting, it
needs to cause an error in elaboration. Things like illegal object
declarations (subtype outside of root type's range, etc.) constant
initialization, port-signal bounds mismatches, etc. should do the
trick. But then the error message may not be too useful.

You might be able to declare a constant initialized with a function
call, taking the generic(s) as argument(s), and inside that function
have one or more assertion statements.

Andy
 

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,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top