フィルターのクリア

Problem with a loop in the hdl coder

6 ビュー (過去 30 日間)
Marina
Marina 2013 年 9 月 10 日
回答済み: Tim McBrayer 2016 年 7 月 21 日
Hello,
I have written a matlab code and I try to produce a vhdl code by using the hdl coder. The problem is that the following error is appearing during the procedure of the code generation. "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."
I have in the code a "while loop" and it seems that this error.Does anyone know why this error appears? As I know, the vhdl supports the "while loop".

採用された回答

Wayne
Wayne 2013 年 9 月 10 日
I'm still learning vhdl and HDL coder, myself - you can use while loops, it just sounds like you need to provide some information on a variable. For example, if you have something like, "while x< 1," the synthesis program needs to know the range of x. So if you defined x as, say 1:10, then that should fix it.
  2 件のコメント
Marina
Marina 2013 年 9 月 10 日
Thank you very much for your reply Wayne. My while loop has the following form:
while(A(i,j)>=0)
DD(i,j)=DD(i,j)+1;
A(i,j)=A(i,j)-7;
end
where A is an array and takes value from a subtraction: A(i,j)=abs(parti(i,j))-7; so each item of the array has its own first value. Let's suppose that theirs values are 70000 then where I must define them and how?
Wayne
Wayne 2013 年 9 月 11 日
I have had difficulty with HDL coder and multi-dimensional arrays - I'm surprised you didn't get an unsupported matrix type error. This doesn't really help you, but to handle matrices I just broke down and learned vhdl and coded those sections myself. Maybe some HDL Coder gurus can help here, but I found it easier to learn vhdl, heh

サインインしてコメントする。

その他の回答 (2 件)

sin
sin 2014 年 2 月 24 日
i haven't used any loop still am getting the same error. can anyone help me with the solution?
thanks in advance!
  1 件のコメント
DN
DN 2016 年 7 月 20 日
Hi, have any of you had any joy on this. Can one use a For and While statement in a user defined function block in Simulink and still generate HDL code? Thanks

サインインしてコメントする。


Tim McBrayer
Tim McBrayer 2016 年 7 月 21 日
For loops are supported, when they have fixed loop indices. While loops in general are not, as there is no way the compiler can determine how many loops will be executed. Keep in mind you are building hardware; no sizes can be left data-dependent, as your hardware cannot reconfigure itself at runtime based off of time-dependent input data.
This situation is the basis of the error message. HDL Coder must be able to statically determine, at compile time, how many times a loop will execute. In general a while loop does not execute a static number of times, so they are not supported. Hence, the "unbounded loop structure" message.
You can map while loops to for loops in many cases. The for loop should loop across the maximum range of iteration, while the body of the for loop has an if statement protecting the rest of the body so that the loop is in essence conditionally executed.
Finally: sometimes you can get an error referencing an unbounded loop when you have not written one explicitly in your code. This is most likely because you are calling a function, possibly even a built-in MATLAB function, that has such a loop in its underlying implementation.

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by