problem found in hdl coder
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Gnaneswar Nadh satapathi
le 2 Avr 2014
Commenté : Gnaneswar Nadh satapathi
le 3 Avr 2014
Found an unsupported unbounded loop structure. This loop may be user written or automatically generated due to the use of specific vector expressions or functions. For more information on unsupported loop structures, please refer to the documentation
the matlab code is as follows:
function a=poly123() s1=[zeros(1,3),pi]; % xcorr(x) x=cos(s1)+1i*sin(s1); n=length(x); r1=zeros(1,n)+1i*zeros(1,n); for m=0:1:n-1 r=0+1i*0; for n1=1:1:n-m r=r+x(n1+m)*x(n1); end r1(m+1)=r; end a=r1;
end
what to do with this kind of problem
0 commentaires
Réponse acceptée
Tim McBrayer
le 2 Avr 2014
You have a loop from 1:n-1 , where n is length(x) . You also have an inner loop from 1:(n-m) , where m is the current index of the outer loop. This inner loop does not have a well-defined upper bound. It's not generally possible to determine how many loops you need with code like this. Since the number of loops dictates what sort of hardware gets created, HDL Coder cannot generate synthesizable HDL from such a design.
The most obvious rewrite of the inner loop, to give it a static bound, is:
for n1 = 1:n
if n1 <= (n-m)
<...>
end
end
In software, you'll execute the loop m extra times. In hardware, the loop will be unrolled (in general) and the extra empty loops will cause no hardware to be created.
You may run into the same issue with the outer loop, if length(x) is not statically determinable.
Plus de réponses (0)
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!