In the following MATLAB® code, the line_buffer_average function takes working
set as the input and maps it to the line buffer interface in Cadence® Stratus HLS using coder.hdl.interface
pragma.
function out = line_buffer_average(in1)
coder.hdl.interface(in1, "Line Buffer", [20, 20], FillMethod = 'Nearest');
sum = 0;
for i = 1:size(in1,1)
for j = 1:size(in1,2)
sum = sum + in1(i,j);
endend
out = sum / numel(in1);
end
The MATLAB test bench demonstrates the usage of the hdl.WorkingSet
class and getWorkingSet method. It generates the working sets for each
pixel of the input
image.
image = rand(20, 20);
ws = hdl.WorkingSet(image, [3 3], FillMethod='Nearest');
for x = 1:20
for y = 1:20
workingSet = ws.getWorkingSet(x, y);
out = line_buffer_average(workingSet);
end
end
Note
hdl.WorkingSet class and getWorkingSet method must
be used inside the MATLAB test bench.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.