quick question

F

FPGA

Guest
what does the following code do
output <= input[x*(y)-1 -: y];

I dont understand -: . What is this. I have seen [x:y], never came
across[x -: y]

Please help
 
On Fri, 28 Mar 2008 11:14:23 -0700 (PDT), FPGA
<FPGA.unknown@gmail.com> wrote:

what does the following code do
output <= input[x*(y)-1 -: y];
That's called an indexed part select. The first expression signifies
base and the second expression signifies width. It the sign is + it's
an ascending select if it's negative it's a descending select. Your
example is equivalent to input[x*(y)-1: x*(y)-y] ie you need to
subtract (y-1) from the base to get the lower index.
 
mk wrote:
On Fri, 28 Mar 2008 11:14:23 -0700 (PDT), FPGA
FPGA.unknown@gmail.com> wrote:

what does the following code do
output <= input[x*(y)-1 -: y];

That's called an indexed part select. The first expression signifies
base and the second expression signifies width. It the sign is + it's
an ascending select if it's negative it's a descending select. Your
example is equivalent to input[x*(y)-1: x*(y)-y] ie you need to
subtract (y-1) from the base to get the lower index.
I think your equivalent should be: input[x*(y)-1: x*(y)-y+1]

If I remember correctly, the width has to be a constant. In this case
that would mean y could be a parameter, but not an integer or register.
-Kevin
 

Welcome to EDABoard.com

Sponsor

Back
Top