quick question

F

FPGA

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
 
M

mk

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.
 
K

Kevin Neilson

mk said:
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
 

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

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,267
Latest member
WaylonCogb

Latest Threads

Top