HDL Coder. Undefined function or variable '***'. The first assignment to a local variable determines its class.

3 ビュー (過去 30 日間)
SALVADOR CANAS
SALVADOR CANAS 2018 年 1 月 16 日
回答済み: Kiran Kintali 2020 年 8 月 1 日
Hi guys,
I've written a Matlab function which works fine. Now I'm trying to covert it to Verilog using HDL Coder, but I've found lots of errors, like:
Undefined function or variable 'kernel'. The first assignment to a local variable determines its class.
How can I solve it?
Thanks in advance!
My function is:
function out = convolve3(in, kernel, P, S);
[kRows, kCols]=size(kernel);
[rows, cols] = size (in);
oRows = (rows-kRows+2*P)/S+1;
oCols = (cols-kCols+2*P)/S+1;
kCenterX = floor(kCols / 2);
kCenterY = floor(kRows / 2);
out = zeros(oRows,oCols);
for i= 1 : 1 : oRows
for j= 1 : 1 : oCols
for m= 1 : (kRows)
mm = kRows +1- m;
for n= 1 : (kCols)
nn = kCols +1- n;
ii = (i-1)*S+1 + (m - kCenterY)-P;
jj = (j-1)*S+1 + (n - kCenterX)-P;
if( ii > 0 && ii <= rows && jj > 0 && jj <= cols )
out(i,j) = out(i,j) + in(ii,jj) * kernel(mm,nn);
end
end
end
end
end
end

回答 (2 件)

Kiruthika Balakrishnan
Kiruthika Balakrishnan 2020 年 8 月 1 日
I am also getting same error .Did you cleared error?
Thanks in advance

Kiran Kintali
Kiran Kintali 2020 年 8 月 1 日
Hi Salvador, Can you share a testbench file for this design? Test bench determines the compute the input types used to compile the design and in addition validation of the generated code.

カテゴリ

Help Center および File ExchangeCode Generation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by