Error: variable-size matrix type is not supported for HDL code

5 次查看(过去 30 天)
I use the fixed-point tool to fixed-point the subsystem and then generate Verilog, but the following error occurs.
The model contains constructs that are unsupported for HDL code generation. HDL Coder 'c' : Error: variable-size matrix type is not supported for HDL code generation. Function 'eml_fixpt_times' (#33554529.1887.1910), line 65, column 5 Function 'times' (#33554530.5290.5318), line 146, column 27 Function 'mtimes' (#33554528.2252.2264), line 62, column 9 Function 'forSubsystem/MATLAB Function1/MATLAB Function1_FixPt' (#369.531.542), line 23, column 13
In #369.531.542, the error is related to miu*x*en(i), i tried to use sss=miu*x*en(i) instead, but it ended up showing Subscripted assignment dimension mismatch: [1] ~= [5]. Error in 'testfixed/testforSubsystem/MATLAB Function' (line 23) sss = miu*x*en(i);
I fixed the above problem,
sss= zeros(1,5);
sss = miu*x*en(i);
wn(:)=wn+sss;
but still failed to generate Verilog,
The model contains constructs that are unsupported for HDL code generation. HDL Coder 'c' : Error: variable-size matrix type is not supported for HDL code generation. Function 'eml_fixpt_times' (#33554529.1887.1910), line 65, column 5 Function 'times' (#33554530.5290.5318), line 146, column 27 Function 'mtimes' (#33554528.2252.2264), line 62, column 9 Function 'forsubsystem/MATLAB Function' (#998.580.591), line 23, column 1
The key to the error is on en(i), why does it cause this error?
  2 个评论
Walter Roberson
Walter Roberson 2023-4-18
Note that it is typically possible to use coder.varsize() provided that a fixed maximum size for the array is specified. When HDL is generated, it needs to know the maximum amount of memory that will be used for the array, and must always generate enough memory cells to allow for the worst-case situation. Indefinitely-large arrays are not permitted because that would require generating countable-infinity hardware memory cells.
shubin
shubin 2024-8-14
移动:Walter Roberson 2024-8-14
Hello, may I ask if your issue has been resolved? I also encountered the same problem while dealing with LMS. How was it resolved? Could you share it to me?Thank you very much。

请先登录,再进行评论。

回答(1 个)

Kiran Kintali
Kiran Kintali 2023-4-18
Variable dimensions are not synthesizable to hardware and hence not supported for HDL Code generation.
>> mlhdlc_demo_setup('lms')
This example shows how to code LMS filter using basic MATLAB operations without needing variable dimensions.
Consider following the best practices in the example to code your adaptive filter.

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by