Velocity Reviews > VHDL > Basic shifting question

# Basic shifting question

Stefan Duenser
Guest
Posts: n/a

 12-07-2004
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

Paul Uiterlinden
Guest
Posts: n/a

 12-07-2004
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.

Mark
Guest
Posts: n/a

 12-08-2004
You can also use the SHL and EXT functions to do the shifting and

Mark
Guest
Posts: n/a

 12-08-2004
You can also use the SHL and EXT functions to do the shifting and

Stefan Duenser
Guest
Posts: n/a

 12-08-2004

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

Thanks a lot, for this I was looking

bye
SD