HDL Coder RAM mapping failed

2 次查看(过去 30 天)
Yu Chen
Yu Chen 2018-7-27
I am practicing HDL Coder and I have an error.
I originally wanted to ignore this problem, but I found that the FPGA implementation would fail.
Because too many LUTs are used. How can I modify my code?
_fixpt:26 Warning 'g' : RAM mapping failed for variable, 'g', because it has a non-scalar sub-matrix access.
_fixpt:0 Warning 'g2' : RAM mapping failed for variable, 'g2', because it has a non-scalar sub-matrix access.
function P= test(in,win)
persistent g
L=zeros(1,16);
persistent g2
E= zeros(1, 16);
if isempty(g)
g = zeros(1, 16);
g2 = zeros(1, 16);
end
if win<=16
E(:,win)=in;
g=E+g;
elseif win>16
L(:,win-16)=in;
end
if win==16
% Y=g3;
Y=g;
Y=reshape(Y,4,4);
W=eye(4,4);
A=W*Y;
A=reshape(A,1,16);
g2=A;
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
if win>16
% g2=A;
S=g2;
P=S(:,win-16);
% end
else
P=0;
end

回答(1 个)

Kiran Kintali
Kiran Kintali 2020-8-23
HDL Coder would need input types to infer the intermediate and output types.
Please specify
in = <sample value>; % define in
win = <sample value>; % define win
To repeat the issue using the following commands
c = coder.config('hdl');
codegen -args {in, win} -config c -report test

Community Treasure Hunt

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

Start Hunting!

Translated by