Error while using HDL coder: variable-size matrix type is not supported for HDL code generation

조회 수: 23 (최근 30일)
please help!!
function [alphaijVHDL]=Inter_func(betaijVHDL,alphaijVHDL,EN_sp_i,sgn,pas,s2,sp,threshold)
temp1=0;
betaijSP=zeros(1,1152);
alphaijSP=zeros(1,1152);
for isp=0:sp-1
betaijSP=betaijVHDL(1+(pas+pas*(isp-1)) : pas+pas*isp);
coder.varsize('betaijSP',[1 1152]);
val1=betaijSP(betaijSP~=0);
dlin2=length(val1);
val3=zeros(1,dlin2);
if dlin2>=1
for j=1:dlin2
val2=val1;
val2=abs(val2);
val2(j)=10000;
min_local=min(val2);
%******************************************
if isp==0
if min_local<=threshold
val3(j)=s2*sgn(j+temp1)*min(val2);
elseif EN_sp_i(isp+2)==1
val3(j)=s2*sgn(j+temp1)*threshold;
else
val3(j)=s2*sgn(j+temp1)*min(val2);
end
else
if min_local<=threshold
val3(j)=s2*sgn(j+temp1)*min(val2);
elseif EN_sp_i(isp)==1
val3(j)=s2*sgn(j+temp1)*threshold;
else
val3(j)=s2*sgn(j+temp1)*min(val2);
end
end
end
alphaijSP=alphaijVHDL(1+(pas+pas*(isp-1)) : pas+isp*pas);
alphaijSP(betaijSP~=0)=val3;
alphaijVHDL(1+(pas+pas*(isp-1)) : pas+isp*pas)=alphaijSP;
end
temp1=dlin2+temp1;
end
end

채택된 답변

Bilal MEJMAA
Bilal MEJMAA 2023년 1월 8일
Thank you so much for your answer
In general I need to split an Input vector into two partitions and process each partition inside the "for isp=0:sp-1" boucle (Line5) according to the other input parameters, then fed the output with the same size of the input vector.
  댓글 수: 2
Kiran Kintali
Kiran Kintali 2023년 1월 8일
Thanks for sharing the design and the testbench.
for ii=1:n
% body of the loop
end
for such loops 'n' needs to be compile time constant. In your example 'sp' variable is defined as a variable (not a coder.Constant). You can change the variable 'sp' to an example constant in the input variable table and choose define as Constant.
If you keep this loop bound as a variable the number of iterations are not fixed and hence not synthesizable to hardware.
Similarly betaijSP is defined as a variable sized variable. Such dynamic sized variables are not currently supported for HDL code generation as they not synthesizable.
Bilal MEJMAA
Bilal MEJMAA 2023년 1월 9일
Thank you for your support Mr Kiran ,
I defined 'sp' as coder.Constant but I still have the Error that coder.Constant type does not support the parameter ':' I am still wondering how can I set loops in the program.

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

추가 답변 (1개)

Kiran Kintali
Kiran Kintali 2023년 1월 8일
Can you please share design (Inter_func.m) and testbench (Inter_func_tb.m) driving the design with valid inputs and the HDL Coder project file (.prj) with code generation settings?
HDL Code generation requires static matrix types (i.e., variable assignments should not change sizes dynamically) for successful hardware synthesis. The design seem to be changing variable sizes between multiple assignments or output sizes are not determinable with input sizes to operators and depend on the run time values of the variables.
  댓글 수: 2
Achala G
Achala G 2024년 3월 1일
HDL Conformance check complete with 23 errors, 0 warnings, and 4 messages.
Function LocationLevelDescription
eucleds_verilog_fixpt:55Error'var1' : HDL code generation does not support variable-size matrix type
eucleds_verilog_fixpt:55Error'res' : HDL code generation does not support variable-size matrix type
eucleds_verilog_fixpt:55Error'hfi' : HDL code generation does not support variable-size matrix type.
I have defined some of variables like
coder.varsize('X',[1 10]);
coder.varsize('Y',[1 10]);
inside the matlab code. Still i get above error while running HDL code generation part.
Could you please help me in solving above issue?
Since I have written code for polynomial devision and hence each time quotient and reminder polynomial size varies.
Kiran Kintali
Kiran Kintali 2024년 3월 1일
Can you share your model?
You would need to review the data type inference related issues. You can use code generation report for the MATLAB constructs in question and remove unsynthesizable variable matrix types. The code generation report is accessible in MATLAB function block and MATLAB to HDL workflows.

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

카테고리

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