# Error as: "Wrong index type for x","Wrong index type for temp".

Status
Not open for further replies.

#### ashwini012

##### Newbie level 3
hello,

I want to write the equation ,

Code:
x(i)=a*temp(i)
for i ranges from 0 to 5

I tried to write in vhdl but i got the error:[B] "Wrong index type for x","Wrong index type for temp".

PROCESS(CLK)
VARIABLE i : INTEGER RANGE 0 TO 5;
BEGIN

x(i) <= a * temp(i);

END PROCESS;

Is this write way to writw equation?
Help me....

Thank you!

Last edited by a moderator:

##### Super Moderator
Staff member
Re: Error as: "Wrong index type for x","Wrong index type for temp".

Are you trying to implement the parallel code:

Code:
x(0) = a * temp(0);
x(1) = a * temp(1);
...
x(5) = a * temp(5);

or are your trying to iterate over a sequence of i = 0, i = 1, ... , i = 4, i = 5?

If you are trying to iterate then you must use a counter not any kind of looping structure (e.g. for). And you likely don't need to index, just run a pipeline.

You also don't tell us how x is defined, but it should be an array of some type, given the multiplication either a signed or unsigned array. Both a and temp should also be defined as signed or unsigned arrays.

Status
Not open for further replies.

Replies
9
Views
1K
Replies
5
Views
10K
Replies
2
Views
7K
Replies
0
Views
848
Replies
2
Views
2K