Error while using HDL coder: variable-size matrix type is not supported for HDL code generation
Show older comments
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 

Accepted Answer
More Answers (1)
Kiran Kintali
on 8 Jan 2023
0 votes
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 Comments
Achala G
on 1 Mar 2024
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'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
on 1 Mar 2024
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.
Categories
Find more on Speed and Area Optimization in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!