VHDL - parameterised generic constants

Joined
Jul 23, 2009
Messages
9
Reaction score
0
Hi,

Wondering if someone can shed some light for me.

A very simple version of my problem code is effectively:

entity
...
generic (ID : std_logic_vector (3 downto 0):= "1101")
....
architecture

signal sigX : std_logic_vector (5 downto 0);
...
begin

with sigX select
portY <= "101" when "11"&ID,
"110" when "00"&"----",
"000" when others;
...

Syntax check is fine but on synthesis I'm warned that portY isn't used. I've narrowed the problem down to the fact that the condition includes the generic ID and if I make ID a constant my problem goes away.

However, the whole point for me is to use the generic as a parameter such that multiple instances of this module will have different ID values which can be assigned individually with a 'for generate'.

For the case of one module on its own, the ID isn't going to change and is therefore effectively a constant so the synthesizer shouldn't have a problem but how do i go about assuring it that this is the case. Putting the keyword constant into the generic declaration doesn't help.

...?

Much thanks for any help!
 
Joined
Jul 23, 2009
Messages
9
Reaction score
0
For what it's worth; I've fixed the problem by changing from with-select to a when-else statement. Although I am still mystified as to why that should solve things, or why I even had a problem to start with as the generic should effectively be treated as a constant.

Either way, in case anyone with a similar issue finds this, that was my solution. However, I am now worried about the difference between with-select and when-else. As best as I know when-else enforces a priority on the ordering but would appreciate any other clarification.
 

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,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top