[HDL Coder]: BUG?/ Function Location missing in Error Report -> find variable by name?

1 次查看(过去 30 天)
In HDL Coder, I want to locate, where errors are occuring.
But the HTML Report just gives me the Error Location in the top compiled file,
not in the function file and line where it really occurs.
Example
dut_wrapper_fixpt:15 |Error |'varargin_1' : Error: variable-size matrix type is not supported for HDL code generation.
dut_wrapper_fixpt:15 |Error |'signal' : Error: variable-size matrix type is not supported for HDL code generation.
dut_wrapper_fixpt:15 |Error |'a0' : Error: variable-size matrix type is not supported for HDL code generation.
dut_wrapper_fixpt:15 |Error |'var_1' : Error: variable-size matrix type is not supported for HDL code generation.
dut_wrapper_fixpt:15 |Error |'varargin_1' : Error: variable-size matrix type is not supported for HDL code generation.
But at dut_wrapper_fixpt.m line 15 is only the call to a function in which all the errors occur.
Can I find the location of varargin & others by their name? var_1 (or var) for example does not even occur in my source.

采纳的回答

Jan Siegmund
Jan Siegmund 2020-4-2
As long a the location of error lines is not shown correctly in MATLAB HDL Coder,
assign the top function call as a
var = coder.const(your_function(constantA,constantB))
and run the fixed point designer. It will complain, that the expression cannot be reduced to a constant.
Then open the fixed-point designers error report and hover over variables you expect to be problematic.
If you find the variables size to be something like 1x:?, then you found the problematic spot.

更多回答(2 个)

Kiran Kintali
Kiran Kintali 2020-3-31
MATLAB code with variable dimensions in MATLAB is not suitable for mapping to hardware. Noting the enhancement to improve the error message locations.
  1 个评论
Jan Siegmund
Jan Siegmund 2020-4-2
I found the reason:
I did not accept this statement, even though the size of foo is not dynamic.
foo = zeros(25,3);
for i=2:4
foo = bar(:,i-1:i+1);
% do sth with foo
end
This is a bug in the coder, because this statement is the same, but accepted:
foo = zeros(25,3);
for i=2:4
foo = [bar(:,i-1) bar(:,i) bar(:,i+1)];
% do sth with foo
end
Please fix the general disacceptance of parametrized ranges.

请先登录,再进行评论。


Kiran Kintali
Kiran Kintali 2020-4-3
We got to compile the snippet in Simulink using MATLAB function block, looking into the standalone MATLAB issue. Thanks for reporting this issue.
codegen -config:hdl -args {zeros(25,3), 0} -report fcn
function y = fcn(bar, idx)
foo = zeros(25,3);
for i=2:4
foo = bar(:,i-1:i+1);
% do sth with foo
end
y = foo(:, idx);

类别

Help CenterFile Exchange 中查找有关 Code Generation 的更多信息

标签

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by