Partial Aggregate Assignment

P

Paul B

Hi all,

I'm trying to write a tight piece of code which will pick all the individual
signals out of an slv as I need them. So I have a vector whos bits are not
all used.

What I was thinking was:

(a, b, , c, , d, e, f) <= SLV_SIGNAL;


or

(a, b, open, c, open, d, e, f) <= SLV_SIGNAL;


where

signal a,b,c,d,e,f : std_logic;

signal SLV_SIGNAL : std_logic_vector;

Is there any compact way of doing this instead of writing:

a <= SLV_SIGNAL(7);

b <= SLV_SIGNAL(6);

c <= SLV_SIGNAL(4);

d <= SLV_SIGNAL(2);

e <= SLV_SIGNAL(1);

f <= SLV_SIGNAL(0);

TIA!

Paul
 
P

Paul B

Hmm yes, but I need a way to take only a few of the signals from the source,
hence the commas marking unused elements. At the moment I have them going to
dummy signals.

Mike Treseler said:
Paul B wrote:tm> What I was thinking was:4> (a, b, , c, , d, e, f) <=
SLV_SIGNAL;00http://groups-beta.google.com/groups/search?q=15%3A27%3A54+entity+aggregatem>
-- Mike Treseler
 
M

Mike Treseler

Paul said:
Hmm yes, but I need a way to take only a few of the signals from the source,
hence the commas marking unused elements. At the moment I have them going to
dummy signals.

If "SLV_SIGNAL" is an input value to your process,
and if these port/signal bits are already in scope,
I would just reference the bits I need and ignore the rest.
If the intent is to identify the bit, I would declare index constants:
constant ready : natural := 2; -- status bit location
-- ...
if SLV_SIGNAL(ready) = '1' then
-- ...

-- Mike Treseler
 
P

Paul Uiterlinden

Paul said:
signal a,b,c,d,e,f : std_logic;

signal SLV_SIGNAL : std_logic_vector;

Is there any compact way of doing this instead of writing:

a <= SLV_SIGNAL(7);

b <= SLV_SIGNAL(6);

c <= SLV_SIGNAL(4);

d <= SLV_SIGNAL(2);

e <= SLV_SIGNAL(1);

f <= SLV_SIGNAL(0);


Yes: use aliases:

signal SLV_SIGNAL : std_logic_vector;
alias a: std_logic is SLV_SIGNAL(7);
alias b: std_logic is SLV_SIGNAL(6);
etcetera

Now you can not only read a, b,..., but also assign to them:
a <= '1';

This is equivalent to:
SLV_SIGNAL(7) <= '1';
 

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,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top