Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assigning ls byte of bigger vector to smaller one

Status
Not open for further replies.

rt2001atmaildotcom

Technical User
Jun 13, 2006
1
US
Hello,

I have a question:

This seems to work...

led_nxt <= not (not slave_register)

... but this won't:

led_nxt <= slave_register

Here, led_nxt is a vector 0 to 7
and slave_register is a vector 0 to 31.

Even if I do something like:

led_nxt <= slave_register(0 to 7)

...it won't work.

Basically I'm trying to give the lower 8 bits of the bigger vector to the smaller one.And I'm trying this in VHDL'93.
Can anyone tell me why it's like this? Also how can I assign the lower x bits of a bigger vector to a smaller one?

If someone has a circuit understanding of it, please share.

Thanks.

-TRO.
 
rt2001atmaildotcom ,

Normally the second thing you mention should work.
I'm used to working with downto instead of to but basically this should be the same.

if you have following signal :

led_nxt : std_logic_vector(7 downto 0);
registerA : std_logic_vector(31 downto 0);

you can assign any slice of the 32 bit register to the 8 bit signal like this :

led_nxt <= registerA(7 downto 0);

or

led_next <= registerA(23 downto 16);

As I said before this should work for to also.

What is strange is that when you put some logic in between it gives no problem.

What compiler or synthesizer are you using?

Also maybe you can post the error message ( if you get any) that you get, this can also be useful to find the problem.

But frankly I don't see anything wrong with your second way of assigning.

In the first assignement way I would expect trouble (with or without the double inversion) if the size of the signals is the same as for the second case.

It seems like a strange problem.

regards

Jeandelfrigo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top