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

조회 수: 11 (최근 30일)
wang
wang 2023년 4월 12일
댓글: Walter Roberson 2023년 4월 18일
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?
  댓글 수: 1
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.

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

답변 (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