I write the below codes to execute Z= X1*Y1+X2*Y2+...+X5*Y5
X and Y are both assigned as the array type and I set their each element.
But it always give the error that inputs X1 to X4 and Y1 to Y4 are not used.
process (X, Y)
begin
for i in 0 to 5 loop
r <= r + X(i)*Y(i);
end loop;
Z <= r;
end process;
I think there are some problems with i, but i do not know how to solve it.
And the other problem: I write below kind of code in the testbrench.
X0 <= 3, 7 after 10ns, 1 after 12ns;
but it give the following warning:
(vcom-1207) An abstract literal and an identifier must have a separator between them.
Thanks for your reply!
But if use ":=" in stead of "<=", it gives error "Cannot assign to signal 'r' " when ido the complie.
Added after 43 minutes:
This error related to the type i assigned. I assign 'r' as a signal, but X and Y must be signal (they are array of inputs). So 'r' should be a signal, too, not a variable. Then, the problem still exist. Waiting...
Thank you very much. You are right. It should be 10 ns, not 10ns.
It tends to be difficult to solve the problem, when it does not give the direct reason.
I am not sure about that. But I think you can put constraint condition inside.
such as
for i in 0 to 8 loop
if (i%2=1) then ...
I does not test it. Hope this concept can hlep you.
I am not sure about that. But I think you can put constraint condition inside.
such as
for i in 0 to 8 loop
if (i%2=1) then ...
I does not test it. Hope this concept can hlep you.
As far as I see, the VHDL standard doesn't provide non-consecutive discrete ranges. The VHDL term for a similar list of values is choices, but this syntax isn't available with a for iteration scheme. You may want to check with IEEE 1076 yourself.
The suggested conditional execution, is one possible solution, a derived index variable 2*i or a while iteration, that accepts any conditional expression, another.
As far as I see, the VHDL standard doesn't provide non-consecutive discrete ranges. The VHDL term for a similar list of values is choices, but this syntax isn't available with a for iteration scheme. You may want to check with IEEE 1076 yourself.
The suggested conditional execution, is one possible solution, a derived index variable 2*i or a while iteration, that accepts any conditional expression, another.
Thanks FvM .. I managed to get it through to what I wanted .. I just declared an array with the integer values of my interest and I specified the loop like this :