Hi, I'm trying to generate a VHDL code from Hdl coder. My function file is like below.

조회 수: 1 (최근 30일)
function[a]=frfunc(x,y,c)
a=0;
for i=0:c
a(i)=x(i)+y(i);
end
end
The error was
"Found an unsupported unbounded loop structure at '...'. This loop may be user defined or automatically generated due to the use of specific vector expression or function".
so how to write a for loop whose limit(i.e 'c') is read from the test bench file.
  댓글 수: 1
Walter Roberson
Walter Roberson 2017년 1월 25일
편집: Walter Roberson 2017년 1월 25일
You appear to be indexing at 0, which would not lead to the message you are seeing but would lead to other errors.
You should be using initializing a to the appropriate size, such as
a = zeros(1, c+1);

댓글을 달려면 로그인하십시오.

채택된 답변

Tim McBrayer
Tim McBrayer 2017년 1월 25일
You will need to use some other method of informing your loop when to stop iterating. Hardware designs require fixed sizes for both loops and data structures. Otherwise, how can the size of registers, amount of RAM, etc., be determined?
One possibility is to declare your array a to have some maximum size. Then you can replace your count size 'c' with a data valid strobe coming from your testbench. When the strobe is '1', process the next pair of inputs. When it's low, do nothing.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Code Generation에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by