Basic shifting question

S

Stefan Duenser

Guest
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
 
Stefan Duenser wrote:
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.
 
You can also use the SHL and EXT functions to do the shifting and
padding for you.
 
You can also use the SHL and EXT functions to do the shifting and
padding for you.
 

Welcome to EDABoard.com

Sponsor

Back
Top