[Coder] Which types are supported for constant folding?

조회 수: 1 (최근 30일)
Jan Siegmund
Jan Siegmund 2020년 3월 18일
답변: Jan Siegmund 2020년 4월 2일
In MATLAB HDL coder I try to do constant folding on the output of a function.
The output type is a 1x262144 uint16.
The coder complains with:
The input to coder.const cannot be reduced to a constant: Unsupported type.
Which types are supported?
  댓글 수: 3
Jan Siegmund
Jan Siegmund 2020년 3월 18일
Thanks, I'll have a look.
Jan Siegmund
Jan Siegmund 2020년 3월 18일
I found the matrix being responsible for the issue. It is created from a concatenation in a for loop.
However the size can be determined at compile time wihtout doubt.
I tried to help the coder with
coder.varsize('a', [1 2^b], [0 0])
where b is compile time constant, but it still complains, that it cannot create the vector from concatenation
if the size is locked. Is there any other way?

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

채택된 답변

Jan Siegmund
Jan Siegmund 2020년 4월 2일
I did understand constant folding wrong:
I thought one must help the coder as follows:
a = coder.const(my_prod(3,2));
, because the gui of the fixed point converter was still complaining about a unsupported function in
my_prod
But the statement is already recognized as constant.
coder.const
just needs to be used, if you call a function multiple times with different input parameters
and you want the coder to create the function multiple times, each time with all of the parameters constant.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by