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

6 views (last 30 days)
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

Answers (2)

Tim McBrayer
Tim McBrayer on 3 Jun 2015
Edited: Tim McBrayer on 3 Jun 2015
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.
  2 Comments
fahim GH
fahim GH on 3 Jun 2015
Edited: Walter Roberson on 3 Jun 2015
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

Sign in to comment.


fahim GH
fahim GH on 4 Jun 2015
I can not see the supported libraries :( can u send me this file ??
  1 Comment
Tim McBrayer
Tim McBrayer on 5 Jun 2015
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'))

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!