Basic shifting question

S

Stefan Duenser

Hello

A very easy problem for most of you I assume: Normally when I want to shift
left I do it the following way:

result((arraylength-2) downto 0) & '0';

So far so good, the problem is how can I write this statement when I want to
shift for example by 100 positions?

It wouldnt make sense to write result((arraylength-101) downto 0) &
"0000000.....000" 100 times a zero.
I tried it this way but it didnt work: result((arraylength-101) downto 0) &
(others=>'0');

Any other suggestions?

Thanks a lot
 
P

Paul Uiterlinden

Stefan said:
Hello

A very easy problem for most of you I assume: Normally when I want to shift
left I do it the following way:

result((arraylength-2) downto 0) & '0';

So far so good, the problem is how can I write this statement when I want to
shift for example by 100 positions?

It wouldnt make sense to write result((arraylength-101) downto 0) &
"0000000.....000" 100 times a zero.
I tried it this way but it didnt work: result((arraylength-101) downto 0) &
(others=>'0');

Any other suggestions?

Yep:

result((arraylength-101) downto 0) & (99 downto 0 => '0');

Paul.
 
M

Mark

You can also use the SHL and EXT functions to do the shifting and
padding for you.
 
M

Mark

You can also use the SHL and EXT functions to do the shifting and
padding for you.
 

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,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top