can we use HDL coder for functions that have another functions inside themselve ??

hi I want to use HDL coder for converting my matlab code to VHDL but inside my function code I have another functions like imresize.imresize in another function in matlab and have another functions in it too....:( I dont know what to do??does HDL coder help in these cases??how should I use it thanks so much

回答(1 个)

There is no problem using nested functions in your MATLAB source to HDL Coder, as long as all constructs are supported and all library functions called are also supported. Please refer to the list of supported library functions.

4 个评论

thanks so much
I want to convert the image processing code "imresize" to vhdl. in m file code first the imresize code is written and below the imresize function there are lots of other functions that use in it and their previous functions.. like this :
function [B,map] = imresize(varargin)
params = parseInputs(varargin{:});
checkForMissingOutputArgument(params, nargout);
A = preprocessImage(params);
% Determine which dimension to resize first.
order = dimensionOrder(params.scale);
% Calculate interpolation weights and indices for each dimension.
weights = cell(1,2);
indices = cell(1,2);
for k = 1:2
[weights{k}, indices{k}] = contributions(size(A, k), ...
params.output_size(k), params.scale(k), params.kernel, ...
params.kernel_width, params.antialiasing);
end
if isPureNearestNeighborComputation(weights{1}) && ...
isPureNearestNeighborComputation(weights{2})
B = resizeTwoDimUsingNearestNeighbor(A, indices);
else
B = A;
for k = 1:numel(order)
dim = order(k);
B = resizeAlongDim(B, dim, weights{dim}, indices{dim});
end
end
[B, map] = postprocessImage(B, params);
%-----
function A = preprocessImage(params)
% Convert indexed image to RGB. Convert binary image to uint8.
if isInputIndexed(params)
A = ind2rgb8(params.A, params.map);
elseif islogical(params.A)
A = im2uint8(params.A);
else
A = params.A;
end
%---------------------------------------------------------------------
..... and alot of another functions below each other too
I can not see the supported libraries :( can u send me this file ??
This is part of the HDL Coder documentation; you will need to log into your MathWorks account.
Alternatively you can refer to the in-product documentation; it's the same material.
>> web(fullfile(docroot, 'hdlcoder/ug/fixed-point-run-time-library-support.html'))

请先登录,再进行评论。

类别

产品

提问:

2015-6-3

移动:

DGM
2024-4-2

Community Treasure Hunt

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

Start Hunting!

Translated by