How do I solve this error: Variable-size Matrix type is not supported for HDL Code Generation?
Mostrar comentarios más antiguos
I have developed an image encryption algorithm in MATLAB (not Simulink!) and want to implement it on an FPGA. Unfortunately, I do not know how to code in HDL. I would love to learn coding in HDL but I do not have the time at the moment. I'm trying to use the HDL Coder in MATLAB to convert my code into Verilog. I have successfully converted the code from floating-point to fixed-point. It works perfectly. But when I try to generate the HDL code I consistently get the following error:
<VARIABLE NAME>:Error: Variable-size matrix type is not supported for HDL Code Generation.
Any form of help and guidance in the right direction will be much appreciated.
Cheers.
Respuestas (1)
Walter Roberson
el 11 de Abr. de 2013
1 voto
You need to supply a fixed (maximum) matrix size to work with, and arrange your code so that the real matrix size is known and used (e.g., don't loop to the size() of the matrix to handle variable sizing, because size() will be constant.)
Of course, the larger the matrix size you fix at, the more FPGA space it is going to occupy.
6 comentarios
Pedro
el 11 de Abr. de 2013
Walter Roberson
el 11 de Abr. de 2013
Why do you calculate k but then overwrite it all with zeros(1,N*N) ?
Walter Roberson
el 11 de Abr. de 2013
maxN = 50; %for example
assert( N0 <= MaxN );
k = zeros(1, MaxN * 3 + 3);
x(1)=initial(1); y(1)=initial(2); z(1)=initial(3);
k(1)=mod((abs(x(1)-floor(x(1)))*10^14),256);
k(2)=mod((abs(y(1)-floor(y(1)))*10^14),256);
k(3)=mod((abs(z(1)-floor(z(1)))*10^14),256);
temp = 3;
for i = 2 : N0
x(i)=(a*(y(i-1)-x(i-1)))*h - memo(x, c1, i);
k(temp+1)=mod((abs(x(i)-floor(x(i)))*10^14),256);
y(i)=(d*x(i)-x(i)*z(i-1)+c*y(i-1))*h - memo(y, c2, i);
k(temp+2)=mod((abs(y(i)-floor(y(i)))*10^14),256);
z(i)=(x(i)*y(i)-b*z(i-1))*h - memo(z, c3, i);
k(temp+3)=mod((abs(z(i)-floor(z(i)))*10^14),256);
temp=temp+3;
end
k = k(1:3*N0 + 3); %might not be needed or useable
Pedro
el 13 de Abr. de 2013
Walter Roberson
el 13 de Abr. de 2013
I do not have the appropriate to test with.
Not as an answer, but I wonder why you bother with two sets of "for" loops?
X = zeros(1000,1000);
for j = 1 : n
for k = 1 : n
newj = mod(((j-1)+(k-1)),n)+1;
newk=mod(((j-1)+2*(k-1)),n)+1;
X(newj,newk) = vec(pointer);
end
end
X = X(1:n, 1:n); %I am not sure this will be allowed.
Pedro
el 14 de Abr. de 2013
Categorías
Más información sobre Speed and Area Optimization en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!