unexpected matlab expression during hdl code generation
Afficher commentaires plus anciens
Dear sir/madam, whenever I am trying to generate a verilog code I am getting an 'Unexpected Matlab Expression' error.. I googled the solution, but I am unable to understand what's wrong... plz help.. Here's my code
function y = fir_project(x,h)
% x = [1/5,2/5,3/5,4/5];
% h = [1/3,1/3,1/3];
% initialize
x1 = 0;
x2 = 0;
y = zeros(1,length(x));
for k = 1:length(x)
if k-2 == -1 || k-2 == 0
x2 = 0;
else
x2 = x1;
end
if k-1 == 0
x1 = 0;
else
x1 = x(k-1);
end
y(k) = (h(1)*x(k))+(h(2)*x1)+(h(3)*x2);
end
end
The x and h values are given in comments. Thanks in advance. This is the error I am getting
emlhdlcoder.WorkFlow.Manager.instance.wfa_generateCode(' C:\Documents
\matlab\fir's project\firproj2.prj ');
|
Error: Unexpected MATLAB expression.
Réponses (1)
Tim McBrayer
le 18 Mar 2014
0 votes
I think that HDL Coder will have a hard time with your variable loop bound; this is hard to build hardware for. I have no issues when I use a constant 4 instead of the expression length(x) .
Catégories
En savoir plus sur AMD FPGA and SoC Devices dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!